carlos / platform Public

activator: one keyed install wait, set and cleared in one place (#1061 r2)

Fix round 2 for Task 1 (Astra re-review 1: P1 remaining, new P3), per
the controller's invariant.

- residentState.install is a keyed wait (row lifetime, deploy, target,
  this box's permit). noteInstallWaitLocked alone sets it (the first
  confirmed install refusal for a key) and clears it (a generation that
  started, or a started generation's crash). Nothing else touches it: a
  registry outage, the moving refusal or any other refusal keeps it. A
  wait of another key is no wait (installWaitLocked), so a new target or
  permit gets its own window.
- replicaRestartedFailure: while the wait is set the step stays open up
  to releaseInstallBound from when it was set, then kept (SR-6-C01);
  never switched-failed while it is set.
- Backoff is separate: install refusals grow none, outages keep theirs.
  The round-1 moving-refusal change is reverted (WakePlan.Moving,
  errInstanceMoving gone; its crash classification restored), which
  removes P3's repeated logs and events.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 9f1d6a98aa16a79f5c54d2e47440245a4a4c4071 parent a9455fe
7 files changed, +417 −274
  • internal/activator/replica_install_wait_test.go +313 −192
  • internal/activator/replicadeploy.go +9 −6
  • internal/activator/rootfs_service.go +80 −37
  • internal/activator/wakeplan.go +8 −23
  • internal/rollout/intent_test.go +2 −2
  • internal/rollout/wakeplan.go +2 −11
  • internal/rollout/wakeplan_test.go +3 −3

Intent

Human

<task-notification> <task-id>a9fd60e14bb47d1b0</task-id> <tool-use-id>toolu_011Rfy5hcHpz6q7aA7d49SEp</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2b517942-2259-467d-a8d0-994fd28c9e84/tasks/a9fd60e14bb47d1b0.output</output-file> <status>completed</status> <summary>Agent "Implement #1061 Task 1" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE_WITH_CONCERNS Commits: - `882a3f34 activator: a join waits for its build install; not a crash (#1061)` - `a9455fe6 activator: one install deadline; outages are not installs (#1061 r1)` Tests: the two new interleaving subtests and `TestInstallWaitDeadlineRules` fail when the round-0 clearing rule is put back. The "moving refusal last" case then answers switched-failed again. With the fix, all four W1 subtests, the rules test and the eight subtests of the rollout marker test pass. Both full packages pass once (activator in 300 s, rollout in 6 s), and the build, vet and darwin/windows builds are clean. - **P1:** the install wait now keeps one deadline for the row's lifetime. The "still moving" refusal is now typed and is no longer counted as a crash. Only a successful wake, a build failure or a different row lifetime clears the deadline. - **P2:** only a row actually read with no installed build is marked as an install wait. An unreadable or missing row, or a row that moved twice during planning, gets the same words unmarked, so a registry outage still backs off. Concerns: 1. Because the "still moving" refusal no longer counts as a crash, ordinary residents now retry every 2 s tick while an attempt runs, instead of backing off. I didn't run the internal/host suite; CI covers it. 2. A registry outage still clears the deadline, as the review asked. A join whose last wake before a step was an outage, past 32 s, can still get the old switched-failed answer. 3. The deadline belongs to the row's lifetime, not the permit. A stale one from an earlier permit could make a later step answer kept immediately; either way the join halts rather than switches. Report (fix round appended): /home/paulca/amadan.net/carlos/platform/.claude/worktrees/sr-followups/.superpowers/sdd/plan-1061/task-1-report.md</result> <usage><subagent_tokens>163915</subagent_tokens><tool_uses>14</tool_uses><duration_ms>574872</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b53vq0z5a</task-id> <tool-use-id>toolu_013ot4ciHRNb7ZkKToK3EWPL</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/2b517942-2259-467d-a8d0-994fd28c9e84/tasks/b53vq0z5a.output</output-file> <status>completed</status> <summary>Background command "S=/home/paulca/.paseo/zerosub/homes/claude-37fe90ef3f56/plugins/cache/claude-plugins-official/superpowers/7.0.2/skills/subagent-driven-development; bash $S/scripts/review-package $PWD/.superpowers/sdd/2026-11-14-sr-followups/plan-1061.md 882a3f34 HEAD &amp;&amp; P=.superpowers/sdd/plan-1061 &amp;&amp; cat &gt; $P/task-1-astra-rereview-1.md &lt;&lt;'EOF' Scoped re-review, read-only (do not modify files, index or branches). Go change in the CARLOS platform. Your previous review of this task (round 1) ... [1287 characters truncated] ... ors. Be concise. EOF timeout 1800 codex exec -m gpt-6-astra -c model_reasoning_effort=high -s read-only "Read .superpowers/sdd/plan-1061/task-1-astra-rereview-1.md and do what it says." &lt;/dev/null &gt; $P/task-1-astra-rereview-1.txt 2&gt;&amp;1; tail -40 $P/task-1-astra-rereview-1.txt" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 14.7 g CO₂e (1,725,328 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on sr-followups, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/internal/activator/replica_install_wait_test.go b/internal/activator/replica_install_wait_test.go
index 5d6aaef30..e7d1f19a8 100644
--- a/internal/activator/replica_install_wait_test.go
+++ b/internal/activator/replica_install_wait_test.go
@@ -3,259 +3,380 @@ package activator
import (
"context"
"errors"
- "fmt"
"slices"
"testing"
"time"
"github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/release"
"github.com/carlosframework/platform/internal/replicas"
)
-// TestJoinInstallWaitKeepsStepOpen (#1061 W1): a joining permit holder
-// whose wakes are refused because no build is installed on its box yet
-// (WakePlan.Installing, errBuildNotInstalled) keeps its step open past
-// replicaRestartBound, up to releaseInstallBound from the first such
-// refusal, and is never answered switched-failed. The refusal is no crash:
-// it grows no resident backoff, so the next tick after root's stamp starts
-// the copy.
-// - installed at 60 s: the step stays open through the wait, the copy
-// launches once the planner boots it, and the step proves the switch.
-// - never installed: past releaseInstallBound the step answers kept with
-// the install reason (SR-6-C01); the ACK halts the join and the box is
-// not in Completed.
-func TestJoinInstallWaitKeepsStepOpen(t *testing.T) {
+// installJoin is box b's permitted join of deploy-v2 at permit (and
+// revision) rev, copies 1 -> 2: a ran the release and is Completed.
+func installJoin(rev uint64) func(string) *replicas.Deploy {
+ return func(inc string) *replicas.Deploy {
+ return &replicas.Deploy{ID: "deploy-v2", Incarnation: inc, Target: replicaTarget, BaselineSet: true, LastGood: replicaTarget, Phase: "released", Term: "term", Revision: rev,
+ Swap: replicas.Swap{Order: []string{"a", "b"}, Completed: []string{"a"}, ActiveBox: "b", Permit: rev}}
+ }
+}
+
+// installRig is an always-on joining copy on box b whose planner refuses
+// every wake as not installed (WakePlan.Installing) until the test says
+// otherwise, with wake and a proof-only (or awake) step of the permit.
+type installRig struct {
+ *replicaSetRig
+ t *testing.T
+}
+
+var (
+ planNotInstalled = WakePlan{Refuse: "no build is installed for this instance yet", Installing: true, Token: 2}
+ // planUnconfirmed is the same words unmarked: a row the planner could
+ // not read (a registry outage; fix round 1, P2).
+ planUnconfirmed = WakePlan{Refuse: "no build is installed for this instance yet", Token: 3}
+ // planMoving is the rollout planner's moving refusal: untyped.
+ planMoving = WakePlan{Refuse: "this instance is still moving to another build", Token: 4}
+)
+
+func newInstallRig(t *testing.T) *installRig {
+ t.Helper()
prev := swapSettle
swapSettle = 20 * time.Millisecond
t.Cleanup(func() { swapSettle = prev })
- join := func(inc string) *replicas.Deploy {
- return &replicas.Deploy{ID: "deploy-v2", Incarnation: inc, Target: replicaTarget, BaselineSet: true, LastGood: replicaTarget, Phase: "released", Term: "term", Revision: 5,
- Swap: replicas.Swap{Order: []string{"a", "b"}, Completed: []string{"a"}, ActiveBox: "b", Permit: 5}}
+ r := newReplicaSetRig(t, "b", installJoin(5))
+ r.rt.Hibernate = false
+ r.routes.set(r.rt)
+ r.setPlan(planNotInstalled)
+ return &installRig{replicaSetRig: r, t: t}
+}
+
+// wakeWith wakes once under plan and returns the wake's error.
+func (r *installRig) wakeWith(plan WakePlan) error {
+ r.t.Helper()
+ r.setPlan(plan)
+ return waitErr(r.t, r.wake(r.a))
+}
+
+func (r *installRig) step(awake bool) SwapResult {
+ at := Attempt{Host: r.rt.Host, Cause: CauseRelease, Build: "v2", StagedPath: r.next.StagedPath, Mode: ModeOverlap, SchedRev: 1, ProofOnly: true}
+ if awake {
+ at = r.attempt(CauseRelease, ModeOverlap)
}
- notInstalled := WakePlan{Refuse: "no build is installed for this instance yet", Installing: true, Token: 2}
- setup := func(t *testing.T) (*replicaSetRig, func() error, func(bool) SwapResult) {
- r := newReplicaSetRig(t, "b", join)
- r.rt.Hibernate = false
- r.routes.set(r.rt)
- r.setPlan(notInstalled)
- wake := func() error { return waitErr(t, r.wake(r.a)) }
- step := func(awake bool) SwapResult {
- at := Attempt{Host: r.rt.Host, Cause: CauseRelease, Build: "v2", StagedPath: r.next.StagedPath, Mode: ModeOverlap, SchedRev: 1, ProofOnly: true}
- if awake {
- at = r.attempt(CauseRelease, ModeOverlap)
- }
- return r.a.ReplicaSwap(context.Background(), at, *r.store.snapshot(), "b", newestOne)
- }
- return r, wake, step
+ return r.a.ReplicaSwap(context.Background(), at, *r.store.snapshot(), "b", newestOne)
+}
+
+// refused wakes once as not installed and asserts the typed refusal, its
+// text unchanged, and no resident backoff from it.
+func (r *installRig) refused(when string) {
+ r.t.Helper()
+ r.a.mu.Lock()
+ var before int
+ if st := r.a.residents[r.rt.Host]; st != nil {
+ before = st.failures
}
- // refused wakes once, asserts the typed refusal with its text
- // unchanged, and that it set no resident backoff.
- refused := func(t *testing.T, r *replicaSetRig, wake func() error, when string) {
- t.Helper()
- err := wake()
- if !errors.Is(err, errBuildNotInstalled) {
- t.Fatalf("%s: the wake was not refused as not installed: %v", when, err)
- }
- if want := r.rt.Host + ": refusing to wake: no build is installed for this instance yet"; err.Error() != want {
- t.Fatalf("%s: the refusal's text changed: %q, want %q", when, err.Error(), want)
- }
- r.a.mu.Lock()
- st := r.a.residents[r.rt.Host]
- var failures int
- var retryAt, since time.Time
- if st != nil {
- failures, retryAt, since = st.failures, st.retryAt, st.installSince
- }
- now := r.a.now()
- r.a.mu.Unlock()
- if failures != 0 || retryAt.After(now) {
- t.Fatalf("%s: the not-installed refusal was counted as a crash: failures %d, retry in %s", when, failures, retryAt.Sub(now))
- }
- if since.IsZero() {
- t.Fatalf("%s: the install wait was not recorded", when)
- }
+ r.a.mu.Unlock()
+ err := r.wakeWith(planNotInstalled)
+ if !errors.Is(err, errBuildNotInstalled) {
+ r.t.Fatalf("%s: the wake was not refused as not installed: %v", when, err)
}
- open := func(t *testing.T, res SwapResult, when string) {
- t.Helper()
- if res.Proven || res.WebFailed {
- t.Fatalf("%s: the waiting copy's step answered: %+v", when, res)
- }
+ if want := r.rt.Host + ": refusing to wake: no build is installed for this instance yet"; err.Error() != want {
+ r.t.Fatalf("%s: the refusal's text changed: %q, want %q", when, err.Error(), want)
+ }
+ r.a.mu.Lock()
+ st := r.a.residents[r.rt.Host]
+ failures, retryAt, now := st.failures, st.retryAt, r.a.now()
+ r.a.mu.Unlock()
+ if failures != before || retryAt.After(now) {
+ r.t.Fatalf("%s: the not-installed refusal was counted as a crash: failures %d (before %d), retry in %s", when, failures, before, retryAt.Sub(now))
+ }
+}
+
+// backedOff wakes once under plan, a refusal that is not an install wait,
+// and asserts it was counted toward the backoff.
+func (r *installRig) backedOff(plan WakePlan, when string) {
+ r.t.Helper()
+ r.a.mu.Lock()
+ var before int
+ if st := r.a.residents[r.rt.Host]; st != nil {
+ before = st.failures
+ }
+ r.a.mu.Unlock()
+ err := r.wakeWith(plan)
+ if err == nil || errors.Is(err, errBuildNotInstalled) {
+ r.t.Fatalf("%s: want an untyped refusal, got %v", when, err)
+ }
+ r.a.mu.Lock()
+ failures := r.a.residents[r.rt.Host].failures
+ r.a.mu.Unlock()
+ if failures != before+1 {
+ r.t.Fatalf("%s: the refusal kept no backoff: failures %d, want %d", when, failures, before+1)
+ }
+}
+
+func (r *installRig) since() time.Time {
+ r.a.mu.Lock()
+ defer r.a.mu.Unlock()
+ return r.a.installWaitLocked(r.rt)
+}
+
+func (r *installRig) open(res SwapResult, when string) {
+ r.t.Helper()
+ if res.Proven || res.WebFailed {
+ r.t.Fatalf("%s: the waiting copy's step answered: %+v", when, res)
+ }
+}
+
+func (r *installRig) kept(res SwapResult, when string) {
+ r.t.Helper()
+ if !res.Proven || res.WebFailed || res.Outcome == SwapDone || res.Reason != replicaInstallRefusal {
+ r.t.Fatalf("%s: not answered kept for the install: %+v", when, res)
}
+}
+
+func (r *installRig) switchedFailed(res SwapResult, when string) {
+ r.t.Helper()
+ if !res.Proven || !res.WebFailed {
+ r.t.Fatalf("%s: not answered switched-failed: %+v", when, res)
+ }
+}
+
+// TestJoinInstallWaitKeepsStepOpen (#1061 W1, fix round 2): a joining
+// permit holder whose wakes are refused because no build is installed on
+// its box yet keeps its step open past replicaRestartBound, up to
+// releaseInstallBound from the first such refusal, and is never answered
+// switched-failed while it waits. The refusal grows no backoff. The wait
+// is set and cleared in one place (noteInstallWaitLocked): only a started
+// generation, its crash, or a new row lifetime, deploy, target or permit
+// clears it; a registry outage or the moving refusal does not.
+func TestJoinInstallWaitKeepsStepOpen(t *testing.T) {
t.Run("installed at 60s", func(t *testing.T) {
- r, wake, step := setup(t)
- refused(t, r, wake, "first wake")
- open(t, step(false), "at once")
+ r := newInstallRig(t)
+ r.refused("first wake")
+ r.open(r.step(false), "at once")
r.clk.advance(60 * time.Second)
- refused(t, r, wake, "wake at 60s")
- open(t, step(false), "past replicaRestartBound")
- r.setPlan(WakePlan{Boot: r.next, Mode: ModeOverlap, Token: 3})
- if err := wake(); err != nil {
+ r.refused("wake at 60s")
+ r.open(r.step(false), "past replicaRestartBound")
+ if err := r.wakeWith(WakePlan{Boot: r.next, Mode: ModeOverlap, Token: 5}); err != nil {
t.Fatalf("wake with the build installed: %v", err)
}
- r.a.mu.Lock()
- since := r.a.residents[r.rt.Host].installSince
- r.a.mu.Unlock()
- if !since.IsZero() {
- t.Fatal("a successful wake left the install wait recorded")
+ if !r.since().IsZero() {
+ t.Fatal("a started generation left the install wait set")
}
- res := step(true)
+ res := r.step(true)
if res.Outcome != SwapDone || !res.Proven || res.WebFailed {
t.Fatalf("the joined copy's switch was not proven: %+v", res)
}
})
- // #1061 fix round 1, P1: a moving refusal (an attempt in flight) ran
- // nothing, so it neither grows the backoff nor restarts the install
- // deadline. A step after replicaRestartBound whose last wake was a
- // moving refusal stays open, and install, moving, install ... runs to
- // one deadline from the first install refusal, then kept.
- moving := WakePlan{Refuse: "this instance is still moving to another build", Moving: true, Token: 4}
- movingWake := func(t *testing.T, r *replicaSetRig, wake func() error, when string) {
- t.Helper()
- r.setPlan(moving)
- err := wake()
- r.setPlan(notInstalled)
- if !errors.Is(err, errInstanceMoving) || errors.Is(err, errBuildNotInstalled) {
- t.Fatalf("%s: the wake was not refused as moving: %v", when, err)
+ t.Run("never installed", func(t *testing.T) {
+ r := newInstallRig(t)
+ r.refused("first wake")
+ r.open(r.step(false), "at once")
+ for gone := 50 * time.Second; gone < releaseInstallBound; gone += 50 * time.Second {
+ r.clk.advance(50 * time.Second)
+ r.refused("wake after " + gone.String())
+ r.open(r.step(false), "within the bound")
}
- if want := r.rt.Host + ": refusing to wake: this instance is still moving to another build"; err.Error() != want {
- t.Fatalf("%s: the refusal's text changed: %q", when, err.Error())
+ r.clk.advance(50 * time.Second)
+ r.refused("wake past the bound")
+ r.kept(r.step(false), "past the bound")
+ r.kept(r.step(false), "the repeated step")
+ if err := r.wakeWith(planNotInstalled); !errors.Is(err, ErrFenced) {
+ t.Fatalf("a wake before the ACK was not refused by the kept fence: %v", err)
}
+ cur := *r.store.snapshot()
+ next, err := replicas.NextDeploy(cur, replicas.DeployChange{Op: "ack", ID: cur.ID, Box: "b", Revision: cur.Revision, Target: cur.Target, Permit: cur.Swap.Permit}, replicas.Coordinator{}, time.Now())
+ if err != nil || next.PermitOutstanding() || !next.Swap.Halted || slices.Contains(next.Swap.Completed, "b") {
+ t.Fatalf("the join did not halt with b out of Completed: %v %+v", err, next.Swap)
+ }
+ r.a.SetReplicaDeploy(r.rt.Host, next, "b")
r.a.mu.Lock()
- failures, retryAt := r.a.residents[r.rt.Host].failures, r.a.residents[r.rt.Host].retryAt
- now := r.a.now()
+ fence := r.a.fences[r.rt.Host]
r.a.mu.Unlock()
- if failures != 0 || retryAt.After(now) {
- t.Fatalf("%s: the moving refusal was counted as a crash: failures %d", when, failures)
+ if fence != 0 {
+ t.Fatalf("the kept fence outlived its ACK: %d", fence)
}
- }
- since := func(r *replicaSetRig) time.Time {
- r.a.mu.Lock()
- defer r.a.mu.Unlock()
- return r.a.residents[r.rt.Host].installSince
- }
- t.Run("moving refusal last, past replicaRestartBound", func(t *testing.T) {
- r, wake, step := setup(t)
- refused(t, r, wake, "first wake")
- first := since(r)
- open(t, step(false), "at once")
+ })
+ // Astra re-review 1, P1: install refusal and a step at 0; a registry
+ // error at 40 s; the registry recovers with no wake before the next
+ // step. That step stays open (the outage kept its backoff and did not
+ // clear the wait), and past the bound from the first refusal it is
+ // kept, never switched-failed.
+ t.Run("a registry outage between steps", func(t *testing.T) {
+ r := newInstallRig(t)
+ r.refused("first wake")
+ r.open(r.step(false), "at once")
r.clk.advance(40 * time.Second)
- movingWake(t, r, wake, "moving at 40s")
- if got := since(r); !got.Equal(first) {
- t.Fatalf("the moving refusal moved the install deadline: %s, want %s", got, first)
- }
- open(t, step(false), "past replicaRestartBound, a moving refusal last")
+ r.backedOff(planUnconfirmed, "the registry error at 40s")
+ r.clk.advance(5 * time.Second)
+ r.open(r.step(false), "past replicaRestartBound after the outage")
+ r.clk.advance(releaseInstallBound)
+ r.kept(r.step(false), "past the bound after the outage")
})
+ // install, moving, install ... is one deadline from the first install
+ // refusal. The moving refusal keeps its crash backoff (P3 reverted),
+ // so the wakes are spaced past the backoff's 72 s ceiling.
t.Run("install, moving, install keeps one deadline", func(t *testing.T) {
- r, wake, step := setup(t)
- refused(t, r, wake, "first wake")
- first := since(r)
- for gone := time.Duration(0); gone+50*time.Second < releaseInstallBound; gone += 50 * time.Second {
- r.clk.advance(25 * time.Second)
- movingWake(t, r, wake, "moving")
- r.clk.advance(25 * time.Second)
- refused(t, r, wake, "install")
- if got := since(r); !got.Equal(first) {
- t.Fatalf("after %s the install deadline restarted: %s, want %s", gone+50*time.Second, got, first)
+ r := newInstallRig(t)
+ r.refused("first wake")
+ first := r.since()
+ gap := 75 * time.Second
+ for gone := time.Duration(0); gone+2*gap < releaseInstallBound; gone += 2 * gap {
+ r.clk.advance(gap)
+ r.backedOff(planMoving, "moving")
+ if got := r.since(); !got.Equal(first) {
+ t.Fatalf("the moving refusal moved the install deadline: %s, want %s", got, first)
+ }
+ r.open(r.step(false), "a moving refusal last")
+ r.clk.advance(gap)
+ r.refused("install")
+ if got := r.since(); !got.Equal(first) {
+ t.Fatalf("the install deadline restarted: %s, want %s", got, first)
}
- open(t, step(false), "within the bound")
+ r.open(r.step(false), "within the bound")
}
r.clk.advance(releaseInstallBound)
- movingWake(t, r, wake, "moving past the bound")
- if res := step(false); !res.Proven || res.WebFailed || res.Reason != replicaInstallRefusal {
- t.Fatalf("past the one deadline, not answered kept for the install: %+v", res)
- }
+ r.backedOff(planMoving, "moving past the bound")
+ r.kept(r.step(false), "past the one deadline")
})
- t.Run("never installed", func(t *testing.T) {
- r, wake, step := setup(t)
- refused(t, r, wake, "first wake")
- open(t, step(false), "at once")
- for gone := time.Duration(0); gone <= releaseInstallBound; gone += 50 * time.Second {
- r.clk.advance(50 * time.Second)
- refused(t, r, wake, "wake after "+(gone+50*time.Second).String())
- if gone+50*time.Second < releaseInstallBound {
- open(t, step(false), "within the bound")
- }
+ // A new permit (a retry of the join) gets its own install window: an
+ // expired wait of the old permit is not inherited (concern 3).
+ t.Run("a new permit starts its own wait", func(t *testing.T) {
+ r := newInstallRig(t)
+ r.refused("first wake")
+ for gone := time.Duration(0); gone <= releaseInstallBound; gone += time.Minute {
+ r.clk.advance(time.Minute)
+ r.refused("waiting")
}
- res := step(false)
- if !res.Proven || res.WebFailed || res.Outcome == SwapDone || res.Reason != replicaInstallRefusal {
- t.Fatalf("past the bound, not answered kept for the install: %+v", res)
+ next := *installJoin(6)(r.inc)
+ r.store.mu.Lock()
+ r.store.d = &next
+ r.store.mu.Unlock()
+ r.a.SetReplicaDeploy(r.rt.Host, next, "b")
+ if !r.since().IsZero() {
+ t.Fatal("the old permit's wait counts for the new permit")
}
- if again := step(false); !again.Proven || again.WebFailed || again.Reason != replicaInstallRefusal {
- t.Fatalf("the repeated step did not keep its answer: %+v", again)
+ r.refused("first wake under the new permit")
+ if got := r.since(); !got.Equal(r.clk.now()) {
+ t.Fatalf("the new permit's wait starts at %s, want now (%s)", got, r.clk.now())
}
- if err := wake(); !errors.Is(err, ErrFenced) {
- t.Fatalf("a wake before the ACK was not refused by the kept fence: %v", err)
- }
- cur := *r.store.snapshot()
- next, err := replicas.NextDeploy(cur, replicas.DeployChange{Op: "ack", ID: cur.ID, Box: "b", Revision: cur.Revision, Target: cur.Target, Permit: cur.Swap.Permit}, replicas.Coordinator{}, time.Now())
- if err != nil || next.PermitOutstanding() || !next.Swap.Halted || slices.Contains(next.Swap.Completed, "b") {
- t.Fatalf("the join did not halt with b out of Completed: %v %+v", err, next.Swap)
+ r.open(r.step(false), "the new permit's first step")
+ r.clk.advance(time.Minute)
+ r.refused("a minute into the new permit")
+ r.open(r.step(false), "a minute into the new permit")
+ })
+ // The old rules stand where no install wait is set: a started
+ // generation that crashes, then cold wakes that fail, answers
+ // switched-failed past replicaRestartBound; and an outage alone backs
+ // off and follows the same 32 s rule.
+ t.Run("a started generation that crashes", func(t *testing.T) {
+ r := newInstallRig(t)
+ r.refused("first wake")
+ if err := r.wakeWith(WakePlan{Boot: r.next, Mode: ModeOverlap, Token: 5}); err != nil {
+ t.Fatalf("wake with the build installed: %v", err)
}
- r.a.SetReplicaDeploy(r.rt.Host, next, "b")
r.a.mu.Lock()
- fence := r.a.fences[r.rt.Host]
+ n := r.a.entries[r.rt.Host].gen.N
r.a.mu.Unlock()
- if fence != 0 {
- t.Fatalf("the kept fence outlived its ACK: %d", fence)
+ r.b.procOf(n).exit()
+ r.a.sweepOnce()
+ waitFor(t, "the crashed entry to go", func() bool {
+ r.a.mu.Lock()
+ defer r.a.mu.Unlock()
+ return r.a.entries[r.rt.Host] == nil
+ })
+ if !r.since().IsZero() {
+ t.Fatal("an install wait survived the started generation")
}
+ r.a.StorageDeclaration = func(context.Context, registry.Route, release.StagedIdentity) (bool, string, error) {
+ return false, "", errors.New("the staged build cannot be read")
+ }
+ r.clk.advance(2 * time.Second)
+ if err := r.wakeWith(WakePlan{Boot: r.next, Mode: ModeOverlap, Token: 6}); err == nil {
+ t.Fatal("the cold wake served")
+ }
+ r.open(r.step(false), "within replicaRestartBound")
+ r.clk.advance(replicaRestartBound + time.Second)
+ r.switchedFailed(r.step(false), "past replicaRestartBound")
+ })
+ t.Run("an outage alone", func(t *testing.T) {
+ r := newInstallRig(t)
+ r.backedOff(planUnconfirmed, "the first outage")
+ if !r.since().IsZero() {
+ t.Fatal("an outage set an install wait")
+ }
+ r.open(r.step(false), "at once")
+ r.clk.advance(replicaRestartBound + time.Second)
+ r.backedOff(planUnconfirmed, "the outage past the bound")
+ r.switchedFailed(r.step(false), "past replicaRestartBound")
})
}
-// TestInstallWaitDeadlineRules (#1061 fix round 1, P1): the install wait's
-// deadline is kept across refusals that ran nothing and cleared by a wake
-// that served, a failure of the build, or another row lifetime.
-func TestInstallWaitDeadlineRules(t *testing.T) {
- r := newWakeRelRig(t)
+// TestInstallWaitRules (#1061 fix round 2): noteInstallWaitLocked is the
+// one place the wait is set and cleared. Set by an install refusal for a
+// key with no wait; kept by every other wake outcome that started nothing
+// (a registry outage, the moving refusal, a fence, a crash-classified
+// refusal); cleared by a started generation and by its crash; and a wait
+// of another key (target, permit, row lifetime) is no wait.
+func TestInstallWaitRules(t *testing.T) {
+ r := newInstallRig(t)
rt := r.rt
- rt.Hibernate = false
- rt.ReplicaIncarnation = "inc-1"
- notInstalled := fmt.Errorf("%s: refusing to wake: %w", rt.Host, typedRefusal{"no build is installed for this instance yet", errBuildNotInstalled})
- moving := fmt.Errorf("%s: refusing to wake: %w", rt.Host, typedRefusal{"this instance is still moving to another build", errInstanceMoving})
- note := func(rt registry.Route, err error) (time.Time, int) {
+ note := func(rt registry.Route, err error) time.Time {
r.a.mu.Lock()
defer r.a.mu.Unlock()
r.a.noteResidentWakeLocked(&actEntry{host: rt.Host, route: rt}, err)
- st := r.a.residents[rt.Host]
- return st.installSince, st.failures
+ return r.a.installWaitLocked(rt)
}
start := r.clk.now()
- if got, _ := note(rt, notInstalled); !got.Equal(start) {
- t.Fatalf("the first install refusal did not start the deadline: %s", got)
+ if got := note(rt, planRefusal(rt.Host, planNotInstalled)); !got.Equal(start) {
+ t.Fatalf("the first install refusal did not start the wait: %s", got)
}
r.clk.advance(time.Minute)
- for _, err := range []error{moving, ErrFenced, notInstalled} {
- if got, failures := note(rt, err); !got.Equal(start) || failures != 0 {
- t.Fatalf("%v moved the deadline to %s (failures %d), want %s kept", err, got, failures, start)
+ for _, err := range []error{
+ planRefusal(rt.Host, planUnconfirmed), planRefusal(rt.Host, planMoving), ErrFenced,
+ errors.New("registry: disk I/O error"), planRefusal(rt.Host, planNotInstalled),
+ } {
+ if got := note(rt, err); !got.Equal(start) {
+ t.Fatalf("%v moved the wait to %s, want %s kept", err, got, start)
}
}
- if got, failures := note(rt, errors.New("the web process exited at start")); !got.IsZero() || failures != 1 {
- t.Fatalf("a failure of the build kept the deadline %s (failures %d); a crash stays a crash", got, failures)
+ if got := note(rt, nil); !got.IsZero() {
+ t.Fatalf("a started generation kept the wait %s", got)
}
- r.clk.advance(time.Minute)
- restart := r.clk.now()
- note(rt, notInstalled)
- if got, _ := note(rt, nil); !got.IsZero() {
- t.Fatalf("a wake that served kept the deadline %s", got)
+ note(rt, planRefusal(rt.Host, planNotInstalled))
+ r.a.mu.Lock()
+ r.a.noteResidentStopLocked(&actEntry{host: rt.Host, route: rt, stopWhy: StopExited, spawnedAt: r.clk.now()})
+ crashed := r.a.installWaitLocked(rt)
+ r.a.mu.Unlock()
+ if !crashed.IsZero() {
+ t.Fatalf("a started generation's crash kept the wait %s", crashed)
}
- note(rt, notInstalled)
- other := rt
- other.ReplicaIncarnation = "inc-2"
- if got, _ := note(other, moving); !got.IsZero() {
- t.Fatalf("another row lifetime kept the deadline %s", got)
+ // Another target: the observed deploy moves to v3.
+ note(rt, planRefusal(rt.Host, planNotInstalled))
+ moved := *installJoin(5)(r.inc)
+ moved.ID, moved.Target = "deploy-v3", replicas.Build{Version: "v3", Digest: "canonical-v3"}
+ r.a.SetReplicaDeploy(rt.Host, moved, "b")
+ r.a.mu.Lock()
+ other := r.a.installWaitLocked(rt)
+ r.a.mu.Unlock()
+ if !other.IsZero() {
+ t.Fatalf("the old target's wait counts for the new target: %s", other)
}
r.clk.advance(time.Minute)
- note(rt, notInstalled)
- if got, _ := note(other, notInstalled); !got.Equal(r.clk.now()) || got.Equal(restart) {
- t.Fatalf("another row lifetime's install refusal did not start its own deadline: %s", got)
+ if got := note(rt, planRefusal(rt.Host, planNotInstalled)); !got.Equal(r.clk.now()) {
+ t.Fatalf("the new target's first install refusal did not start its own wait: %s", got)
}
- // Fix round 1, P2: the same words unmarked (a row the planner could
- // not read) are no install wait: planRefusal leaves them untyped, they
- // count toward the backoff and they clear the deadline.
- unconfirmed := planRefusal(other.Host, WakePlan{Refuse: "no build is installed for this instance yet"})
- if errors.Is(unconfirmed, errBuildNotInstalled) || !residentFailure(unconfirmed) {
- t.Fatalf("an unmarked refusal was typed as an install wait: %v", unconfirmed)
+ // Another row lifetime.
+ life := rt
+ life.ReplicaIncarnation = "another-lifetime"
+ r.a.mu.Lock()
+ gone := r.a.installWaitLocked(life)
+ r.a.mu.Unlock()
+ if !gone.IsZero() {
+ t.Fatalf("another row lifetime inherited the wait %s", gone)
}
- if got, failures := note(other, unconfirmed); !got.IsZero() || failures == 0 {
- t.Fatalf("an unconfirmed install kept the deadline %s or set no backoff (failures %d)", got, failures)
+ // Backoff is separate: an install refusal counts nothing, the same
+ // words unmarked do.
+ if residentFailure(planRefusal(rt.Host, planNotInstalled)) || !residentFailure(planRefusal(rt.Host, planUnconfirmed)) {
+ t.Fatal("the install refusal and the outage are not told apart for the backoff")
}
}
diff --git a/internal/activator/replicadeploy.go b/internal/activator/replicadeploy.go
index cb3e846a0..34c966d72 100644
--- a/internal/activator/replicadeploy.go
+++ b/internal/activator/replicadeploy.go
@@ -493,13 +493,13 @@ func (a *Service) replicaRestartedFailure(ctx context.Context, at Attempt, deplo
// M8) keeps its step open up to releaseConfigBound from its first
// such refusal, never switched-failed; past it, it answers kept
// (below) with the configuration's reason.
- var configSince, installSince time.Time
+ var configSince time.Time
if st := a.residents[at.Host]; st != nil {
configSince = st.configSince
- if st.installFor == deploy.Incarnation {
- installSince = st.installSince
- }
}
+ // The install wait, for this row lifetime, deploy, target and permit
+ // (installKeyLocked: SetReplicaDeploy above observed this deploy).
+ installSince := a.installWaitLocked(*rt)
if !configSince.IsZero() && a.now().Before(configSince.Add(releaseConfigBound)) {
a.mu.Unlock()
res := abandon(errSwapNotAwake)
@@ -510,7 +510,9 @@ func (a *Service) replicaRestartedFailure(ctx context.Context, at Attempt, deplo
// box yet (#1061: a join onto a fresh box, root's install not stamped)
// keeps its step open likewise, up to releaseInstallBound from its
// first such refusal; past it, it answers kept with the install's
- // reason, so the ACK halts the join without blaming the build.
+ // reason, so the ACK halts the join without blaming the build. While
+ // the wait is set it is never answered switched-failed (fix round 2):
+ // only a started generation, its crash, or a new key clears it.
if !installSince.IsZero() && a.now().Before(installSince.Add(releaseInstallBound)) {
a.mu.Unlock()
res := abandon(errSwapNotAwake)
@@ -534,13 +536,14 @@ func (a *Service) replicaRestartedFailure(ctx context.Context, at Attempt, deplo
// and the ACK (#511 drill 1 round 1, Astra A1).
a.mu.Lock()
st := a.residents[at.Host]
+ installing := !a.installWaitLocked(*rt).IsZero()
why := ""
switch {
case st != nil && !st.secretsSince.IsZero():
why = keptSecrets
case st != nil && !st.configSince.IsZero():
why = keptConfig
- case st != nil && !st.installSince.IsZero() && st.installFor == deploy.Incarnation:
+ case installing:
why = keptInstall
}
a.mu.Unlock()
diff --git a/internal/activator/rootfs_service.go b/internal/activator/rootfs_service.go
index d080af6ca..4ca0e48f9 100644
--- a/internal/activator/rootfs_service.go
+++ b/internal/activator/rootfs_service.go
@@ -435,17 +435,11 @@ type residentState struct {
// copy's permitted step keeps its step open for releaseConfigBound
// from it (replicaRestartedFailure; round 2).
configSince time.Time
- // installSince: the first wake refused because no build is installed
- // for it on this box yet (errBuildNotInstalled), for the row lifetime
- // installFor (its ReplicaIncarnation); zero otherwise. It is one
- // deadline for the whole wait (#1061 fix round 1, P1): a refusal that
- // ran nothing in between (the moving refusal, a fence, an ownership
- // end) keeps it; only a wake that served, a failure of the build
- // (residentFailure) or another row lifetime clears it. A copy's
- // permitted step keeps its step open for releaseInstallBound from it
- // (replicaRestartedFailure; #1061).
- installSince time.Time
- installFor string
+ // install is the install wait (#1061): set by the first wake refused
+ // because no build is installed for it on this box yet, for one key
+ // (row lifetime, deploy, target, permit). noteInstallWaitLocked alone
+ // sets and clears it; installWaitLocked reads it.
+ install installWait
}
// errResidentBackoff is begin's answer for a resident inside its backoff:
@@ -486,9 +480,7 @@ func retryAfterSeconds(d time.Duration) int {
// vanished unit or one with no exit recorded is not the build's (INV-R3).
// Nor is a wake the planner refused because no build is installed for the
// instance on this box yet (errBuildNotInstalled, #1061): that waits for
-// root's install, and the next tick after the stamp starts it. Nor a wake
-// refused while the instance's attempt has not reported
-// (errInstanceMoving): nothing ran (#1061 fix round 1).
+// root's install, and the next tick after the stamp starts it.
func residentFailure(err error) bool {
switch {
case err == nil:
@@ -496,8 +488,7 @@ func residentFailure(err error) bool {
case isReleaseResult(err):
return classifyRelease(err, false) == releaseFailed
case errors.Is(err, ErrFenced), errors.Is(err, errShuttingDown), errors.Is(err, context.Canceled),
- errors.Is(err, errSwapBusy), errors.Is(err, errWakeUnproven), errors.Is(err, errBuildNotInstalled),
- errors.Is(err, errInstanceMoving):
+ errors.Is(err, errSwapBusy), errors.Is(err, errWakeUnproven), errors.Is(err, errBuildNotInstalled):
return false
}
switch verdictOf(err) {
@@ -1122,7 +1113,12 @@ func (a *Service) noteResidentWakeLocked(e *actEntry, err error) {
case st.configSince.IsZero():
st.configSince = a.now()
}
- a.noteInstallWaitLocked(st, e.route, err)
+ switch {
+ case err == nil:
+ a.noteInstallWaitLocked(st, e.route, installStarted)
+ case errors.Is(err, errBuildNotInstalled):
+ a.noteInstallWaitLocked(st, e.route, installRefused)
+ }
}
if err == nil || !e.route.Resident() {
return
@@ -1140,29 +1136,75 @@ func (a *Service) noteResidentWakeLocked(e *actEntry, err error) {
st.retryAt = now.Add(residentBackoff(st.failures, a.residentJitterLocked()))
}
-// noteInstallWaitLocked keeps st.installSince, the install wait's one
-// deadline (#1061 fix round 1, P1), for a wake of rt that ended with err:
-// - a wake that served, or a failure of the build (residentFailure: a
-// crash, a health failure, anything unclassified, a registry outage
-// included) clears it, so a crash stays a failure;
-// - a refusal for no installed build starts it, unless one has already
-// started for this row lifetime;
-// - a wake of another row lifetime (ReplicaIncarnation) clears it;
-// - any other refusal ran nothing (the moving refusal, a fence, an
-// ownership end, the configuration's wait) and keeps it.
+// installWait is a resident's install wait (#1061): since when its wakes
+// have been refused because no build is installed for it on this box yet,
+// for key. Zero: no wait.
+type installWait struct {
+ since time.Time
+ key installKey
+}
+
+// installKey is what an install wait is for: the row lifetime and, for a
+// copy with a replica deploy observed (SetReplicaDeploy), that deploy, its
+// target and this box's permit (zero while the permit is another box's).
+// A wait of another key is no wait.
+type installKey struct {
+ incarnation, deploy, target string
+ permit uint64
+}
+
+// installKeyLocked is rt's install key now. The caller holds a.mu.
+func (a *Service) installKeyLocked(rt registry.Route) installKey {
+ k := installKey{incarnation: rt.ReplicaIncarnation}
+ if p, ok := a.replicaPolicies[rt.Host]; ok && p.deploy.Incarnation == rt.ReplicaIncarnation {
+ k.deploy, k.target = p.deploy.ID, p.deploy.Target.Version
+ if p.box != "" && p.deploy.Swap.ActiveBox == p.box {
+ k.permit = p.deploy.Swap.Permit
+ }
+ }
+ return k
+}
+
+// The events of an install wait (noteInstallWaitLocked).
+type installEvent int
+
+const (
+ installRefused installEvent = iota // a wake refused: no build installed (errBuildNotInstalled)
+ installStarted // a wake served: a generation started
+ installCrashed // a started generation crashed or lost its lease
+)
+
+// noteInstallWaitLocked is the one place the install wait (#1061) is set
+// and cleared (fix round 2, the controller's invariant):
+// - set by a refusal for no installed build, when there is no wait for
+// rt's key now (none, or one of an older key: another row lifetime,
+// deploy, target or permit starts its own);
+// - cleared only by a generation that started (a wake that served) or
+// a started generation's crash (the build's failure).
//
-// The caller holds a.mu.
-func (a *Service) noteInstallWaitLocked(st *residentState, rt registry.Route, err error) {
- switch {
- case err == nil || residentFailure(err):
- st.installSince, st.installFor = time.Time{}, ""
- case errors.Is(err, errBuildNotInstalled):
- if st.installSince.IsZero() || st.installFor != rt.ReplicaIncarnation {
- st.installSince, st.installFor = a.now(), rt.ReplicaIncarnation
+// Nothing else touches it: not a registry outage, not the moving
+// refusal, not any other refusal or failure of a wake that started
+// nothing. Backoff is separate (residentFailure). The caller holds a.mu.
+func (a *Service) noteInstallWaitLocked(st *residentState, rt registry.Route, ev installEvent) {
+ switch ev {
+ case installRefused:
+ if k := a.installKeyLocked(rt); st.install.since.IsZero() || st.install.key != k {
+ st.install = installWait{since: a.now(), key: k}
}
- case st.installFor != rt.ReplicaIncarnation:
- st.installSince, st.installFor = time.Time{}, ""
+ case installStarted, installCrashed:
+ st.install = installWait{}
+ }
+}
+
+// installWaitLocked is since when rt's wakes have waited for its build's
+// install, for rt's key now; zero when there is no such wait. The caller
+// holds a.mu.
+func (a *Service) installWaitLocked(rt registry.Route) time.Time {
+ st := a.residents[rt.Host]
+ if st == nil || st.install.since.IsZero() || st.install.key != a.installKeyLocked(rt) {
+ return time.Time{}
}
+ return st.install.since
}
// noteResidentStopLocked is a stop's outcome for residency, in finishStop as
@@ -1183,6 +1225,7 @@ func (a *Service) noteResidentStopLocked(e *actEntry) {
st.retryAt = now
return
}
+ a.noteInstallWaitLocked(st, e.route, installCrashed)
if now.Sub(e.spawnedAt) >= residentHealthyRun {
st.failures = 0
}
diff --git a/internal/activator/wakeplan.go b/internal/activator/wakeplan.go
index c0fb725cc..099288957 100644
--- a/internal/activator/wakeplan.go
+++ b/internal/activator/wakeplan.go
@@ -40,11 +40,6 @@ type WakePlan struct {
// up to releaseInstallBound (replicaRestartedFailure; #1061). Only the
// planner sets it, with Refuse; nothing compares refusal texts.
Installing bool
- // Moving marks a Refuse given while the instance's attempt has not
- // reported (the rollout planner's moving refusal): nothing ran, so it is
- // errInstanceMoving, no crash of the build, and a join's install wait
- // (installSince) carries on through it (#1061 fix round 1).
- Moving bool
// FailedUnder is the PromotedAt of the pointer Boot was promoted under,
// read by the planner before the wake runs, so a failed first wake is
// published with no blocking read (spec §8.1), as dispatch.FailedUnder
@@ -82,29 +77,19 @@ func (p WakePlan) planned() bool { return p.Boot.StagedPath != "" }
// wait for root's install, not a failure of any build (#1061).
var errBuildNotInstalled = errors.New("activator: no build is installed for this instance yet")
-// errInstanceMoving matches a wake the planner refused because the
-// instance's attempt has not reported yet (WakePlan.Moving): nothing ran.
-var errInstanceMoving = errors.New("activator: this instance is still moving to another build")
+// installRefusal is a planner's Installing refusal: its text is the
+// plan's Refuse, unchanged, and errors.Is matches errBuildNotInstalled.
+type installRefusal struct{ text string }
-// typedRefusal is a planner's typed refusal: its text is the plan's
-// Refuse, unchanged, and errors.Is matches its kind.
-type typedRefusal struct {
- text string
- kind error
-}
-
-func (e typedRefusal) Error() string { return e.text }
-func (e typedRefusal) Is(target error) bool { return target == e.kind }
+func (e installRefusal) Error() string { return e.text }
+func (e installRefusal) Is(target error) bool { return target == errBuildNotInstalled }
// planRefusal is the wake error of plan, a refused plan for host: the
// refusal's text, typed errBuildNotInstalled when the planner marked it
-// Installing and errInstanceMoving when it marked it Moving.
+// Installing.
func planRefusal(host string, plan WakePlan) error {
- switch {
- case plan.Installing:
- return fmt.Errorf("%s: refusing to wake: %w", host, typedRefusal{plan.Refuse, errBuildNotInstalled})
- case plan.Moving:
- return fmt.Errorf("%s: refusing to wake: %w", host, typedRefusal{plan.Refuse, errInstanceMoving})
+ if plan.Installing {
+ return fmt.Errorf("%s: refusing to wake: %w", host, installRefusal{plan.Refuse})
}
return fmt.Errorf("%s: refusing to wake: %s", host, plan.Refuse)
}
diff --git a/internal/rollout/intent_test.go b/internal/rollout/intent_test.go
index ed07826ec..ed6b26faa 100644
--- a/internal/rollout/intent_test.go
+++ b/internal/rollout/intent_test.go
@@ -440,8 +440,8 @@ func TestAFirstWakeNeverReplacesAnAttemptsIntent(t *testing.T) {
t.Fatal(err)
}
p := h.m.Plan(context.Background(), h.rows.get("a"))
- if p.Refuse != "this instance is still moving to another build" || !p.Moving || p.Installing {
- t.Fatalf("plan %+v: want the moving refusal, marked Moving (#1061)", p)
+ if p.Refuse != "this instance is still moving to another build" || p.Installing {
+ t.Fatalf("plan %+v: want the moving refusal, not marked Installing (#1061)", p)
}
if in := h.book.intents["a"]; in.ID != "a1" {
t.Fatalf("intent %+v: the attempt's was replaced", in)
diff --git a/internal/rollout/wakeplan.go b/internal/rollout/wakeplan.go
index 693892008..1586453d0 100644
--- a/internal/rollout/wakeplan.go
+++ b/internal/rollout/wakeplan.go
@@ -272,7 +272,7 @@ func (m *Manager) Plan(ctx context.Context, rt registry.Route) (plan activator.W
// hold that went down, or a swap whose entry stopped under it, is
// recorded by done() before anything wakes the instance, so no wake
// can boot the good build ahead of a hold-down record.
- return movingPlan()
+ return activator.WakePlan{Refuse: movingRefusal}
}
if rt.Version == "" {
// A cold managed host (spec §6.4, §8.4): its build is installed and
@@ -350,13 +350,6 @@ func unconfirmedPlan() activator.WakePlan {
return activator.WakePlan{Refuse: notInstalledRefusal}
}
-// movingPlan is movingRefusal's plan, marked Moving so the activator types
-// it (errInstanceMoving): nothing ran, and a join's install wait carries on
-// through it (#1061 fix round 1, P1).
-func movingPlan() activator.WakePlan {
- return activator.WakePlan{Refuse: movingRefusal, Moving: true}
-}
-
// movingRefusal is a wake's refusal while the instance's attempt has not
// reported (Plan's attemptRunning check, and beginWake meeting the
// attempt's intent between its slot freeing and its End).
@@ -387,9 +380,7 @@ func (m *Manager) beginWake(rt registry.Route, plan activator.WakePlan, tok uint
if errors.Is(err, ErrIntentStands) {
// The instance's attempt finished and has not yet ended its intent:
// it is still, for a moment, moving. Not a book fault.
- plan := movingPlan()
- plan.Token = tok
- return plan
+ return activator.WakePlan{Refuse: movingRefusal, Token: tok}
}
return activator.WakePlan{Refuse: BookUnreadableRefusal, Token: tok}
}
diff --git a/internal/rollout/wakeplan_test.go b/internal/rollout/wakeplan_test.go
index 198356c3a..64bc5d84b 100644
--- a/internal/rollout/wakeplan_test.go
+++ b/internal/rollout/wakeplan_test.go
@@ -575,8 +575,8 @@ func TestAForeignRowsFailedHoldIsHeldDown(t *testing.T) {
h.pass()
waitFor(t, "the attempt to start", func() bool { _, started, _ := h.act.snapshot(); return len(started) == 1 })
// Approved wording (zdd.refuse.attempt-running, zdd.refuse.held-down).
- if p := h.m.Plan(context.Background(), h.rows.get("a")); p.Refuse != "this instance is still moving to another build" || !p.Moving || p.Installing {
- t.Fatalf("a wake was planned while the instance's attempt ran, or its refusal is not marked Moving (#1061): %+v", p)
+ if p := h.m.Plan(context.Background(), h.rows.get("a")); p.Refuse != "this instance is still moving to another build" || p.Installing {
+ t.Fatalf("a wake was planned while the instance's attempt ran, or its refusal is marked Installing (#1061): %+v", p)
}
close(gate)
waitFor(t, "the hold-down record", func() bool { return h.book.HeldDown("bab", "blog", "v2", "a") })
@@ -875,7 +875,7 @@ func TestNotInstalledRefusalsAreMarkedInstalling(t *testing.T) {
})
unconfirmed := func(t *testing.T, site string, p activator.WakePlan) {
t.Helper()
- if p.Refuse != "no build is installed for this instance yet" || p.Installing || p.Moving || p.Boot.StagedPath != "" {
+ if p.Refuse != "no build is installed for this instance yet" || p.Installing || p.Boot.StagedPath != "" {
t.Fatalf("%s: plan %+v, want the same refusal unmarked: nothing confirms a missing install", site, p)
}
}