carlos / platform Public

region HA: drain acknowledgements are signed for the ask

The ask to /.carlos/ha-drain was signed but its answer was a bare
{"seen": bool}, so a tenant app behind an older binary could acknowledge
a drain. Each ask now carries a fresh 16-byte nonce, covered by the
ask's MAC, and the receiver answers {"seen":...,"sig":...}: an HMAC
under the mesh key over its own domain, the answering box, the asker,
the transaction, the phase, the drain id, the nonce and the answer. The
asker verifies it under either mirrored key and treats anything else as
not acknowledged (unsigned, bad MAC, wrong nonce, 404, HTML). No
compatibility path: both sides are this build. Bounds and retries are
unchanged. Spec §24 E12 and E15 and §25.4 step 1 say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 45992c2ef0a90c8a276856ae674af8d760a9fc71 parent 802f926
3 files changed, +190 −15
  • docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md +3 −3
  • internal/edge/hadrain.go +77 −7
  • internal/edge/hadrain_test.go +110 −5
diff --git a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md
index 33dadd148..07c999e04 100644
--- a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md
+++ b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md
@@ -1003,10 +1003,10 @@ the same rule for every box.
| Scripts | Group roll and boot witness | Aware operator tools: inspect members by reference and check that a completed witness left no member files. The roll tool's §25.9 floor check (E14) reads `ha_handover` on every edges file in the deployment's listing, fixed forwarders included, whatever the file's age, and refuses a drain unless each says the number 1, and unless every box in the config's `fixed_boxes` has a file. There is no age test: a box that is not HA publishes only on change, hours apart, so an age test skipped quiet live boxes. The file is only a hint. A present file without the capability keeps the region on DR-4, naming the box; a present file with it, of any age, still has to acknowledge the withdrawal (E15), or the drain fails. The superseded script still has the old rule (`ha_take`, files under 15 minutes old) and is not used. |
| E10 | Silence rule (`Edge.PeerDraining`, read by the activator's `NoteForward`; §25.5) | Blind: a box whose file says `draining` or `ha_drained` is not made silent or suspect for a held answer. Dial failures still make any box suspect. A terminated member that was draining keeps that file until departure, so only its silence is ignored. |
| E11 | Holder-cache drop (`notePeerDrained`, §25.4 step 4) | Blind: a file that says `ha_drained` drops this box's holder-cache entries naming that box, once per publication (its `ha_drain` id, else its generation), before the drained acknowledgement. From then until a later publication of that box no longer says `ha_drained`, neither cache installs or follows the box as a holder: a lock read that was in flight across the drop, and a delayed holder answer naming it, are not used (build ruling, 2026-11-09). A stale drained file drops nothing new. A box that is only `draining` stays a holder. |
-| E12 | Drain acknowledgement receiver (`/.carlos/ha-drain`, `foldedDrain`, §25.4 step 1) | Blind: it reads the asker's own file by its exact key and answers whether its fold shows `draining` or `ha_drained` under the asked `ha_drain` transaction and id. A file that no longer matches, a stale one included, is answered as not seen. |
+| E12 | Drain acknowledgement receiver (`/.carlos/ha-drain`, `foldedDrain`, §25.4 step 1) | Blind: it reads the asker's own file by its exact key and answers whether its fold shows `draining` or `ha_drained` under the asked `ha_drain` transaction and id. A file that no longer matches, a stale one included, is answered as not seen. Each ask carries a fresh random nonce, covered by the ask's signature. The answer is signed under the mesh key over a separate domain, the answering box, the asking box, the transaction, the phase, the drain id, the nonce and the answer itself. |
| E13 | Take capability (`takeCapable`, `Edge.PeerTakes`; §25.7) | Blind: a box is asked to take only when its file says `ha_take` as the number 1. Absent, other numbers, strings and booleans mean no. A stale member file can still name a successor; the take then fails its dial, and the drain tries the next candidate or fails. `ha_handover` is not a take capability: a box that is not HA says `ha_handover: 1` and no `ha_take`, and is never asked to take. |
| E14 | Held-requests floor (`ha_handover`, read by the group roll verb's `Engine.Floor`, `internal/grouproll/floor.go`; §25.9) | Blind: every edges file in the deployment's listing counts, member or fixed box, whatever its age. Each must say `ha_handover` as the number 1. Absent, other numbers, `1.0`, strings and booleans are a DR-4 reason naming the box; an unreadable file refuses the transaction. A box in the config's `fixed_boxes` with no file is a DR-4 reason naming it; `fixed_boxes` missing or empty refuses the transaction. The floor cannot tell a live box from a dead one. A terminated box's leftover file without the capability keeps the region on DR-4; one with the capability passes the floor and then fails the drain at E15, naming the box. Either way it counts until departure removes a member's file or the operator removes a fixed box's (runbook, "A fixed box has been terminated"). |
-| E15 | Drain acknowledgement peers (`Edge.DrainAckPeers`, read by the drain driver's `publishAndAck`, `internal/host/hadrain.go`; §25.4 step 1) | Blind: every other box with an edges file in the asker's fold, named by its key, whatever the file's age, is asked and must acknowledge. The file is a hint and the live answer is the proof: only a binary with held requests answers `/.carlos/ha-drain`. A box rolled back to an older binary keeps the newer binary's capable file but cannot answer, and a dead box's leftover file cannot answer, so the drain fails before any move, naming each box. A fold not read in full gives no peer list; it is retried within the 2 minute bound, then the drain fails. |
+| E15 | Drain acknowledgement peers (`Edge.DrainAckPeers`, read by the drain driver's `publishAndAck`, `internal/host/hadrain.go`; §25.4 step 1) | Blind: every other box with an edges file in the asker's fold, named by its key, whatever the file's age, is asked and must acknowledge. The file is a hint and the live answer is the proof: only a binary with held requests can sign an answer for the ask (E12). Anything else is not an acknowledgement: an unsigned body, a bad signature, an answer to another ask (its nonce differs), a 404, or a tenant app's page behind an older binary. A box rolled back to an older binary keeps the newer binary's capable file but cannot answer, and a dead box's leftover file cannot answer, so the drain fails before any move, naming each box. A fold not read in full gives no peer list; it is retried within the 2 minute bound, then the drain fails. |
The drain state reuses the existing box-level `draining` field, so the
placement readers already listed (E5, C1, C6, C10, H5, and db-read
@@ -1100,7 +1100,7 @@ The roll tool runs a new root verb, `carlos system group-maintenance drain`, ove
1. **Withdraw, acknowledged.** A publishes a box-level drain state in its edges file, and from then on places nothing on itself. The field withdraws placement only. Name authority, admission and holder reachability are unchanged, so A keeps answering as a holder and a forwarder (R2.9). Placement reads it as local-denied (`internal/edge/wakeplacement.go:36-42`), and that includes §6.3 rule 1, so a clean marker naming A no longer sends a wake to A. The builder fixes the field with a reader table under §24's rule.
- A timer does not prove that peers folded the change (R2.9). So A sends a signed `/.carlos/ha-drain` hop to every box of the deployment with an edges file, whatever the file's age (E15), fixed forwarders and other regions included. Each receiver refreshes its fold of A's edges file at once, which is one normal fold read, and answers whether it now sees A draining. A asks again every 5 s. Each request names the drain transaction and the generation of A's edges file. A receiver that has already folded that generation answers from memory with no new read, so each receiver costs one fold read per round however often it is asked (R3.9). The drain goes on only once every such box has acknowledged. A box that cannot be reached, or does not acknowledge within 2 minutes, makes the drain fail (failures, below).
+ A timer does not prove that peers folded the change (R2.9). So A sends a signed `/.carlos/ha-drain` hop to every box of the deployment with an edges file, whatever the file's age (E15), fixed forwarders and other regions included. Each receiver refreshes its fold of A's edges file at once, which is one normal fold read, and answers whether it now sees A draining. Each ask carries a fresh random nonce, and the answer is signed under the mesh key over the two boxes, the transaction, the phase, the drain id, the nonce and the answer (E12). A counts only an answer signed for that ask. An older binary cannot sign one, and a tenant app it might pass the path to cannot either, so neither acknowledges. A asks again every 5 s. Each request names the drain transaction and the generation of A's edges file. A receiver that has already folded that generation answers from memory with no new read, so each receiver costs one fold read per round however often it is asked (R3.9). The drain goes on only once every such box has acknowledged. A box that cannot be reached, or does not acknowledge within 2 minutes, makes the drain fail (failures, below).
2. **Quiesce (H5).** A closes its local start gate for tenant leases. It then settles everything that crossed the gate before it closed: wakes that are restoring, acquires waiting on their conditional PUT, and lost-lease recovery workers. Each either ends awake, and is then moved in step 3, or fails. Pending stops and marker obligations are kept and settled (§5.2). Nothing is cancelled in a way that would drop a writer proof.
3. **Move each awake host H,** up to 4 at a time, busiest first:
1. *Hold.* From now `MoveState(H)` is `holding` (§25.5).
diff --git a/internal/edge/hadrain.go b/internal/edge/hadrain.go
index 8bcf2269b..68f855b46 100644
--- a/internal/edge/hadrain.go
+++ b/internal/edge/hadrain.go
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"crypto/hmac"
+ "crypto/rand"
"crypto/sha256"
"encoding/hex"
"encoding/json"
@@ -46,6 +47,11 @@ import (
// carries its own mesh-key signature over the receiver, the method, the
// path, the drain transaction, the timestamp and the body. The ordinary hop
// signature binds only host and time (mesh.go), so it is not enough here.
+// A drain ask also carries a fresh nonce, and the answer is signed under
+// the mesh key over the receiver, the asker, the transaction, the phase,
+// the id, that nonce and the answer (haDrainAnswerMAC). The asker counts
+// nothing else as an acknowledgement: an older binary, or a tenant app
+// behind one, cannot sign, and an answer to another ask fails its nonce.
//
// This reader is member-blind (§24.3): it reads the asker's own file, by
// its exact key, whatever its name shape, region or pool. A terminated
@@ -78,18 +84,25 @@ const (
// hopDoorDomain makes.
const haControlDomain = "carlos-ha-control\x00"
+// haDrainAnswerDomain separates the drain answer's MAC from the ask's and
+// every other mesh-key MAC.
+const haDrainAnswerDomain = "carlos-ha-drain-answer\x00"
+
// The phases an ask names.
const (
DrainPhaseDraining = "draining"
DrainPhaseDrained = "drained"
)
-// haDrainAsk is the ask's JSON body.
+// haDrainAsk is the ask's JSON body. Nonce is 16 fresh random bytes in
+// lower-case hex, chosen by the asker for this ask alone: the answer's MAC
+// covers it, so an answer to another ask cannot be replayed.
type haDrainAsk struct {
From string `json:"from"`
Txn string `json:"txn"`
Phase string `json:"phase"`
ID uint64 `json:"id"`
+ Nonce string `json:"nonce"`
}
// haDrainMarkView is a file's ha_drain object.
@@ -98,9 +111,54 @@ type haDrainMarkView struct {
ID uint64 `json:"id"`
}
-// haDrainAnswer is the receiver's answer.
+// haDrainAnswer is the receiver's answer: seen, and Sig, the hex MAC
+// (haDrainAnswerMAC) under the mesh key. Only a receiver that holds the
+// mesh key and runs this build can sign it, so an older binary, or a
+// tenant app behind one, cannot acknowledge (held floor capability
+// ruling, 2026-11-10). Seen is a pointer so an answer without it is
+// refused, never read as false or true.
type haDrainAnswer struct {
- Seen bool `json:"seen"`
+ Seen *bool `json:"seen"`
+ Sig string `json:"sig"`
+}
+
+// haDrainNonce is a valid ask nonce: 32 lower-case hex digits.
+func haDrainNonce(s string) bool {
+ if len(s) != 32 {
+ return false
+ }
+ for i := 0; i < len(s); i++ {
+ if c := s[i]; (c < '0' || c > '9') && (c < 'a' || c > 'f') {
+ return false
+ }
+ }
+ return true
+}
+
+// haDrainAnswerMAC is the answer's HMAC over the domain, the receiver
+// (answering) box, the asking box, the transaction, the phase, the
+// publication id, the ask's nonce and the answer.
+func haDrainAnswerMAC(key []byte, receiver string, ask haDrainAsk, seen bool) []byte {
+ mac := hmac.New(sha256.New, key)
+ for _, part := range []string{haDrainAnswerDomain, receiver, ask.From, ask.Txn, ask.Phase,
+ strconv.FormatUint(ask.ID, 10), ask.Nonce, strconv.FormatBool(seen)} {
+ mac.Write([]byte(part))
+ mac.Write([]byte("\n"))
+ }
+ return mac.Sum(nil)
+}
+
+// verifyHADrainAnswer checks an answer's MAC under either mirrored key, in
+// constant time.
+func verifyHADrainAnswer(current, next []byte, receiver string, ask haDrainAsk, seen bool, sig string) bool {
+ got, err := hex.DecodeString(sig)
+ if err != nil || len(got) != sha256.Size {
+ return false
+ }
+ if len(next) > 0 && hmac.Equal(got, haDrainAnswerMAC(next, receiver, ask, seen)) {
+ return true
+ }
+ return len(current) > 0 && hmac.Equal(got, haDrainAnswerMAC(current, receiver, ask, seen))
}
// haControlPath reports whether p, cleaned, is one of the reserved control
@@ -231,16 +289,17 @@ func (e *Edge) serveHAControl(w http.ResponseWriter, r *http.Request) {
}
var ask haDrainAsk
if json.Unmarshal(body, &ask) != nil || ask.Txn != txn || !haControlField(ask.From) || ask.From == e.box || ask.ID == 0 ||
- (ask.Phase != DrainPhaseDraining && ask.Phase != DrainPhaseDrained) {
+ (ask.Phase != DrainPhaseDraining && ask.Phase != DrainPhaseDrained) || !haDrainNonce(ask.Nonce) {
refuseHAControl(w)
return
}
ctx, cancel := context.WithTimeout(r.Context(), haDrainRefreshTimeout)
defer cancel()
seen := m.drainSeen(ctx, ask)
+ sig := hex.EncodeToString(haDrainAnswerMAC(signingKey(current, next), e.box, ask, seen))
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Cache-Control", "no-store")
- json.NewEncoder(w).Encode(haDrainAnswer{Seen: seen})
+ json.NewEncoder(w).Encode(haDrainAnswer{Seen: &seen, Sig: sig})
}
// drainAcks is the receiver's memory of answered asks (R3.9). mu also
@@ -469,7 +528,12 @@ func (e *Edge) AskDrainSeen(ctx context.Context, peer, txn, phase string, id uin
if err != nil {
return false, err
}
- body, err := json.Marshal(haDrainAsk{From: e.box, Txn: txn, Phase: phase, ID: id})
+ var nonce [16]byte
+ if _, err := rand.Read(nonce[:]); err != nil {
+ return false, fmt.Errorf("ha-drain: nonce: %w", err)
+ }
+ ask := haDrainAsk{From: e.box, Txn: txn, Phase: phase, ID: id, Nonce: hex.EncodeToString(nonce[:])}
+ body, err := json.Marshal(ask)
if err != nil {
return false, err
}
@@ -499,7 +563,13 @@ func (e *Edge) AskDrainSeen(ctx context.Context, peer, txn, phase string, id uin
if err := json.NewDecoder(io.LimitReader(resp.Body, 4<<10)).Decode(&ans); err != nil {
return false, fmt.Errorf("ha-drain: %s's answer: %w", peer, err)
}
- return ans.Seen, nil
+ // An answer is an acknowledgement only when signed for this ask: an
+ // unsigned body, a bad MAC or another ask's answer fails closed.
+ current, next = m.meshKeys()
+ if ans.Seen == nil || !verifyHADrainAnswer(current, next, peer, ask, *ans.Seen, ans.Sig) {
+ return false, fmt.Errorf("ha-drain: %s's answer is not signed for this ask", peer)
+ }
+ return *ans.Seen, nil
}
// controlTarget is where a control request to peer goes: its dial address,
diff --git a/internal/edge/hadrain_test.go b/internal/edge/hadrain_test.go
index 204a3efce..de77f083f 100644
--- a/internal/edge/hadrain_test.go
+++ b/internal/edge/hadrain_test.go
@@ -3,6 +3,9 @@ package edge
import (
"bytes"
"context"
+ "crypto/hmac"
+ "crypto/sha256"
+ "encoding/hex"
"encoding/json"
"errors"
"io"
@@ -82,8 +85,15 @@ type drainBox struct {
// old makes the box run a binary from before held requests: nothing
// answers the control paths (404), whatever its stored file says.
old atomic.Bool
- mu sync.Mutex
- app []string
+ // tenant is what an old binary's tenant app answers on the control
+ // path (200, this body) instead of a 404, when set.
+ tenant string
+ // replay makes the box answer every control request with the first
+ // answer its edge gave.
+ replay bool
+ replayed []byte
+ mu sync.Mutex
+ app []string
}
func (x *drainBox) edge() *Edge { return x.be.live.Load().edge }
@@ -142,9 +152,30 @@ func (s *drainScene) addWith(t *testing.T, box, ip, host, region string, act Act
srv := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
x.door.Add(1)
if x.old.Load() && haControlPath(r.URL.Path) {
+ if x.tenant != "" {
+ w.Header().Set("Content-Type", "application/json")
+ io.WriteString(w, x.tenant)
+ return
+ }
http.NotFound(w, r)
return
}
+ if x.replay && haControlPath(r.URL.Path) {
+ x.mu.Lock()
+ saved := x.replayed
+ x.mu.Unlock()
+ if saved == nil {
+ rec := httptest.NewRecorder()
+ be.live.Load().edge.ServeHTTP(rec, r)
+ saved = rec.Body.Bytes()
+ x.mu.Lock()
+ x.replayed = saved
+ x.mu.Unlock()
+ }
+ w.Header().Set("Content-Type", "application/json")
+ w.Write(saved)
+ return
+ }
be.live.Load().edge.ServeHTTP(w, r)
}))
srv.Listener.Close()
@@ -573,7 +604,7 @@ func TestHADrainRefusesForgery(t *testing.T) {
s.file(t, b, drainGen0, notDrain)
s.sync(t)
now := time.Now()
- body := []byte(`{"from":"annie","txn":"txn-1","phase":"draining","id":101}`)
+ body := []byte(`{"from":"annie","txn":"txn-1","phase":"draining","id":101,"nonce":"00112233445566778899aabbccddeeff"}`)
good := func() (string, string, []byte) {
return signHAControl(s.key, "betty", http.MethodPost, HADrainPath, "txn-1", now, body), "txn-1", body
}
@@ -595,10 +626,14 @@ func TestHADrainRefusesForgery(t *testing.T) {
}
other := []byte("0123456789abcdef0123456789abcdef")
big := bytes.Repeat([]byte("x"), haControlMaxBody+1)
- for name, tc := range map[string]struct {
+ type req = struct {
method, auth, txn string
body []byte
- }{
+ }
+ signed := func(b []byte) req {
+ return req{http.MethodPost, signHAControl(s.key, "betty", http.MethodPost, HADrainPath, "txn-1", now, b), "txn-1", b}
+ }
+ for name, tc := range map[string]req{
"no auth": {http.MethodPost, "", txn, body},
"no txn": {http.MethodPost, auth, "", body},
"other txn": {http.MethodPost, auth, "txn-2", body},
@@ -610,6 +645,9 @@ func TestHADrainRefusesForgery(t *testing.T) {
"tampered body": {http.MethodPost, auth, txn, bytes.Replace(body, []byte("annie"), []byte("betty"), 1)},
"hop signature": {http.MethodPost, signHop(s.key, "blog.example.com", now), txn, body},
"oversized": {http.MethodPost, signHAControl(s.key, "betty", http.MethodPost, HADrainPath, "txn-1", now, big), txn, big},
+ "no nonce": signed(bytes.Replace(body, []byte(`,"nonce":"00112233445566778899aabbccddeeff"`), nil, 1)),
+ "short nonce": signed(bytes.Replace(body, []byte(`"00112233445566778899aabbccddeeff"`), []byte(`"0011"`), 1)),
+ "upper nonce": signed(bytes.Replace(body, []byte(`"00112233445566778899aabbccddeeff"`), []byte(`"00112233445566778899AABBCCDDEEFF"`), 1)),
} {
if w := post(tc.method, tc.auth, tc.txn, tc.body); w.Code != http.StatusNotFound || w.Body.Len() != 0 {
t.Errorf("%s: answered %d %q, want a bare 404", name, w.Code, w.Body.String())
@@ -797,3 +835,70 @@ func TestHADrainAckEveryFiledBox(t *testing.T) {
t.Fatalf("the dead box: seen=%v err=%v, want a failed ask naming it", seen, err)
}
}
+
+// The answer's wire shape, pinned: {"seen":<bool>,"sig":"<hex HMAC>"} with
+// the HMAC-SHA256 under the mesh key over the answer domain, the receiver,
+// the asker, the transaction, the phase, the id, the nonce and the answer,
+// each followed by a newline.
+func TestHADrainAnswerWireShape(t *testing.T) {
+ s := newDrainScene(t)
+ a := s.add(t, "annie", "127.0.0.11", "shop.example.com", "eu-west-1")
+ b := s.add(t, "betty", "127.0.0.12", "blog.example.com", "eu-west-1")
+ s.file(t, a, drainGen0, draining1)
+ s.file(t, b, drainGen0, notDrain)
+ s.sync(t)
+ nonce := "00112233445566778899aabbccddeeff"
+ body := []byte(`{"from":"annie","txn":"txn-1","phase":"draining","id":101,"nonce":"` + nonce + `"}`)
+ r := httptest.NewRequest(http.MethodPost, "http://blog.example.com"+HADrainPath, bytes.NewReader(body))
+ r.Header.Set(haControlAuthHeader, signHAControl(s.key, "betty", http.MethodPost, HADrainPath, "txn-1", time.Now(), body))
+ r.Header.Set(haControlTxnHeader, "txn-1")
+ w := httptest.NewRecorder()
+ b.edge().ServeHTTP(w, r)
+ mac := hmac.New(sha256.New, s.key)
+ io.WriteString(mac, "carlos-ha-drain-answer\x00\nbetty\nannie\ntxn-1\ndraining\n101\n"+nonce+"\ntrue\n")
+ want := `{"seen":true,"sig":"` + hex.EncodeToString(mac.Sum(nil)) + `"}` + "\n"
+ if w.Code != http.StatusOK || w.Body.String() != want {
+ t.Fatalf("answer %d %q, want %q", w.Code, w.Body.String(), want)
+ }
+}
+
+// The asker takes only an answer signed for its own ask (held floor
+// capability ruling, 2026-11-10). A tenant app behind an old binary that
+// answers {"seen":true}, an unsigned or wrongly signed body, and another
+// ask's answer replayed (its nonce differs) are each not acknowledged. A
+// correct signed answer is.
+func TestHADrainAnswerMustBeSignedForTheAsk(t *testing.T) {
+ s := newDrainScene(t)
+ a := s.add(t, "annie", "127.0.0.11", "shop.example.com", "eu-west-1")
+ s.add(t, "betty", "127.0.0.12", "blog.example.com", "eu-west-1")
+ old := s.add(t, "olden", "127.0.0.13", "news.example.com", "eu-west-1")
+ rep := s.add(t, "rerun", "127.0.0.14", "shop2.example.com", "eu-west-1")
+ for _, x := range s.boxes {
+ s.file(t, x, drainGen0, notDrain)
+ }
+ s.sync(t)
+ s.file(t, a, drainGen0.Add(time.Minute), draining1)
+ if seen, err := askDrain1(a, "betty"); err != nil || !seen {
+ t.Fatalf("a signed answer: seen=%v err=%v", seen, err)
+ }
+ old.old.Store(true)
+ for _, body := range []string{
+ `{"seen":true}`,
+ `{"seen":true,"sig":""}`,
+ `{"seen":true,"sig":"` + strings.Repeat("00", 32) + `"}`,
+ `{"sig":"` + strings.Repeat("00", 32) + `"}`,
+ `<!doctype html><html>an app</html>`,
+ } {
+ old.tenant = body
+ if seen, err := askDrain1(a, "olden"); err == nil || seen {
+ t.Fatalf("tenant answer %s: seen=%v err=%v, want refused", body, seen, err)
+ }
+ }
+ rep.replay = true
+ if seen, err := askDrain1(a, "rerun"); err != nil || !seen {
+ t.Fatalf("the first, recorded answer: seen=%v err=%v", seen, err)
+ }
+ if seen, err := askDrain1(a, "rerun"); err == nil || seen || !strings.Contains(err.Error(), "not signed for this ask") {
+ t.Fatalf("a replayed answer: seen=%v err=%v, want refused", seen, err)
+ }
+}