R-1182: a finished off-site abandonment closes on the hub's abandon_purge_done (hub v0.163.0 keeps other copies' packages); unreleased
gates / gates (push) Successful in 1m18s

This commit is contained in:
admin committed 2026-10-21 13:36:12 +02:00
1 parent 01c967e49e
commit 8f5bea0148
4 files changed
+68 -2

No files matched your search

@@ -0,0 +1,39 @@
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)")
}
}