From d0dca96faf1cfced55647203cd123b5bca1f28cd Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Mon, 24 Aug 2026 14:55:22 -0600 Subject: [PATCH] fix(main-lane): commit each verified sub-batch immediately, not at cycle end (R42) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bisect can run many levels; deferring the commit left byte-proven functions sitting uncommitted in src/ for the whole descent — precisely the window in which any other tool's blind revert destroys them (61 banked functions died that way once). The tree is verified byte-identical on the line where the credit is granted; that is both when it is safe to commit and when it must be. --- tools/main_lane.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/main_lane.py b/tools/main_lane.py index aa953d512..1c2861c10 100644 --- a/tools/main_lane.py +++ b/tools/main_lane.py @@ -176,6 +176,11 @@ def gate_batch(tag, slate, depth=0): f"byte-identical ({line}). Left for a human; gate_main reverts its own aborts.") return 0, [] log(f"{tag}: {len(banked)} banked, main byte-identical — {line}") + # COMMIT HERE, not at the end of the cycle (R42). A bisect can run for many levels, and + # deferring left byte-proven functions sitting uncommitted in src/ the whole time — exactly + # the window in which a blind revert by any other tool destroys them. The tree is verified + # byte-identical on this line; that is the moment it is safe and the moment it is durable. + commit_banks(tag, banked) return len(banked), banked if "COMPILE conflict" in out and len(slate) > 1 and depth < 4: @@ -218,8 +223,7 @@ def cycle(a, tag): log(f"{tag}: {len(parked)} PARKED draft(s) from earlier overlay waves — gating those first " f"(already drafted, never gated)") batch = parked[:a.batch] - n, banked = gate_batch(tag, batch) - commit_banks(tag, banked) + n, banked = gate_batch(tag, batch) # gate_batch commits each verified sub-batch (R42) failed = [x for x in batch if x["fn"] not in set(banked)] if failed: fp = ".run/main_queue_failed.json" @@ -262,8 +266,7 @@ def cycle(a, tag): keep, counts = OX.reloc_filter(tag, drafts, cards) log(f"{tag}: reloc_identity {counts} -> slate {len(keep)}") slate = [{"fn": k["fn"], "draft": k["draft"]} for k in keep][:a.batch] - n, banked = gate_batch(tag, slate) - commit_banks(tag, banked) + n, banked = gate_batch(tag, slate) # gate_batch commits each verified sub-batch (R42) with open(LEDGER, "a") as f: f.write(json.dumps({"t": time.time(), "tag": tag, "cards": len(targets), "drafts": len(drafts), "slate": len(slate), "banked": n,