package main import ( "os" "strings" "testing" ) // R-1189 (d): the catch-up in main.go carries the After hook that runs the off-site proof and the due-gated integrity // check (internal/nightchain TestR1189d_* pins that After runs; this pins that production wires it). // RED-PROOF: the After block removed from main.go → this fails. func TestR1189d_TheCatchUpIsWiredToTheChecks(t *testing.T) { src, err := os.ReadFile("main.go") if err != nil { t.Fatal(err) } s := string(src) i := strings.Index(s, "catchUp := &nightchain.CatchUp{") if i < 0 { t.Fatal("the catch-up literal is gone from main.go") } lit := s[i:] lit = lit[:strings.Index(lit, "\n\t\t\t}\n")] a := strings.Index(lit, "After: func(ctx context.Context) {") if a < 0 || !strings.Contains(lit[a:], "runOffsiteProof(") || !strings.Contains(lit[a:], "runOffsiteIntegrityCheck(ctx, backupMgr, notifier, logger, false)") { t.Fatal("the catch-up must run the off-site proof and the due-gated (force=false) integrity check after its legs") } }