Use stable examples in repository tools - #2070
Conversation
✅ PR validation — Passednoverify: no source/build-data changes in this PR Each changed |
Right problem, and I confirmed the premise from the ROM — but
|
| header | why |
|---|---|
include/dBase_c.h |
root of the hierarchy, agrees, nothing above it to re-key it |
include/dActor_c.h |
agrees; it is TI[2] of the very class this PR is about |
include/fBase_c.h |
agrees; already licensed in landed TU manifests |
Please point all three sites at one of those instead — tools/check_header_offsets.py:12, tools/test_check_header_offsets.py:293, and the include/ half of the reasoning. Confirm the chosen header still returns 0 from C.main([...]), since that is what the test asserts; --changed-style repo-root resolution is the thing being guarded and any real tracked header exercises it.
One style note on marker_evidence.py
Swapping the concrete example for abstract prose costs more than it needs to:
- A byte-matching revision of `src/_ZN3AmpD1Ev.cpp` declared
- `struct Amp : Actor { ModelAnim m0; /* 0xd4 */ ... }`, so both the offsets
- and the class names in it are pinned by the ROM's own relocations.
+ A byte-matching migrated file may declare a local class layout with named
+ members at measured offsets. Both those offsets and the class names are then
+ pinned by the ROM's own relocations.
The new text says what the function accepts; the old text said why anyone should believe it, which is the half this tree's docstrings are for. Only the path token is what check_dead_references reads — the class name and the struct sketch are invisible to it. So keep the example and drop the path:
A byte-matching revision of
daBrq_c's D1 declaredstruct daBrq_c : dActor_c { ModelAnim m0; /* 0xd4 */ ... }, so both the offsets and the class names in it are pinned by the ROM's own relocations.
Concrete, and nothing in it can go red. (Using the ROM name rather than Amp also means the sentence survives the rename that prompted this PR.)
Verdict
Changes requested, and they are three tokens plus one sentence. The direction is correct and worth landing — I would rather this go in properly than go in and have to be redone when dCamera_c lands. Everything else is clean: no behavior change, the test still guards what its docstring says it guards, and 20/20 plus check_dead_references green is the right validation set for this.
A general note for anyone writing tool prose after this: python tools/rtti_name_audit.py --class <Name> is a second and tells you whether a path you are about to hard-code is one of the 276 that will still exist next month or one of the 259 that will not.
Measured the substitute for you —
|
Closing in favour of #2074 — your diagnosis was right, and
|
…prove work (#2074) * Use prose examples the cartridge agrees with, and make the gate test prove work Re-cut of #2070. Its diagnosis was right -- a class-specific path hard-coded in tool prose is a live reference that check_dead_references resolves, so it goes red the moment the class is renamed. Its substitute had the same defect. `tools/rtti_name_audit.py --class`, walking _ZTV-4 -> _ZTI -> _ZTS in the cartridge: dActor_c ROM 8dActor_c AGREES Camera ROM 9dCamera_c DISAGREES -- #2070's replacement Amp ROM 7daBrq_c DISAGREES -- what #2070 replaced Both sides of that swap are in the 259-of-541 coined set and both are scheduled for rename, so #2070 bought nothing. dActor_c and dScMgBase_c agree with the cartridge and nothing above them can re-key their names. marker_evidence.py keeps its concrete struct sketch and loses only the per-symbol path. Rewriting a specific docstring into abstract prose costs explanatory value for nothing; the path was the only part that could die. A per-symbol file dies twice over -- on rename, and on TU promotion folding it into src/actors/<Class>.cpp. test_a_real_tree_header_still_parses asserted only rc == 0, which a header the parser SKIPPED satisfies just as well: include/dActor_c.h rc=0 33 commented fields, 0 mismatched include/fBase_c.h rc=0 skipped -- polymorphic, implicit vptr not modelled The second is the exact "reported a pass and checked nothing" shape this file exists to catch, and the old assertion passed on it. Now the test reads the gate's own output and requires a positive checked-field count, so a future substitution into a skipped header fails loudly instead of quietly asserting nothing. check_dead_references clean, check_python_names PASS, 20/20 tests pass. * Name two more doomed prose paths by symbol instead Both are pre-existing on main and both resolve today, so no gate is red -- but they are the per-symbol shape that dies twice over, on rename AND on TU promotion, and one of them is live ammunition right now: src/_ZN8PoleLiftD1Ev.cpp src_tu/actors/PoleLift.cpp already exists src/_ZN5Stage11RenderModelEv.cpp A PoleLift promotion deletes the first one out from under this docstring and takes main red on dead references, which is exactly how main broke earlier today at 6d8f8e5 (fixed in #2073). Named by mangled symbol instead. check_dead_references reads only a/b-shaped path tokens, so `_ZN8PoleLiftD1Ev` cannot dangle, and the symbol survives both rename and promotion. The concrete evidence in both comments -- the local ModelComponents stand-in, and the 0x80/0x158/0x50 padding numbers -- is unchanged; only the citation spelling moved.
Replaces volatile class-specific paths in tool documentation and the header-offset regression fixture with stable equivalents. This keeps class TU promotions from creating dead repository references without changing tool behavior.\n\nValidated locally:\n- python -m unittest -v tools.test_check_header_offsets (20/20)\n- python tools/check_header_offsets.py include/Camera.h\n- python tools/check_dead_references.py\n- pre-push port references and 92/92 src_tu compiles