Files
BFM-decomp/tools
Drew T fe66f181e1 fix(gate_main): terminating bounded bisect + idempotent typedef hoist
The P31 S58 main probe ran 38 minutes on 8 drafts and never produced a verdict. Two
independent non-termination bugs, both fixed and negative-controlled:

1. THE BISECT COULD NOT TERMINATE. On a failing multi-element chunk it did 'lo = head + lo',
   restoring lo to exactly its prior value, so the next iteration recomputed the same head and
   failed identically — forever. Replaced with an explicit-stack bisect that SPLITS a failing
   chunk and pushes both halves, so work strictly decreases and termination is structural.
   GATE_MAIN_MAX_STEPS (24) is a loud backstop, not the mechanism.
   Verified: 8 drafts with one poisoned -> 7 banked, 1 rejected, 7 rebuilds.

2. THE TYPEDEF HOIST WAS NOT IDEMPOTENT. The block is inserted AT the anchor, so anything
   hoisted previously still started after it and was re-hoisted every call, stacking a fresh
   marker comment each time ('hoisted 2 typedef(s)' x150; the tree held a duplicated marker).
   Now tracks the already-hoisted region and reuses the existing marker.
   Verified: 3 consecutive passes hoist [Foo,Bar], [], [] with exactly 1 marker.

Together these unblock main: 170 parked drafts and ~1,041 open stubs.
2026-08-24 09:40:24 -06:00
..