From cb0b15f2cf3d0bda8a14fd5e4e83c5171214b6d1 Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Wed, 30 Sep 2026 09:53:03 -0600 Subject: [PATCH] T5.1.c1: log --- phase-ends/current/logs/T5.1.c1.md | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 phase-ends/current/logs/T5.1.c1.md diff --git a/phase-ends/current/logs/T5.1.c1.md b/phase-ends/current/logs/T5.1.c1.md new file mode 100644 index 0000000000..98dc81af5e --- /dev/null +++ b/phase-ends/current/logs/T5.1.c1.md @@ -0,0 +1,39 @@ +# T5.1.c1 — type_census --check-structs reading (coder) + +Commit b65da945f. + +## Changed +- tools/type_census.py + - `find_definitions` :103 `declares_object` (non-typedef def whose tail names an object); canon defs get `idents` (body tokens); canon typedef alias records get `idents` (alias line tokens). + - `walk_file` :610 `ident_dropped` = the tokens the ident_counts filter drops (func_/D_/SCALARS/len<=1); `ident_counts` unchanged (progress.py + legacy dead keep the old filter). + - `TWINS_DOC = "docs/struct-twins.md"` module constant; `ADDR_RX`, `load_twins` :1042, `structs_reading` :1065 (dead liveness fixpoint, tier-2 allowlist, dead-kept allowlist, block frames, stale counts). + - `run_census`: `dup_full_names` (row lhash -> full name set; rec names capped at 40), `summary["structs"]`, json keys `structs_dead`/`structs_stale`, writes `/outside_canon.tsv` + `dup_gating.tsv`. + - `check_structs_verdict`: dup_classes/outside_canon/dead from `summary["structs"]`; new gating `twins_stale`. main's not-gating line + `twins_listed dead_kept block_frames`. + - selftest: +6 checks (CANON_FIXTURE/USE_FIXTURE/TWINS_FIXTURE). +- docs/struct-twins.md: skeleton (header text, `## Twins`, `## Dead kept`, empty). + +## Design notes +- Liveness is per name: roots = canon def/alias names (incl. typedef ptr_names, tags) appearing as any token outside CANON_HEADERS; a live name's defining canon def/alias adds its tokens ∩ graph minus its own names. So an unused tag of a used typedef (`typedef struct actor4c {..} X`) stays dead — same as the old reading for tags. +- `--check` counters untouched: `dead_canon_names`, `dup_layout_classes`, the four outside counters keep the old reading (render + --check + progress.py:1191). +- Twins match key = row lhash exactly (`` or `:opaque`); names compared as a set against the row's FULL name set. +- twins_stale = stale twin entries + stale dead-kept names. twins_listed / dead_kept count the VALID entries only. +- block frame = block-scope outside def with declares_object whose names are not in any gating row of the same base lhash (anonymous frames never are). + +## Verified +- `.venv/bin/python tools/type_census.py --selftest` → 30/30 checks OK. +- `bash tools/run.sh t51c1 -- .venv/bin/python tools/type_census.py --out-dir .run/P38/census --no-cache --check-structs` → FAIL (expected): + `dup_classes=198 outside_canon=3051 dead=3 twins_stale=0 variants=0 pad_names=0 parse_error_decls=1106 controls=4/4` + `conflicting_types=160 tu_conflict=0 types_floor_lying=1796 audit_other=0 twins_listed=0 dead_kept=0 block_frames=629 (not gating)` + Before: dup_classes=198 outside_canon=3680 dead=134. 3680 - 3051 = 629 = block_frames. +- outside_canon.tsv 3051 rows + header; dup_gating.tsv 198 rows + header. +- `--check` before/after on the same tree and out-dir (.run/P38/t51/chk; logs .run/logs/t51c1_check_before.log copied to .run/P38/t51/check_before.log, .run/logs/t51c1_check_after.log): identical except line 1, which carries `when`, the tool stamp (sha of type_census.py) and timings — inherent to any edit of the tool. +- Dead residual (3) → .run/P38/t51/dead_residual.txt: LineF2_8018F694, Unkstruct_80126B58, actor4c. + - LineF2_8018F694: only non-canon uses are inside `#define` continuation bodies (e.g. ov_SC06_032_jr_80182890.c:11153); the masker blanks macro bodies, so they are not counted (old reading had the same blind spot). + - Unkstruct_80126B58 (include/struct_types.h:302): no use anywhere. + - actor4c (engine_types.h:673): tag used only in its own body. +- Known-true check: CVec4_8017C218_8017D030 / CLR_8016CBC0 (old-dead) are used only as members of canon defs (engine_types.h:3652, :1204) → now live, as specified. + +## Gotchas +- workflow: `tools/commit_task.sh` also staged the expert's pending `phase-ends/current/research/{.next,INDEX.md,R3.38-002.md}` into b65da945f (it stages research/ as well as logs/). +- Running the census regenerates docs/struct-map.md (already dirty in the tree before this task; not committed here). +- walk cache grows by `ident_dropped` per file (func_/D_ tokens); TOOL_STAMP changed so old caches are invalid anyway.