Files
BFM-decomp/docs
Drew T f285de46e8 feat(phase-29): T53 — fold the T51 lever into the gate; kill gather_externs' false positive; close a revert gap
Items 1-2 off T52's list, plus a third defect found by T53's own testing. TOOLING ONLY — banks
nothing; metrics unchanged by design (85.7% instr / 76.4% distinct / 90.65% fn-count).

1. THE T51 PRE-PASS IS A jtbl_family_bank STAGE (cookbook §103, AUTOMATED)
   Order: raw -> scoped -> tu-scoped -> recovered -> reconciled. After the non-invasive stages (it
   edits the TU outside the spliced body); BEFORE the recovery stages deliberately — those bend the
   DRAFT and T48 measured both at +3 ins for this class, so they cannot succeed here. The stage
   re-runs scope_data_fix against the SCOPED TU rather than reusing the raw body: composition-correct,
   since the contested symbols no longer have a file-scope decl to be dropped against.
   COUNTERFACTUAL, byte-gated on a reproduced blocker (ov_SC01_000 restored to its pre-T51 TU):
     raw        -> compile error (conflicting types)
     scoped     -> compiles, FAILS the byte check (§8d drops the decl -> the u8 CSE costs +3)
     tu-scoped  -> BANKED
   That is the evidence the stage does the work — not T52's sweep, which ran on TUs T51 had already
   scoped by hand.
   Refactor note: a stage editing outside the spliced body must RE-FIND the splice point (the stub
   offset indexes the ORIGINAL TU). Each stage now carries its base; every pre-existing stage passes
   `orig`, where the re-search returns the identical span — same operation as before, by construction.

2. gather_externs' COMMENT-SCANNING FALSE POSITIVE — FIXED (cookbook §104)
   It scanned RAW text, so a symbol named only in the draft's PROSE counted as referenced: the
   func_80135D20 warning that fired on 137/137 and was right 0 times. Fix is a two-text discipline —
   MATCH on cdecl._mask'ed text, EMIT by span from the ORIGINAL (a masked decl is all blanks, so
   "just mask it" would splice whitespace). Same change closes a second, unobserved defect of the
   class: a COMMENTED-OUT extern could be selected as the carried decl and spliced in as live code.
   MEASURED as a no-op on output (R14): 20 (exemplar, sibling) draft pairs across 4 families, old vs
   new -> 20 identical / 0 differing. Only the false warning changed.

3. UNPLANNED — A REVERT THAT DID NOT SURVIVE AN EXCEPTION (cookbook §105)
   A wrong exemplar made remap_hseq raise AFTER the carve rewrote config/ and jr_isolate created a
   region file; the exception propagated out of bank(), the revert never ran, and the tree kept a
   rewritten carve config plus an UNTRACKED region file (git checkout -- src/ does not remove it).
   In a 132-member sweep that residue rides into the next member's build. bank() is now a
   revert-guaranteed wrapper around _bank(). Negative-control proven: the crashing invocation now
   reports {'exception': 2} and leaves git status -- config/ src/ at 0.
   "Revert on failure" != "revert on every exit"; the exits are success, gate-fail, refusal, and the throw.

GATES: R22 clean-fleet 140 passed, 0 failed of 140. tools-health OK (corpus 0 PHANTOM + 0 TRUNCATED,
cdecl, audit-binaries, report/lint/dedup 1886/0). 0 NON_MATCHING (G4).

HONEST COVERAGE GAP: no live end-to-end BANK through the refactored loop — all three big families are
137/137 and the only family with live stubs (0x80191c50) has no banked exemplar, so it refuses. The
counterfactual byte-gated the exact splice on all three candidates and the 2-member run exercised
construction/refusal/revert/tally; the next real family sweep is the true end-to-end validation.

MY ERRORS: invoked the sweep with a wrong exemplar+address for a cross-address family (an unmeasured
guess about a members file I had not read — it is what surfaced defect 3); and deleted last_err's
initializer while refactoring, which would have raised NameError on the first clean gate-fail.

cookbook §103 (AUTOMATED) + §104 + §105; SETUP inventory row updated (R21).
2026-07-28 19:26:38 -06:00
..