carlos / platform Public

witness B1 independently: startup admits a current-binding cold handover against fresh authority (roster binding fix round 1, finding 4)

The B1/B3 witness restarted root after the binding changed, so Obsolete
settled the journal before Run reached Admit; removing only startup's
admission left it passing.

TestColdHandoverStartupAdmitsAgainstFreshAuthority interrupts a cold
handover under B0, restarts root with the roster unchanged (startup
binding B0, so the journal is not obsolete), then changes the fresh
authority before RecoverPending: a quarantine, then a readmission. Each
time no settlement is logged, the barrier stays, the journal stays
prepared, the successor has no inventory, the prior is intact, and
recovery reports the refusal. With only RecoverPending's cold.Admit
removed, the handover resumes (barrier gone) and the test fails, while
TestColdHandoverObsoleteBarrierSettledAtStartup still passes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 267dcf173a89063a05be542b4de55548f4baf4aa parent ca73afa
1 file changed, +82 −0
  • internal/host/claim_binding_handover_linux_test.go +82 −0
diff --git a/internal/host/claim_binding_handover_linux_test.go b/internal/host/claim_binding_handover_linux_test.go
index b5a3f1ccb..c2e45484b 100644
--- a/internal/host/claim_binding_handover_linux_test.go
+++ b/internal/host/claim_binding_handover_linux_test.go
@@ -368,3 +368,85 @@ func TestColdHandoverObsoleteBarrierSettledAtStartup(t *testing.T) {
t.Fatalf("journals after the reinstall: %v", w.coldJournals())
}
}
+
+// B1, independently (fix round 1, finding 4): a journaled cold handover
+// whose successor matches root's startup binding is not obsolete, so only
+// startup's fresh admission stands between it and a resume. Root restarts
+// with the roster unchanged (startup binding B0), then the fresh authority
+// changes before RecoverPending: a quarantine, then a readmission (B1).
+// Each time startup refuses the resume, and nothing of the successor
+// exists: the barrier stays, the journal stays prepared, the successor has
+// no inventory, the prior's row and active stamp are its own. Removing only
+// startup's admission (the Admit of RecoverPending's cold handover) resumes
+// the handover here.
+func TestColdHandoverStartupAdmitsAgainstFreshAuthority(t *testing.T) {
+ ctx := t.Context()
+ w := newAssemblyWorld(t)
+ w.mustStart()
+ b0 := w.fresh()
+ rec, route := w.newHost("a")
+ if err := w.agent(b0).install(rec, route); err != nil {
+ t.Fatal(err)
+ }
+ route = w.installedRoute(rec.Host)
+ prior := w.operationStop(rec.Host, b0.Binding)
+ socket := w.serve()
+ receipt := w.predecessorReceipt(socket, prior)
+ admitted := w.coldAdmit(rec.Host, "g6")
+ request := coldRequestFor(receipt.Target, admitted, w.roster.row().Enrollment, b0.Binding)
+ successorStamp := hostguard.Captured{Incarnation: admitted.Claim.Holder.Incarnation, Stamp: admitted.Claim.Holder.Stamp}
+ captured := hostguard.Captured{Incarnation: receipt.Target.Incarnation, Stamp: receipt.Target.Stamp}
+
+ // Root dies right after BeginColdHandover's write, under B0.
+ *w.interrupt = 2
+ status := postRecoveryHandover(t, socket, request)
+ *w.interrupt = -1
+ if status != http.StatusConflict {
+ t.Fatalf("interrupted handover: HTTP %d", status)
+ }
+ // Restart with the roster unchanged: the journal matches the startup
+ // binding, so it is not obsolete.
+ if err := w.restart(); err != nil {
+ t.Fatal(err)
+ }
+ if w.root.startupBinding != b0.Binding {
+ t.Fatalf("startup binding %q, want B0 %q", w.root.startupBinding, b0.Binding)
+ }
+ untouched := func(what string) {
+ t.Helper()
+ if v := w.view(rec.Host, captured); v.Barrier == nil || v.Barrier.Stamp != successorStamp.Stamp {
+ t.Fatalf("%s: barrier %+v", what, v.Barrier)
+ }
+ journals := w.coldJournals()
+ if len(journals) != 1 {
+ t.Fatalf("%s: journals %v", what, journals)
+ }
+ for _, phase := range journals {
+ if phase != "prepared" {
+ t.Fatalf("%s: journal phase %q", what, phase)
+ }
+ }
+ if _, revision := w.successorInventory(admitted); revision != 0 {
+ t.Fatalf("%s: the successor got an inventory", what)
+ }
+ w.priorIntact(what, receipt.Target, route)
+ }
+ for _, change := range []struct {
+ what string
+ apply func()
+ }{{"quarantined", func() { w.roster.quarantine("loss_1") }}, {"readmitted", func() { w.roster.readmit() }}} {
+ change.apply()
+ logs := captureLog(t)
+ err := w.root.RecoverPending(ctx)
+ if strings.Contains(logs(), "obsolete cold handover") {
+ t.Fatalf("%s: settled as obsolete, so admission was not what refused: %s", change.what, logs())
+ }
+ untouched(change.what)
+ if err == nil {
+ t.Fatalf("%s: startup recovery reported no refusal", change.what)
+ }
+ }
+ if b1 := w.fresh(); b1.Binding == b0.Binding {
+ t.Fatal("readmission did not move the binding")
+ }
+}