package report import ( "io" "log" "testing" ) // R-1182 (hub v0.163.0): the hub now keeps the packages of OTHER set-aside copies after an abandonment, so // superseded_present can stay true for good; `abandon_purge_done` is what closes this box's declaration. The hook // runs on an unconfigured box too (the declaring box has deleted its set-aside copy; its target may be anything). // COMPANION RED-PROOF: drop the AbandonPurgeDone call in Reconcile → the first assertion fails. func TestR1182_TheHubsPurgeDoneClosesTheDeclaration(t *testing.T) { calls := 0 c := &EscrowAutoConfirmer{ Pending: func() bool { return false }, Escrowed: func() bool { return false }, AbandonPurgeDone: func() { calls++ }, Logger: log.New(io.Discard, "", 0), } c.Reconcile(&EscrowStatus{IdentityBlobPresent: true, SupersededPresent: true, AbandonPurgeDone: true}) if calls != 1 { t.Fatalf("purge-done hook calls = %d, want 1 — the box would declare its abandonment for ever", calls) } c.Reconcile(&EscrowStatus{IdentityBlobPresent: true, SupersededPresent: true}) if calls != 1 { t.Fatalf("hook ran on an ACK without abandon_purge_done (calls = %d)", calls) } } func TestR1182_MainWiresAbandonPurgeDone(t *testing.T) { found, saw := confirmerFieldIsWired(t, "AbandonPurgeDone") if !saw { t.Fatal("no EscrowAutoConfirmer literal found in main.go") } if !found { t.Fatal("EscrowAutoConfirmer is built WITHOUT AbandonPurgeDone — a finished abandonment never closes (R-1182)") } }