T5.1.c2: log (partial: rename + ov-file batch)

This commit is contained in:
Drew T
2026-09-30 10:16:39 -06:00
parent 446161539c
commit d5e6380404
+26
View File
@@ -0,0 +1,26 @@
# T5.1.c2 — lift_types --census (partial: rename pass + batch ov-file committed green)
## Changed
- `tools/lift_types.py`: new census mode (section before `main()`), flags `--census TSV`, `--rename`, `--batch {ov-file,ov-block,md,main,headers,all}`, `--exclude-file`, `--excluded-out`, `-j`.
- `_walk(rel)`: same masked text + DEF_START walk as `type_census.find_definitions`, raw offsets; forms def/obj/frame/anon (cast)/anon-other/alias; anon restarts after its brace (census `;`-skip hides 2nd cast on one statement).
- `census_rename`: per (ord|tag) key one text fleet-wide; keeper = canon text, else (fixed local def exists) rename all movable, else most-used; new name `<Name>_<suffix>` (T5 var_fix suffix), one per text group; scope-aware occurrence rewrite; iterates to 0 conflicts.
- `census_move`: group per text (anon: per `Unkstruct_<addr>` name); target et iff all users (TU; header -> includers) `bet.type_visible`, else st; st deps forced st; engine_types.h canon deps of st defs relocated to struct_types.h; batch = min space of copies, dep-closed; every copy of a group stripped together; groups whose canon copy is relocated join the batch; Kahn order; appended before each header's closing `#endif`.
- Commits: 6869f8f26 (rename pass: 17 new names, 68 defs, 64 files), 446161539 (batch ov-file: 83 groups / 1374 defs; 42 new to engine_types.h, 3 new + 39 relocated to struct_types.h; 1235 files).
## Commands / results
- `lift_types.py --census .run/P38/census/outside_canon.tsv --rename --apply` -> round 1 conflicting keys 15, renamed 68; round 2 0.
- R22 after rename: `extract-all: 217 extracted, 0 failed of 217`, `check-all: 218 passed, 0 failed of 218` (130 s).
- batch ov-file first try: check-all 204/218 — relocated canon defs (Blk20, Blk8, CdFileLoc…) redefined against unstripped md/main copies. Fix: relocation pulls every group whose canon copy is relocated into the same batch. Retry R22: 217/217 extract, 218/218 check-all.
- Dry-run (pre-apply) totals: 3051 rows -> 3062 movable defs, 1344 text groups (52 anon names), 0 unmatched census rows, 8 excluded before the header-anon exclusion was dropped (now 0 expected).
## Remaining (next steps)
1. `lift_types.py --census .run/P38/census/outside_canon.tsv --batch ov-block --apply --excluded-out .run/P38/t51/c2_excluded.txt` (census TSV is the 09:47 one; line keys still valid only for files not yet edited — see gotcha), then `.run/P38/t51/c2/hdrchk.sh` (header-only cpp+cc1 compile), then R22 (`tools/run.sh --bg` + `--wait --max 270`), commit.
2. Same for md, main, headers.
3. Re-run census `type_census.py --out-dir .run/P38/census --no-cache --check-structs`; report counts; any residue -> `.run/P38/t51/c2_excluded.txt` with cause.
4. Commit docs/struct-map.md after the census regenerates it (currently dirty from before this task; not touched).
## Gotchas
- Census row keys are (file, line): batches strip lines, so after a batch the OLD tsv's line keys go stale for edited files. Rerun the census (`--no-cache`, ~?s) before each next batch, or the movable set silently shrinks (unmatched count printed: `census rows with no movable def found`).
- gcc 2.7.2 rejects an identical re-typedef at file scope: a name's copies in all spaces move together; batches are name-closed, not space-pure (deviation from "by space").
- Relocated engine_types.h defs leave their leading comment in engine_types.h (span-only strip).
- `.run/P38/t51/c2_renames.tsv` column 3 (old name) is mangled; column 4 is the new name.