carlos / platform Public

host: a fenced group member withdraws placement until fence-clear

Branch review r1, Fable B1.1 (P1). A roll's apply restarts the agent
behind the start fence. The restarted agent had no drain state, so it
published itself placeable: peers placed cold wakes on it (and §6.3
rule 1 sent wakes for markers naming it), and each got the fenced
start's 503 until fence-clear at the end of the return phase.

Ruling: a fenced agent publishes the drain (placement-withdrawal) state
from its start until the fence is cleared. haDrainState now follows the
start fence on group members: read at wiring, before the first
publication, and on every edges loop tick (a local file read, no store
call). draining is published, with no ha_drain mark, while fenced; the
activator's IsDraining answers true, so the box places nothing on
itself; a fence change is a reason to write. The cancel ordering
(drain state cleared before the fence) no longer opens a window.

Tests: a restarted agent behind a real fence publishes draining from
its first publication and stops after fence-clear. Sim: a fenced A is
withdrawn in its publications and self-placement; a fence lift
publishes; WD now also fails a placement on A while its fence is
present outside a drain, with mutation fence-not-withdrawn and its
witness. Spec: §24 E5 row, §25.15 R3.1 and the §25.10 mutation list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b671eb8523c73016b5730f716373d427d81307c8 parent 389be36
7 files changed, +196 −24
  • docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md +3 −3
  • internal/host/agent.go +7 −0
  • internal/host/edgesfile.go +3 −0
  • internal/host/hadrainfence_linux_test.go +77 −0
  • internal/host/hadrainstate.go +49 −8
  • internal/sim/regionha/handover_test.go +28 −5
  • internal/sim/regionha/handover_witness_test.go +29 −8
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 e713f4b9b..7fbe2b532 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
@@ -971,7 +971,7 @@ the same rule for every box.
| E2 | Name fold, routing and backhaul | Blind: member hosts are real routes. A dead holder fails its dial; retries and the holder cache select alternatives until departure removes the file. |
| E3 | Wildcard parents, served names and certificate warming | Blind: derive names from the published hosts. Names may linger until retirement. |
| E4 | View and holder checks (`holderview.go`) | Blind: members are serving peers (§4.3); generation freshness bounds stale evidence. |
-| E5 | Cold-wake and duty placement (`wakeplacement.go`) | Aware through pool evidence and fresh headroom. Only a box serving the route's pool may wake it. |
+| E5 | Cold-wake and duty placement (`wakeplacement.go`) | Aware through pool evidence and fresh headroom. Only a box serving the route's pool may wake it. A box whose file says `draining` or `ha_drained` is local-denied, §6.3 rule 1 included. A group member publishes `draining` while its start fence is present, from its agent's first publication until `fence-clear` (§25.15 R3.1), so a roll's restarted agent is never chosen for a wake it would refuse. |
| E6 | Probe-burst notices | Blind: notify published non-wildcard hosts. Failed dials have a bounded queue. |
| E7 | Certificate settle peer check | Blind: a member is a peer. |
| E8 | Group reader inventory and names-2 latch | Aware through name shape only in the restrictive direction: a false positive raises the release floor. A stale file counts until retired. |
@@ -1236,7 +1236,7 @@ Each of these mutations must fail the sweep:
- a handover answer followed on a second attempt (H3);
- desired lowered by any call but A's Standby (H4);
- a provider action on a stale incarnation's report, or before quiescence (H5);
-- placement on A before every acknowledgement.
+- placement on A before every acknowledgement, or while A's start fence is present outside a drain (§25.15 R3.1).
**Integration tests** run in-process against MinIO, with two real activators and edges. They cover:
- the front-door position of `MoveState` for every route kind, gated routes included, with once-only accounting;
@@ -1318,7 +1318,7 @@ If Paul takes the four recommendations, they become §25 r4 as refusals and barr
Paul approved all four §25.14 recommendations and Q1 to Q3 as recommended: drain first, the narrowed guarantee with W5 measured, and the drain time. There is no fourth spec round. The branch review of the build checks these. Where §25.3 to §25.7 say otherwise, this section wins.
**H5 amended: a retained start fence (R3.1).** Quiescence is a state the transaction holds, not a report it reads.
-- `drain` installs a root-owned **start fence** bound to the transaction id, at `/var/lib/carlos-group-fence/fence.json`: the directory root's and 0755, the file root's and 0644, created by the group-maintenance verbs. It is not under the maintenance directory, `/run/carlos-group-maintenance`, because that directory is root's alone (0700) and the agent, which runs as `carlos`, could not read a fence there. It is on persistent storage, not `/run`, so a member that reboots during a transaction comes back fenced (build ruling, 2026-11-09). The agent's tenant start gate refuses every start while a fence is present. The agent reads the fence at start and at every start decision, so a restarted agent is fenced too. A fence that cannot be read, is not root's or does not parse fences all the same. Only the tool removes the fence, with `drain --cancel` or `fence-clear` of the same transaction: at ExitStandby for roll, at cancel, or when the member is gone.
+- `drain` installs a root-owned **start fence** bound to the transaction id, at `/var/lib/carlos-group-fence/fence.json`: the directory root's and 0755, the file root's and 0644, created by the group-maintenance verbs. It is not under the maintenance directory, `/run/carlos-group-maintenance`, because that directory is root's alone (0700) and the agent, which runs as `carlos`, could not read a fence there. It is on persistent storage, not `/run`, so a member that reboots during a transaction comes back fenced (build ruling, 2026-11-09). The agent's tenant start gate refuses every start while a fence is present. The agent reads the fence at start and at every start decision, so a restarted agent is fenced too. A fence that cannot be read, is not root's or does not parse fences all the same. While a fence is present the agent also withdraws placement: it publishes the drain state (`draining`, with no `ha_drain` mark) from its first publication and places nothing on itself, until the fence is removed and its next edges tick (2 s) publishes it placeable again. So no peer places a cold wake on a fenced member, a roll's restarted agent included, and none gets the fenced start's 503 (branch review ruling, 2026-11-09). Only the tool removes the fence, with `drain --cancel` or `fence-clear` of the same transaction: at ExitStandby for roll, at cancel, or when the member is gone.
- **replace and remove** stop `carlos-edge.service` under the fence after the drain report, prove the edge process gone, and only then make the provider call. A peer request chosen against an old snapshot then meets a closed port, not a box that might acquire.
- **roll**'s `apply` restarts the edge behind the fence, so the restarted agent can acquire nothing until the tool's return step.
- The pre-action check reads the fence, the report and the stopped edge. A fence of another transaction refuses.
diff --git a/internal/host/agent.go b/internal/host/agent.go
index b217ee06f..fb973e7eb 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -272,6 +272,13 @@ func runAgent(args []string, buildClaims ClaimFactory) {
if err = configureGroupAdmission(agentCtx, admission, groupBoot); err != nil {
log.Fatal(err)
}
+ // A group member's placement withdrawal follows its start fence from
+ // the first publication (region HA §25.15 R3.1): an agent restarted
+ // behind a fence publishes draining until fence-clear, so no peer
+ // places a wake it would refuse.
+ if admission != nil && admission.group {
+ boxDrain.setFenceSource(func() bool { return startFenced() })
+ }
admissionOption := wireAgentAdmission(admission, nil, nil, nil)
if admission != nil {
armedFixedAdmission.Store(admission)
diff --git a/internal/host/edgesfile.go b/internal/host/edgesfile.go
index 5a9493027..63c584807 100644
--- a/internal/host/edgesfile.go
+++ b/internal/host/edgesfile.go
@@ -1324,6 +1324,9 @@ func edgesFileLoop(reg *registry.Registry, lifetimes bool, assets *assetPolicy)
roleIdent := snapshotBoxRole(ident)
// A wanted drain state not yet published is a pass on this tick
// (region HA §25.4), with the schedule's retry backoff.
+ // The start fence is re-read first: a fenced member publishes
+ // draining (hadrainstate.go), and a fence change is a reason to write.
+ boxDrain.refreshFence()
drainDue := boxDrain.needsPublish()
if !state.dueWithRole(now, key, err == nil, pub.rewriteDue() || drainDue, roleIdent) {
continue
diff --git a/internal/host/hadrainfence_linux_test.go b/internal/host/hadrainfence_linux_test.go
index 7790f91a3..216467e4c 100644
--- a/internal/host/hadrainfence_linux_test.go
+++ b/internal/host/hadrainfence_linux_test.go
@@ -15,6 +15,7 @@ import (
"time"
"github.com/carlosframework/platform/internal/groupadmission"
+ "github.com/carlosframework/platform/internal/release"
)
// testFence is a fence fixture owned by this test's user.
@@ -474,3 +475,79 @@ func setDrainPeer(t *testing.T, f func(uint32) bool) {
drainPeerSeam.Store(&f)
t.Cleanup(func() { drainPeerSeam.Store(nil) })
}
+
+// Branch review r1, Fable B1.1: a roll restarts the agent behind the
+// fence. The restarted agent has no driver drain state, but from its first
+// publication its edges file says draining (which every peer's placement
+// reads as withdrawn, wakeplacement.go) and its own placement is denied,
+// until fence-clear; then the next tick publishes it placeable again. No
+// ha_drain mark is published: the fence is not a drain transaction's
+// acknowledgement.
+func TestFencedRestartedAgentIsWithdrawnUntilFenceClear(t *testing.T) {
+ ctx := context.Background()
+ l := testFence(t)
+ must(t, l.install("t1", time.Unix(100, 0)))
+ st := release.NewDirStore(t.TempDir())
+ reg := edgesTestRegistry(t)
+ seedRoute(t, reg, "shop.example.com")
+
+ restarted := newHADrainState() // a new process: no driver state
+ restarted.setFenceSource(l.fenced)
+ if !restarted.IsDraining() {
+ t.Fatal("a fenced agent places on itself")
+ }
+ var last []byte
+ pass := func() map[string]json.RawMessage {
+ t.Helper()
+ restarted.refreshFence() // the edges loop's tick
+ ident := edgesFile{Box: "box", DrainSource: restarted, DrainPublishRequired: restarted.needsPublish()}
+ ident.Draining, ident.HADrained, ident.HADrain = restarted.want()
+ must(t, edgesFilePass(ctx, st, reg, ident, "203.0.113.1", &last))
+ body, _, err := st.Get(ctx, edgesFileKey("box"))
+ must(t, err)
+ var f map[string]json.RawMessage
+ must(t, json.Unmarshal(body, &f))
+ return f
+ }
+ f := pass()
+ if string(f["draining"]) != "true" {
+ t.Fatalf("the restarted fenced agent's first publication: draining %s, want true", f["draining"])
+ }
+ if _, ok := f["ha_drain"]; ok {
+ t.Fatalf("a fence alone published a drain mark: %s", f["ha_drain"])
+ }
+ if _, ok := f["ha_drained"]; ok {
+ t.Fatal("a fence alone published ha_drained")
+ }
+ if restarted.needsPublish() {
+ t.Fatal("published, still due")
+ }
+ // Still fenced: still withdrawn on the next ticks.
+ if f = pass(); string(f["draining"]) != "true" || !restarted.IsDraining() {
+ t.Fatalf("second tick: draining %s", f["draining"])
+ }
+
+ must(t, l.remove("t1")) // fence-clear
+ restarted.refreshFence()
+ if restarted.IsDraining() {
+ t.Fatal("withdrawn after fence-clear")
+ }
+ if !restarted.needsPublish() {
+ t.Fatal("a fence change did not make the tick a pass")
+ }
+ if f = pass(); len(f["draining"]) != 0 {
+ t.Fatalf("after fence-clear the file still says draining %s", f["draining"])
+ }
+
+ // A fence read that fails reads as fenced (fenceLocation.read fails
+ // closed), so it withdraws too.
+ broken := newHADrainState()
+ broken.setFenceSource(func() bool { return true })
+ if d, _, m := broken.want(); !d || m != nil {
+ t.Fatalf("fenced want %v %+v", d, m)
+ }
+ // A box with no fence source (a fixed box) is unchanged.
+ if newHADrainState().IsDraining() {
+ t.Fatal("a box without a fence drains")
+ }
+}
diff --git a/internal/host/hadrainstate.go b/internal/host/hadrainstate.go
index 82a9d26e5..bad0373bf 100644
--- a/internal/host/hadrainstate.go
+++ b/internal/host/hadrainstate.go
@@ -22,12 +22,25 @@ import (
// ha_drained beside it, and implies draining. Neither is admission's
// drained (box_role/admitted/drained), so name authority, admission and
// holder reachability are unchanged.
+//
+// A group member also withdraws placement while its start fence is present
+// (region HA §25.15 R3.1; branch review r1, Fable B1.1): a fenced box
+// refuses every tenant start, so a peer must not place a wake on it. The
+// fence outlives the agent (a roll restarts the agent behind it), so the
+// state follows the fence, not only the driver: fenced reads as draining
+// from the agent's first publication until fence-clear. The fence is read
+// at wiring and on every edges loop tick (a local file, no store call);
+// in between the last reading is used.
type haDrainState struct {
mu sync.Mutex
draining, drained bool
- mark *haDrainMark
- lastID uint64
- pub haDrainPublished
+ // fence reads the start fence; nil on boxes that have none (fixed
+ // boxes). fenced is its last reading.
+ fence func() bool
+ fenced bool
+ mark *haDrainMark
+ lastID uint64
+ pub haDrainPublished
// changed is closed and replaced at every reported publication.
changed chan struct{}
}
@@ -65,6 +78,32 @@ func newHADrainState() *haDrainState {
// (agent.go wires it); the edges loop publishes it.
var boxDrain = newHADrainState()
+// setFenceSource makes the state follow fence (group members), read now.
+func (s *haDrainState) setFenceSource(fence func() bool) {
+ s.mu.Lock()
+ s.fence = fence
+ s.mu.Unlock()
+ s.refreshFence()
+}
+
+// refreshFence re-reads the fence, outside the lock (a file read).
+func (s *haDrainState) refreshFence() {
+ s.mu.Lock()
+ fence := s.fence
+ s.mu.Unlock()
+ if fence == nil {
+ return
+ }
+ fenced := fence()
+ s.mu.Lock()
+ s.fenced = fenced
+ s.mu.Unlock()
+}
+
+// withdrawnLocked is the published draining field: the driver's drain
+// state, or a present fence.
+func (s *haDrainState) withdrawnLocked() bool { return s.draining || s.fenced }
+
// nextIDLocked is a fresh publication identity.
func (s *haDrainState) nextIDLocked() uint64 {
id := uint64(time.Now().UnixNano())
@@ -109,18 +148,19 @@ func (s *haDrainState) setDrained() error {
}
// IsDraining is whether this box is in the drain state now, published or
-// not: it places nothing on itself from the moment the state is set.
+// not, or fenced: it places nothing on itself from the moment the state is
+// set.
func (s *haDrainState) IsDraining() bool {
s.mu.Lock()
defer s.mu.Unlock()
- return s.draining
+ return s.withdrawnLocked()
}
// want is the state the edges file should carry.
func (s *haDrainState) want() (draining, drained bool, mark *haDrainMark) {
s.mu.Lock()
defer s.mu.Unlock()
- return s.draining, s.drained, s.mark
+ return s.withdrawnLocked(), s.drained, s.mark
}
func sameMark(a, b *haDrainMark) bool {
@@ -134,7 +174,8 @@ func sameMark(a, b *haDrainMark) bool {
func (s *haDrainState) needsPublish() bool {
s.mu.Lock()
defer s.mu.Unlock()
- return s.draining != s.pub.Draining || s.drained != s.pub.Drained || !sameMark(s.mark, s.pub.Mark) || (s.draining && s.pub.Generation == "")
+ w := s.withdrawnLocked()
+ return w != s.pub.Draining || s.drained != s.pub.Drained || !sameMark(s.mark, s.pub.Mark) || (w && s.pub.Generation == "")
}
// EdgesDrainPublished is the edges loop's report of a written file.
@@ -164,7 +205,7 @@ func (s *haDrainState) published() haDrainPublished {
func (s *haDrainState) waitPublished(ctx context.Context) (haDrainMark, error) {
for {
s.mu.Lock()
- if s.mark != nil && s.draining == s.pub.Draining && s.drained == s.pub.Drained && sameMark(s.mark, s.pub.Mark) && s.pub.Generation != "" {
+ if s.mark != nil && s.withdrawnLocked() == s.pub.Draining && s.drained == s.pub.Drained && sameMark(s.mark, s.pub.Mark) && s.pub.Generation != "" {
m := *s.mark
s.mu.Unlock()
return m, nil
diff --git a/internal/sim/regionha/handover_test.go b/internal/sim/regionha/handover_test.go
index f85bbc054..d9b043dd7 100644
--- a/internal/sim/regionha/handover_test.go
+++ b/internal/sim/regionha/handover_test.go
@@ -62,7 +62,9 @@ import (
// - FA, F-A in every phase: no request is held for a host whose lease A
// lost.
// - WD, acknowledged withdrawal (§25.4 step 1): no box places a wake on A
-// after A closed its start gate for the drain.
+// after A closed its start gate for the drain, nor while A's start
+// fence is present outside a drain (a roll's restarted agent; branch
+// review r1, Fable B1.1).
const (
hoClientBound = 30 // s, a client request's hold (wakeWaitBound)
@@ -95,6 +97,7 @@ func init() {
"place-before-acks", // the drain goes on before every acknowledgement (§25.4 step 1, WD)
"fence-lift-on-unknown", // the tool lifts the fence on an unknown edge state (R3.1, I11)
"move-ignores-tickets", // the move waits on requests in the app, not on outstanding tickets (R3.2, H1)
+ "fence-not-withdrawn", // a fenced agent outside a drain publishes itself placeable (R3.1, WD)
)
}
@@ -358,11 +361,25 @@ func (ho *hoWorld) denied(nd *hoNode, x *box) bool {
return false
}
if nd.b == ho.A {
- return ho.draining
+ return ho.draining || ho.fenceWithdraws()
}
return ho.pubs[nd.seen].Draining
}
+// fenceWithdraws is whether A's fence withdraws its placement: a fenced
+// agent publishes draining from its start until fence-clear (R3.1).
+func (ho *hoWorld) fenceWithdraws() bool {
+ return ho.fence != "" && on("fence-not-withdrawn")
+}
+
+// fenceLifted is a fence's removal while A's agent runs: the next edges
+// tick publishes A placeable again, unless a drain still withdraws it.
+func (ho *hoWorld) fenceLifted() {
+ if ho.live(ho.A) && ho.A.Agent != agentDown && !ho.draining {
+ ho.publish(hoPub{}, nil)
+ }
+}
+
// acks is one acknowledgement round's progress (§25.4 steps 1 and 4): A
// asks every live node that views the region every 5 s; a node answers
// once it has folded A's current publication. done once all have; failed
@@ -609,6 +626,9 @@ func (ho *hoWorld) placedOnA(fb *hoNode, h string) {
if ho.gate && ho.draining && ho.drainInc == ho.A.PID {
ho.fail("WD", "%s placed a wake of %s on A after A closed its start gate for the drain", fb.name, h)
}
+ if ho.fence != "" && !ho.draining {
+ ho.fail("WD", "%s placed a wake of %s on A while A's start fence is present", fb.name, h)
+ }
}
// send is one forward attempt by the first box fb to x.
@@ -1139,10 +1159,11 @@ func (ho *hoWorld) agentDown(reboot bool) {
}
// agentUp starts a new incarnation of A's agent: not draining, behind the
-// fence if one is present; it publishes a fresh edges file.
+// fence if one is present; it publishes a fresh edges file, withdrawn
+// while the fence is present.
func (ho *hoWorld) agentUp() {
ho.w.restart(ho.A, true)
- ho.publish(hoPub{}, nil)
+ ho.publish(hoPub{Draining: ho.fenceWithdraws()}, nil)
ho.logf("A's agent is pid %d (fence %q)", ho.A.PID, ho.fence)
}
@@ -1585,6 +1606,7 @@ func (ho *hoWorld) txnStep() {
case "fence-clear":
if el >= 1 {
ho.fence = ""
+ ho.fenceLifted()
ho.minimum = ho.n
ho.react()
ho.next("done")
@@ -1618,6 +1640,7 @@ func (ho *hoWorld) txnStep() {
if el >= 1 && el < k.Land && ho.fence != "" && liftOK(k.Poll, "terminated") {
ho.event("ho-fence-lifted-early")
ho.fence = ""
+ ho.fenceLifted()
}
if el < k.Land {
return
@@ -1697,8 +1720,8 @@ func (ho *hoWorld) cancel() {
if ho.live(ho.A) {
ho.draining, ho.gate = false, false
ho.moves = map[string]*hoMove{}
- ho.publish(hoPub{}, nil)
ho.fence = ""
+ ho.publish(hoPub{}, nil)
return
}
if liftOK(ho.k.Probe, "absent") {
diff --git a/internal/sim/regionha/handover_witness_test.go b/internal/sim/regionha/handover_witness_test.go
index a8fa99a31..91064e766 100644
--- a/internal/sim/regionha/handover_witness_test.go
+++ b/internal/sim/regionha/handover_witness_test.go
@@ -37,6 +37,8 @@ func init() {
"R3.2: a request gets its ticket just before shop's move and reaches A's app 3 s later; a move that waits only on the app stops first, and the ticketed request enters a stopped app", wHOTickets},
witness{"fence-lift-on-unknown", "fence-lift-on-unknown", "I11",
"replace: the stopped edge restarts while the terminate is delayed; lifting the fence on an unknown edge state lets it acquire blog before the terminate lands", wHOFence},
+ witness{"fence-not-withdrawn", "fence-not-withdrawn", "WD",
+ "roll: apply restarts A's agent behind the fence; blog's clean marker names A; a restarted agent that publishes itself placeable lets C place blog on A while A is fenced", wHOFencedRestart},
)
}
@@ -231,20 +233,20 @@ func wHOStale(t *testing.T, w *world) {
ho.k.ReportDelay = 8
w.wake(A, sh, wakeOpts{}, nil)
ho.until(t, "the report", func() bool { return ho.phase == "report" })
- // A reboot keeps the persistent fence: the new incarnation is fenced
- // and a request for blog cannot start it on A.
+ // A reboot keeps the persistent fence: the new incarnation is fenced,
+ // publishes itself withdrawn, and no box places blog on it.
ho.agentDown(true)
ho.agentUp()
expect(t, "action-on-stale-report", ho.fence == ho.txn, "the reboot keeps the fence")
ho.second(nil)
- r := ho.req("client", ho.nodeOf[C], "blog", "none", 0)
- ho.arrive(r)
- ho.second(nil)
- expect(t, "action-on-stale-report", A.Entries["blog"] == nil, "the fenced agent starts nothing")
+ expect(t, "action-on-stale-report", ho.denied(ho.nodeOf[C], A) && ho.denied(ho.nodeOf[A], A), "the fenced agent is withdrawn")
// An out-of-band cancel lifts the fence; blog is then placed on A.
ho.k.StrayCancel = ho.sec + 1 - ho.phaseAt
ho.second(nil)
- r = ho.req("client", ho.nodeOf[C], "blog", "none", 0)
+ // The cancel publishes A placeable again (the fence no longer
+ // withdraws it); C folds that before it places blog.
+ ho.until(t, "C's fold of the cancel", func() bool { return ho.nodeOf[C].seen == len(ho.pubs)-1 })
+ r := ho.req("client", ho.nodeOf[C], "blog", "none", 0)
ho.arrive(r)
ho.finishAll()
expect(t, "action-on-stale-report", w.events["ho-stray-cancel"] == 1 && w.events["ho-precheck-refused"] == 1 && w.events["ho-roll-applied"] == 0, "the pre-action check refuses after the cancel")
@@ -276,7 +278,26 @@ func wHOFence(t *testing.T, w *world) {
r := ho.req("client", ho.nodeOf[C], "blog", "none", 0)
ho.arrive(r)
ho.finishAll()
- expect(t, "fence-lift-on-unknown", r.Answer == "today" && w.events["ho-start-refused-fenced"] == 1, "the restarted edge is fenced: %+v", r)
+ // The restarted edge is fenced and publishes itself withdrawn: C
+ // places blog on another box, and A starts nothing.
+ expect(t, "fence-lift-on-unknown", r.Answer == "app" && A.Entries["blog"] == nil && w.events["ho-start-refused-fenced"] == 0, "the restarted edge is fenced and withdrawn: %+v", r)
+}
+
+func wHOFencedRestart(t *testing.T, w *world) {
+ A, _, C := w.abc()
+ ho := hoWitness(w, "roll", "blog")
+ w.wake(A, sh, wakeOpts{}, nil)
+ w.wake(A, "blog", wakeOpts{}, nil)
+ w.sleep(A, "blog", sleepOpts{}) // a clean marker naming A (§6.3 rule 1)
+ ho.until(t, "the roll's apply", func() bool { return ho.phase == "exit" })
+ ho.until(t, "C's fold of the restarted agent's file", func() bool { return ho.nodeOf[C].seen == len(ho.pubs)-1 })
+ if ho.fence == "" {
+ t.Errorf("setup: the fence was cleared before the request (phase %s)", ho.phase)
+ }
+ r := ho.req("client", ho.nodeOf[C], "blog", "none", 0)
+ ho.arrive(r)
+ ho.finishAll()
+ expect(t, "fence-not-withdrawn", r.Answer == "app" && A.Entries["blog"] == nil && w.events["ho-start-refused-fenced"] == 0, "the restarted agent is withdrawn while fenced: %+v", r)
}
func wHOTickets(t *testing.T, w *world) {