T3: rung S sweep done: residue ledgered, unbacked 0, R22 218/218; summary and ops note

This commit is contained in:
Drew T
2026-10-02 03:40:35 -06:00
parent 83ee0c4366
commit f01aa61b6c
6 changed files with 59 additions and 1 deletions
+1
View File
@@ -53,3 +53,4 @@ ops-setup-decomp.md | extract the medium and verify against the committed manife
wsl-disk-capped-75gb.md | wsl-disk-capped-75gb | 34
p38-t4-2026-09-29-restruct-head-fold-mode.md | §P38 T4 — 2026-09-29: restruct rung L head-fold mode | 9
p39-t1-2026-10-01-restruct-stale-supersede-timeline-check.md | §P39 T1 — 2026-10-01: restruct stale-row supersede; timeline --check | 5
p39-t3-2026-10-02-restruct-rung-s-residue-head-types-add-pads.md | §P39 T3 — 2026-10-02: restruct rung S residue/check-residue; head_types --add-pads | 6
@@ -0,0 +1,8 @@
# §P39 T3 — 2026-10-02: restruct rung S residue/check-residue; head_types --add-pads
- `restruct.py --rung S --residue --only "ov_*" --label <l>`: ledger-only; one S row per body with a P/X census site and no latest S row (plan_S never draws bodies whose bases are all TYPE-NOT-CANONICAL / not visible). Site causes TYPE-NOT-CANONICAL, TYPE-NOT-VISIBLE, NO-TYPE-IN-MAP (untyped), NO-EDIT, FILE-SCOPE (unit `<file-scope>`, fn null). No src edit, no R22.
- `restruct.py --rung S --check-residue [--only glob]` (default `ov_*`): prints `uncovered <n> sites / <m> bodies`, exit 1 if n > 0. Reads `.run/P37/census/sites.jsonl` (run the census first).
- Rung S macro carry (T3.c8, `s_base_norm`): a kept CAST_* macro stays backed when a later batch respells its nested base (`*(T *)(X + k)` ≡ `((S *)X)->unkK`).
- `head_types.py --add-pads CANDIDATES.json --header include/struct_types.h`: additive mode; keeps the generated region's fields byte-for-byte and only splits pad arrays for candidate fields `[{type, off, width, sign}]`; no struct map read. Use instead of a full regen when existing member spellings must not move.
- A canonical type that becomes live after a sweep must leave `docs/struct-twins.md ## Dead kept` (else `--check-structs` twins_stale=1). `struct_twins.py --write` needs a built tree (after `make clean` it binds fewer objects).
- `.run/P37/restruct/ledger.jsonl` is tracked under ignored `.run/`: `git add -f` it before `tools/commit_task.sh`.
+1 -1
View File
@@ -69,7 +69,7 @@ R3.38-001 (remaining work after P37; Gen3 constraints), R3.38-002 (type_census /
Timeline: `PY tools/timeline.py` then `PY tools/progress.py --readme`; commit before R22. The census baselines are the denominators every later task and the closing record quote; key sites by (binary, address, body) (R99).
- T2 | done | expert-fable | title: cast and lying gate instruments, reinterpret-macro set | coder: opus55 | effort: high | files: tools/type_census.py, tools/lever_census.py, include/common.h, config/lying_exceptions.tsv, config/lever_residue.tsv, docs/gen3-standards.md | done-when: `type_census --check-casts` exists with the Interfaces output line; it FAILS on the T1 tree with T1's counts; selftest has positive/negative controls for each form, for a macro site with and without its ledger row, and for a ledgered vs unledgered lying callee; the reinterpret-macro set (names, expansion = identical cast, one cause class each: at minimum SCHED-ALIAS, SIGN, WIDTH/overlap loser, MISALIGNED, NON-STRUCT base) is defined in include/common.h and documented in docs/gen3-standards.md, with one byte-proof per macro (an existing kept site respelled → make check IDENTICAL); M2C_FIELD stays raw form M; under reading A, lever_census --strict --residue with its selftest; the census caches invalidated; type_census --check-structs still 0 | verify: PY tools/type_census.py --selftest && PY tools/lever_census.py --selftest && PY tools/type_census.py --check-structs --quiet && (PY tools/type_census.py --check-casts; test $? -eq 1) | reads: T1 | deps: T1 | est-ctx: 130k | review: no | wait-for: —
Judgment: what counts as raw vs a backed reinterpret macro, and the cause classes; decide whether legacy LOBU/LOH/HIH… are reinstated as macros of this set. Header edit to common.h re-fans the fleet: land the macro set in ONE edit + one R22. The gate cross-checks macro sites against `restruct.ledger_latest` rows (R100), never a second filter.
- T3 | queued | expert-opus55 | title: rung S sweep, overlays (forms P and X) | coder: opus55 | effort: medium | files: src/ov_*/**/*.c, include/struct_types.h, src/shared/engine_types.h, .run/P37/restruct/ledger.jsonl | done-when: every ov_* body with a P or X site on a struct-map base processed by restruct --rung S (S1 then S2) through restruct_cycle.sh batches, each batch R22-green and committed; kept casts respelled with T2 macros backed by KEPT rows; missing fields added to the canonical types in batched header edits (≤ 1 fan-out per batch of field additions); residual P/X on ov_* each ledgered with a cause class; summary records before/after per form, kept count by cause, bodies refused and why | verify: PY tools/type_census.py --check-casts --quiet; PY tools/type_census.py --check-structs --quiet && make clean && make extract-all JOBS=16 && make check-all JOBS=16 | reads: T1, T2 | deps: T2 | est-ctx: 160k | review: no | wait-for: —
- T3 | next | expert-opus55 | title: rung S sweep, overlays (forms P and X) | coder: opus55 | effort: medium | files: src/ov_*/**/*.c, include/struct_types.h, src/shared/engine_types.h, .run/P37/restruct/ledger.jsonl | done-when: every ov_* body with a P or X site on a struct-map base processed by restruct --rung S (S1 then S2) through restruct_cycle.sh batches, each batch R22-green and committed; kept casts respelled with T2 macros backed by KEPT rows; missing fields added to the canonical types in batched header edits (≤ 1 fan-out per batch of field additions); residual P/X on ov_* each ledgered with a cause class; summary records before/after per form, kept count by cause, bodies refused and why | verify: PY tools/type_census.py --check-casts --quiet; PY tools/type_census.py --check-structs --quiet && make clean && make extract-all JOBS=16 && make check-all JOBS=16 | reads: T1, T2 | deps: T2 | est-ctx: 160k | review: no | wait-for: —
Isolate on one TU first (C0507 exemplar `func_801814AC`, ov_SC05_010_jr_80180F84.c:3030: the +0x34 store must stay cast). Parameter retyping is a per-callee S → T → D unit (C0507). Use the linked oracle for global-block edits (R110). Retry a fan-out failure once (R40). Run cycles detached (skill restruct-cycle-watch). `--check-casts` still exits 1 here (other segments); read its P/X counts for ov_*.
- T4 | queued | expert-opus55 | title: rung S sweep, md_*, main and shared bodies (forms P and X) | coder: opus55 | effort: medium | files: src/md_*/**/*.c, src/main/**/*.c, src/shared/**, include/struct_types.h, src/shared/engine_types.h | done-when: as T3 for md_*, main and shared bodies; main gated only by tools/gate_main.py; shared-body edits followed by R22; P and X raw = 0 fleet-wide except sites ledgered with a cause that T5 owns (non-struct base) | verify: PY tools/type_census.py --check-casts --quiet; make clean && make extract-all JOBS=16 && make check-all JOBS=16 | reads: T1, T2, T3 | deps: T3 | est-ctx: 160k | review: no | wait-for: —
Shared bodies (C0502 §453 include-at-site share) re-fan every includer: batch them, one R22 per batch.
+11
View File
@@ -21,3 +21,14 @@
- cycle_t3_d: t3_S19..S49 green (R22 218/218 each), stopped after S49 commit 4f9445c6fa (648 drawable) to raise BATCH 50→200 (per-batch overhead ~20 min vs apply 1-2 min); interrupted snapshot is redone by the next cycle's calibrate step.
- cycle_t3_e (BATCH 200): t3_S50..S54 real (members 12305/5999/1456/1020/27), all R22 218/218; S55..S61 looped on 6 files (plan drawable, apply UNCHANGED rows 0: ov_SC02_000_jr_80187B40, ov_SC02_011_jr_80183178, ov_SC03_029_jr_8017FF7C, ov_SC04_002_jr_8017BEBC, ov_SC04_011_jr_8017D494, ov_SC03_006_jr_8017AE2C; plan/apply done-set disagreement, incl. c4 bases=[] rows). Killed by pid; src clean, HEAD b0951592bd.
- ledger scan (.run/T3/resid.py, pre-S50): 26,062 ov bodies with S rows; sites MEMBER 109,508 · RESIDUAL TYPE-NOT-CANONICAL 33,369 · KEPT WIDTH 17,925 / SIGN 9,740 / SCHED-ALIAS 1,127 / MISALIGNED 445 / NON-STRUCT 428 · RESIDUAL NO-FIELD 2,336 (site type None) / NO-TYPE-IN-MAP 632 / AGGREGATE-FIELD 410 / INDEX 341.
## Attempt 3 (respawn after handoff 2; progress archived logs/T3.progress2.md, 01cb47ebe1)
- c6 cycle t3_S61 still live at start (pgrep `^bash tools/restruct_cycl[e].sh`); woke on exit via `tail --pid`. S61 committed b6db95c62e: 141 files · 168 bodies · 529 sites → members · R22 218/218.
- c6 hand-back was lost with attempt 2; header + head_types.py left uncommitted. Verified header = `head_types.py --add-pads .run/t3c6/candidates.json` applied to HEAD copy (.run/T3/st_head.h, cmp identical); selftest OK; committed 45cb633d08 (17 fields). Coder later added its log d3cb6dff35 (NO-FIELD 2455 → 1912; unbacked 2 pre-existing).
- Coverage scan .run/T3/cover.py (log .run/logs/t3_cover.log): 34,131 ov bodies / 200,598 P/X sites with no S row (plan_S :3380 skips bodies whose bases are all non-canonical / invisible).
- Coder T3.c7 (brief: `--residue` ledger-only rows + `--check-residue`), f810278227: 34,131 rows (t3_resid); site causes TYPE-NOT-CANONICAL 197,600 · NO-TYPE-IN-MAP 2,349 · NO-EDIT 482 · FILE-SCOPE 167. Re-checked: `--check-residue` uncovered 0; `--check-ledger` 0 violations.
- check-casts (log t3_checkcasts) showed `unbacked 2` (func_8017EA20, S28 respelled the nested base under a T2-era CAST_NONSTRUCT). Coder T3.c8, ffecb36e29: `s_base_norm` carry + repair row t3c8_repair. Re-checked (t3_checkcasts2): unbacked 0.
- Gate t3_verify_gate: check-structs FAIL twins_stale=1. Cause: Unkstruct_80126B58 listed under `docs/struct-twins.md ## Dead kept` but now live in 1,633 .c files. Tried `struct_twins.py --write` after make clean: rebinds fewer objects (118 vs 124); reverted. Removed the Dead-kept bullet (4bcaae8b11); check-structs OK.
- Gate t3_verify_gate2: check-structs OK · extract-all 217/217 (+ main) · check-all 218/218.
- Final ov counts (.run/T3/ovpx.py, P39 T1 census vs P37 census now): P 387,001 → 238,399; X 13,441 → 13,431; K (kept macros) 0 → 20,390; C 35,414 → 169,472. Repo check-casts: P 408,974 → 260,372, X 13,800 → 13,790, I 60,666 → 51,514, M 19,542 → 15,130.
- H7: docs/ops/p39-t3-2026-10-02-restruct-rung-s-residue-head-types-add-pads.md + INDEX line.
+1
View File
@@ -2,3 +2,4 @@
# id | status | title | tags | summary | log | research
T1 | done | phase-start health, carry cleanup and baselines | - | tasks/T1.md | logs/T1.md | R3.39-001
T2 | done | cast and lying gate instruments, reinterpret-macro set | - | tasks/T2.md | logs/T2.md | -
T3 | done | rung S sweep, overlays (forms P and X) | - | tasks/T3.md | logs/T3.md | -
+37
View File
@@ -0,0 +1,37 @@
# T3 — rung S sweep, overlays (forms P and X)
Status: done | expert: expert-opus55 (3 attempts, 2 handoffs) | ctx-at-completion: n/a | commit: see COMMIT line of the return | coder runs: c1 done (3ff15ee462, 3507628e40, fe2e814776), c2 done (d476f3c92e), c3 done (568de6c713, 357451cbb9, e88040d15a), c4 done (0938e511ed..ffc0d3ecc1), c5 blocked→decision (a8dbad4a21), c6 done (45cb633d08, d3cb6dff35), c7 done (f810278227), c8 done (ffecb36e29)
Done: every ov_* body with a P/X site has a latest rung-S ledger row (sweep t3_S1..S61, each batch R22 218/218 and committed by restruct_cycle.sh; 34,131 undrawable bodies ledgered RESIDUAL by cause); kept casts are T2 macros, all backed (unbacked 0); 17 missing fields added to Unkstruct_80126B58 in one header fan-out.
Files:
- src/ov_*/**/*.c — cast → member respell (rung S1/S2) and CAST_* macros for kept sites
- include/struct_types.h — 17 pad-split fields in Unkstruct_80126B58 (generated region, head_types --add-pads)
- tools/restruct.py — rung S per-site classes, KEPT/RESIDUAL rows, CAST_* respell, --only glob, --bbt pin, plan/apply done agreement, --residue, --check-residue, kept-macro carry over respelled bases (s_base_norm)
- tools/head_types.py — `--add-pads` additive mode (existing fields byte-for-byte)
- docs/struct-twins.md — Unkstruct_80126B58 removed from Dead kept (now live)
- .run/P37/restruct/ledger.jsonl — S rows (tracked under ignored .run/)
- docs/ops/p39-t3-2026-10-02-restruct-rung-s-residue-head-types-add-pads.md, docs/ops/INDEX.md — new flags (H7)
Decisions:
- binding: a struct-map type with no canonical definition (TYPE-NOT-CANONICAL) is residual for rung S; its bodies get ledger-only RESIDUAL rows (`restruct --rung S --residue`), and `--check-residue` (uncovered 0) is the coverage check.
- Pad fields added with head_types `--add-pads` (additive), not a full head_types regen: full regen rewrites 157 lines and moves 141,260 MEMBER spellings.
- IN-LEAF NO-FIELD (offset inside an existing leaf field, 1,912 sites / 69 groups) stays residual: needs a union/split, deferred by the 3.38 decision.
Deviations:
- c6's hand-back was lost with attempt 2; its uncommitted header/tool edits were verified by regeneration (cmp identical) and committed by the expert under T3.c6.
- docs/struct-twins.md edited by hand (the `## Dead kept` list is hand-kept; `struct_twins.py --write` only rewrites `## Twins`).
Findings:
- Before/after ov_* (P39 T1 census vs final census): P 387,001 → 238,399 (−148,602); X 13,441 → 13,431 (−10); kept macros K 0 → 20,390; typed cast-member C 35,414 → 169,472. Repo-wide check-casts: P 408,974 → 260,372, X 13,800 → 13,790, I 60,666 → 51,514, M 19,542 → 15,130.
- Kept by cause (ledger site entries, ov): WIDTH 19,166 · SIGN 10,048 · SCHED-ALIAS 1,127 · NON-STRUCT 492 · MISALIGNED 445. Macros in src (repo): CAST_WIDTH 10,170 · CAST_SIGN 8,154 · CAST_ALIAS 1,127 · CAST_MISALIGNED 623 · CAST_NONSTRUCT 316.
- Residual P/X by cause (ov sites): TYPE-NOT-CANONICAL 234,400 · NO-TYPE-IN-MAP 2,444 · NO-FIELD 1,910 (IN-LEAF) · NO-EDIT 482 · INDEX 471 · AGGREGATE-FIELD 373 · FILE-SCOPE 167. MEMBER (converted) 127,888.
- Bodies (latest S rows, 61,603 ov): MEMBERS 25,955 · TYPE-NOT-CANONICAL 32,521 and RESIDUAL 1,610 (refused: no canonical type for any base) · KEPT 532 · S2 521 · NO-SITE 443 · KEPT-ALL 11 (every site kept, by class) · S+A 10.
- The X form barely moved: indexed `((T *)e)[i]` sites mostly sit on non-canonical bases or are INDEX residual.
- NO-EDIT 482: census type canonical and visible but body never drawn; likely body_base_type.json's base type differs from the site's type (unverified).
Gotchas:
- generalizable: hash-named bbt types (Unkstruct_<8hex>) block a rung-S redraw; a scratch pin built from the ledger rows' `bases[].type` gets through (T3.c6).
- generalizable: a later sweep batch that respells a nested base under an earlier kept macro silently unbacks it; match carried KEPT entries on a normalised base (`*(T *)(X+k)` ≡ `((S *)X)->unkK`).
- generalizable: a "dead kept" canonical type becomes live when a sweep spells members on it; `--check-structs` then fails twins_stale until it leaves `## Dead kept`.
- workflow: `.run/P37/restruct/ledger.jsonl` is tracked under ignored `.run/`; `git add -f` it before commit_task.sh (commit_task refuses the path).
- harness: the expert was forced to hand back while its coder was still running; the coder's hand-back is then lost. Poll git/log and verify uncommitted work by regeneration.
- harness: `struct_twins.py --write` after `make clean` binds fewer objects; run it on a built tree only.
Research: none new
Next task needs: TYPE-NOT-CANONICAL is now the dominant ov residual (234,400 sites, 32,521 bodies over 18,668 struct-map types vs 1,650 defined); reducing ov P further needs canonical definitions for the top map types first. IN-LEAF NO-FIELD needs union/split. `restruct --rung S --check-residue` must stay at 0 after any further S batch (re-run `--residue` for new bodies).
Verified: PY tools/type_census.py --check-casts --quiet → rc 1 (raw P=260372 I=51514 X=13790 M=15130 from all segments; macros all backed, unbacked 0; lying 229) · PY tools/type_census.py --check-structs --quiet && make clean && make extract-all JOBS=16 && make check-all JOBS=16 → check-structs OK, extract-all 217/217 + main, check-all 218 passed 0 failed of 218 (.run/logs/t3_verify_gate2.log) · restruct --rung S --check-residue --only "ov_*" → uncovered 0
Full log: phase-ends/current/logs/T3.md