Commit graph

3 commits

Author SHA1 Message Date
16adc92995 Add public API-surface snapshot regression test; lock #314 freeze decisions
Phase 1 of the #314/#313 plan (docs/plan-313-314.md): commit a deterministic
full-public-API-surface snapshot as the regression net BEFORE the #313
UIEntity::grid -> GridData refactor, so that refactor reduces to a reviewable diff.

tests/unit/api_surface_snapshot_test.py enumerates the complete public mcrfpy
surface (exported types' methods/properties with docstring-derived type + ro/rw,
12 enums with int values, module functions, singletons, the automation submodule)
and diffs it against tests/snapshots/api_surface.golden.txt. Re-baseline with
MCRF_UPDATE_API_SNAPSHOT=1.

Key design points (verified against source + live introspection):
- mcrfpy.Grid IS mcrfpy.GridView and delegates its real API to an internal
  _GridData via tp_getattro -- invisible to dir(). The test walks grid.grid_data
  AND probes delegation integrity on a live instance (69/69 members resolve).
- Behavioral writability probes compensate for docstring-derived ro/rw inference.
- Every exported class is classified FROZEN vs EXPERIMENTAL; the snapshot captures
  the classification so future additions force a deliberate freeze decision.

Freeze decisions recorded in docs/api-audit-2026-04.md:
- F3: grid_pos is the canonical cell-position name (matches the constructor kwarg);
  cell_pos/cell_x/cell_y documented as aliases. Docstrings aligned in UIEntity.cpp.
- F12: deprecated set_scale KEPT in the 1.0 surface (removal would be a new break).
- automation camelCase EXEMPT from the snake_case rule.
- EXPERIMENTAL (exempt): 3D/Voxel, Tiled/LDtk import, Shader, binding helpers.
- FROZEN: core UI/Grid/Entity/value types, enums, procgen (BSP/HeightMap/
  NoiseSource/DijkstraMap/AStarPath), Drawable (root).

Doc/stub regeneration and the entity.texture addition are deferred to Phase 2
(the #313 refactor). Addresses #314.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 07:51:02 -04:00
4a3854dac1 Fix audit type count (44->46) and add regression test for Color __eq__, refs #307
Review of session 1b14b941 found two issues:
- Exported type count was 44 in audit doc but array has 46 entries
  (EntityCollection3DIterType and one other were not counted)
- No regression test existed for the Color.__eq__/__ne__ fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 21:45:12 -04:00
71ab1dcf2e Add API consistency audit document for 1.0 freeze preparation
Comprehensive catalog of the full Python API surface area:
- 44 exported types, 14 internal types, 10 enums
- 13 module functions, 7 module properties, 5 singletons
- 15 findings across naming, functionality, deprecations, docs

Key findings: camelCase module functions (#304), deprecated
sprite_number (#305), legacy enum string comparisons (#306),
Color missing __eq__ (#307), redundant Grid.position (#308).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 21:18:25 -04:00