Files
BFM-decomp/phase-ends/current/logs/T3.c2.md
T

3.3 KiB

T3.c2 — rung S plan: pinned base→type + finished files out

Cause (confirmed)

  • Hypothesis held. .run/P39/t3c2/cmp_bbt.py (scratch) over ov bases (non-.h):
    • pinned .run/P39/census/body_base_type.json (T1, 10:25): 116484 bases, 31408 canonical; top Unkstruct_80126B58, Unkstruct_800B5CB8.
    • current .run/P37/census/body_base_type.json (14:18, after t3_S5 census): 103469 bases, 0 canonical; top Unkstruct_800D3888 (22682).
    • untouched file src/ov_MAIN_012/ov_MAIN_012.c|func_8012E9C0 (no t3_ S row): param:param_1 pinned Unkstruct_800B5CB8 (canon) → current Unkstruct_800D3888 (not canon).
  • So the per-batch type_census --sites renames types in body_base_type.json; plan_S's canonical filter drops every base → t3_S6 0 of 0.
  • Drawable never fell: plan_S had no finished-file exclusion (work_file_S skips done bodies but the file is still drawn).

Change

  • tools/restruct.py:
    • BBT_PIN (env RESTRUCT_BBT, CLI --bbt PATH); merge_bbt(cur, pin, can): per (body, base), a non-canonical current type falls back to the pinned entry when that is canonical; keys come from current only. bbt() applies it when pinned (exits if the pin path is missing).
    • s_finished(tu, fns, latest): every body's latest ("S",tu,fn) row has nhash_after == current body_nhash (file parsed only when every body has a latest S row with a hash). Any verdict counts (latest row = verdict, R70); TOOL-ERROR rows (nhash_after None) keep the file drawable.
    • plan_S(..., latest=None, data=None): drops finished files, counts skipped["file-finished"]; both callers (--plan, --apply) pass ledger_latest(rows).
    • selftest +3 controls: merge fallback (canonical pin taken, non-canonical pin not); drifted bbt draws 0 / merged draws 1; finished at current nhash → not drawn, stale latest hash → drawn.
  • tools/restruct_cycle.sh: RESTRUCT_BBT=… → --bbt on the apply line; usage line documents it.

Verified

  • .venv/bin/python tools/restruct.py --selftest → 88/88 OK; /usr/bin/python3 tools/restruct.py --selftest → 88/88 OK.
  • make kit-corpus → corpus materialised (409 copies); make tools-health → OK.
  • restruct.py --plan --rung S --only "ov_*" (no pin) → 0 of 0 drawable files … skipped bases {'type-not-canonical': 103469} (.run/logs/t3c2_plan_nopin.log).
  • same with --bbt .run/P39/census/body_base_type.json → 50 of 1901 drawable files · 340 bodies · 397 typed bases · 2063 deref sites · skipped {'type-not-canonical': 83385, 'file-finished': 187} (.run/logs/t3c2_plan_pin.log).
  • full counts (.run/P39/t3c2/plan_counts.py, batch unlimited, pinned): no finish filter 2088 files / 17165 bodies; with filter 1901 files / 14621 bodies (187 finished files out).

Expert notes

  • The pin .run/P39/census/body_base_type.json is gitignored and untracked (11.5 MB); nothing in tools/ writes it. Losing it loses the fix's input: copy or git add -f if wanted.
  • 225 TUs carry t3_ S rows; 187 count as finished; the rest have a body with no / stale / hashless latest row (e.g. TOOL-ERROR) or a body judged by an earlier label at an older hash.
  • Bases new since the pin (not in it) stay non-canonical: newly typed bodies are not drawn until a canonical census is pinned again.
  • Sweep resume: RESTRUCT_BBT=.run/P39/census/body_base_type.json LABEL_PREFIX=t3_ TASK=T3 tools/restruct_cycle.sh 6..60 50 S "ov_*" (not run).