mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-04 08:21:50 -04:00
4.5 KiB
4.5 KiB
T4 — fold the head types fleet-wide (rung L)
Status: done | expert: expert-opus55 | ctx-at-completion: n/a | commit: see COMMIT | coder runs: c1 opus55 done (d87c35435), c2 opus55 done (5ae5fe94c), c3 opus55 done (61c49eda0)
Done: 162 of 200 local head-type definitions folded onto Unkstruct_800B5CB8 through judged rung-L head-fold batches (accesses renamed by offset), each batch committed after its R22; 38 kept with cause; the three canonical names sit in no dup class, layout twin or variant camp.
Files:
- tools/restruct.py — rung L head-fold mode (
--only <canonical names>), type-aware offset renames incl. includers, sibling headers, macro bodies;--status --rung L --onlybuckets; atomic flocked inflight, apply.lock, TOOL-ERROR restore; +selftests (76) - tools/restruct_cycle.sh —
$TASKin commit msg, ledger committed with add -f, no CURRENT_PHASE.md append - include/struct_types.h — player block
pad44[3]→u8 unk44..46(md_MAIN_011 widths) - src/** (≈145 TUs), src/shared/engine_types.h, src/shared/ov/*.h — folds (batches t38_4probe, L1, L2, HL1, HRL1)
- docs/ops/p38-t4-2026-09-29-restruct-head-fold-mode.md + docs/ops/INDEX.md — the mode, ledger, cycle gotcha
- docs/struct-map.md — regenerated stamp Decisions:
- binding: a head fold is keyed by the canonical NAME and layout SIZE, not by layout hash; non-head objects of the same size are excluded by name glob with a cause (
HF_EXCLUDE: Blk152* copy blob, Fr_* stack frame); width/sign mismatches are left to the byte judge, never refused up front. - Local definitions become
typedef <Canon> <Local>;aliases (uses keep the local name); renaming uses to the canonical name is left for a later readability pass. Deviations: - 0x24C (
Unkstruct_80126B58) has no local definition anywhere (scan .run/P38/t4/headsized.json); nothing to fold. - Player block: 0 of 6 md_MAIN_011 copies folded (all DIFFERS) even after the pad44 split.
- Overall
--check-structsstill FAILs (fleet-wide gates for later tasks); the done-when's clause (the three in no dup class/camp) holds. - Batch t38_4L1 ran twice concurrently (my relaunch); 3 edited-unjudged files reverted by hand; the tree committed only after a green R22. Findings:
- Kept by cause: DIFFERS 29 (Ent_8017FD58 family 20 + Ent_801202A0 in engine_types.h; md_MAIN_011 player copies 6; ov_SC03_094 Ent_8017D898; ov_SC03_102 Ent), indexed array spanning fields 4 (Cnt_8018E8A0 ×3, Actor_80178D40 unkDC[7]), canonical pad at 0x3C 3 (Ent_8018D654 ×2, Ent_8018D3A4), COMPILE-ERROR 2 (Obj8017EBC4 ov_SC06_029_jr_8017C954.c:4027, Obj1CDC ov_SC05_010_jr_80181CDC.c:2873). Full list logs/T4.md.
- Remaining head-sized dup classes are all kept/excluded locals: Ent_8017FD58×20, Cnt_8018E8A0×3, Ent_8018D3A4/654, Ent/EntD820, Blk152×6, Fr_×2.
- The 20 Ent_8017FD58 DIFFERS + pad3C refusals are the max-site split's losers: evidence for T5's
Unkstruct_800B5CB8split/union call. - Counts after: dup_classes=205 outside_canon=5917 dead=142 variants=40 pad_names=25 parse_error_decls=1106. Gotchas:
- workflow: a detached
restruct_cycle.shlog stays 0 bytes until its first batch line;psforrestruct_cycl[e]before any relaunch (a double launch raced inflight.json). - harness:
restruct_cycle.shstops on final X≠Y and leaves edited files as restruct left them; revert unjudged files before R22. - harness:
.run/P37/restruct/ledger.jsonlis tracked under an ignored dir;commit_task.shcannot stage it (the cycle uses add -f). - generalizable: an opaque-tier struct fold must rename accesses in every file the definition reaches (includers, their sibling headers, macro bodies), type-aware by base, or the judge sees compile errors, not layout verdicts.
- harness: a header head-fold judges every includer (~55 s/unit, 29 units = 28 min); budget header batches.
Research: none (one retriever-code answer inline, no report)
Next task needs: T5 decides the 800B5CB8 split/unions using the kept DIFFERS/pad3C units above; md_MAIN_011 player copies need width reconciliation;
--rung L --only <canon names>is the fold tool for any new canonical type. Verified: .venv/bin/python tools/type_census.py --out-dir .run/P38/census --check-structs; .venv/bin/python tools/restruct.py --check-ledger && make clean && make extract-all JOBS=16 && make check-all JOBS=16 → census FAIL (fleet counts above; head names in 0 dup classes/twins/variants), check-ledger 0 violations, extract-all 217 extracted 0 failed, check-all 218 passed 0 failed, rc 0 (.run/logs/t4verify.log) Full log: phase-ends/current/logs/T4.md