re: diff_optrace resync-tolerant alignment (blind spots vs real forks)
Strict lockstep over-reported: the operand hook misses any op whose operands aren't fetched via vm_operand_fetch (comment 0x1a7, set-string 0x192, the 0x1c7/0x1cc/0x131/... string-op cluster) — the engine executes them (they sit after non-branching ops) but they're absent from its trace. New align() resyncs over such one-sided insertions and reports only NON-realignable forks; it separates VM-only blind spots (artifacts) from engine-only detours (real, reconverging branch/state gaps, surfaced honestly). +2 tests (7/7). Result: with G[0x6c1] seeded the SC0000 opening has NO non-realignable fork across all 539 VM ops (was: false 'diverge at 0x8d'); residual = a 2-op engine-only color detour (0x202/0x203 @ 0x122d0). Cold's first real fork is a later G[0x6c1] gate. Validates the pre-scene-state theory end-to-end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# tools/test_diff_optrace.py (plain runner)
|
||||
import sys
|
||||
from diff_optrace import first_divergence, pick_scene_codebase, operand_filter
|
||||
from diff_optrace import first_divergence, pick_scene_codebase, operand_filter, align
|
||||
FAILS=[]
|
||||
def check(c,m): (FAILS.append(m) or print("FAIL:",m)) if not c else print("ok:",m)
|
||||
|
||||
@@ -26,8 +26,18 @@ def test_operand_filter_drops_zero_operand_ops():
|
||||
argc = {0x0:2, 0x5:0, 0xa:1, 0xf:0}
|
||||
check(operand_filter([0x0,0x5,0xa,0xf,0x5], argc)==[0x0,0xa], "operand_filter keeps only argc>=1 ops")
|
||||
|
||||
def test_align_resyncs_over_blindspot_insertions():
|
||||
# b has an extra op (99) the engine hook can't see; align skips it, no real fork
|
||||
r = align([0,1,2,3],[0,1,99,2,3])
|
||||
check(r["hard"] is False and r["skipped_b"]==[99], "align resyncs over a one-sided blind-spot op")
|
||||
|
||||
def test_align_reports_hard_fork():
|
||||
r = align([0,1,2,3,4],[0,1,7,8,9]) # after 0,1 they truly fork (no resync within window)
|
||||
check(r["hard"] and r["a"]==2 and r["b"]==7 and r["i"]==2 and r["j"]==2, "align reports a genuine fork")
|
||||
|
||||
def main():
|
||||
test_equal_no_divergence(); test_first_divergence_point(); test_prefix_shorter_vm()
|
||||
test_pick_codebase_by_longest_common_prefix(); test_operand_filter_drops_zero_operand_ops()
|
||||
test_align_resyncs_over_blindspot_insertions(); test_align_reports_hard_fork()
|
||||
print("FAILURES:",len(FAILS)); return 1 if FAILS else 0
|
||||
if __name__=="__main__": sys.exit(main())
|
||||
|
||||
Reference in New Issue
Block a user