carlos / platform Public

fix: adopt the record on a refused release step (#511 F11 round 1)

Fix round 1 of Task 3F, after the Astra and Fable reviews.

- Rebase scope: a hold's pinned wake moves its swap's preparation onto
  the row it re-read only with the same Incarnation, ServingSeq, HoldOp
  and Version; other columns may differ.
- No residual gap: when the record writer refuses a begin, or the
  unknown close of an observed releasing attempt, both adapters (the
  trusted store and the console's /release 409) return the record's
  ReplicaDeploy they already read in that call (replicas.ReleaseRefused).
  prepareStatelessRelease re-runs the R9 adoption once on it; the exec's
  fresh record check stays the final gate. No new bucket call.
- No backoff: a release step that ran nothing is NoOwnership in
  verdictOf, so it is not a resident failure.
- Log truthfulness: a refused step, a lost term, a lost or mismatched
  answer and a changed route row each say only what is known
  (SR-4-C55 to C58, provisional); none reads as an unknown result or a
  maintenance fence.
- The witness's request loop stops through t.Cleanup.

Census overlay stateless-replicas-4-task3f re-proposed over both rounds;
the record-write census layer re-digests the changed units.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 0abaa0c0e0a55aceb857060d91793d179e863701 parent 8e0e9ea
16 files changed, +501 −83
  • docs/superpowers/notes/census-proposal-stateless-replicas-4-task3f.md +14 −6
  • docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md +4 −1
  • internal/activator/coordinator.go +7 −1
  • internal/activator/stateless.go +34 −9
  • internal/activator/stateless_holdwake_test.go +118 −20
  • internal/activator/statelessrelease.go +69 −23
  • internal/activator/swap.go +7 −1
  • internal/console/replicacoordinator.go +23 −0
  • internal/console/replicarelease_refusal_test.go +44 −0
  • internal/host/replicacoordinator.go +29 −1
  • internal/host/replicarelease_refusal_test.go +89 −0
  • internal/host/stateless_switch_test.go +14 −13
  • internal/provision/stateless_replicas_4_task3f_census_test.go +18 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-stateless-replicas-4-task3f.tsv +17 −6
  • internal/replicas/types.go +13 −0

CI failed — run details

Intent

Human

<task-notification> <task-id>a5315a07ea5309511</task-id> <tool-use-id>toolu_01JeNqqo4DvavxvschSHABJN</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/a5315a07ea5309511.output</output-file> <status>completed</status> <summary>Agent "Implement Plan 4 Task 3F (F11)" 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 - **Commit:** `8e0e9eab fix: no request gap or false log on the switch to stateless (#511 F11)`, local only, not pushed. - **Causes:** - No real maintenance fence is involved; "maintenance fence active" is just the text of the generic `ErrFenced`. The release writes the route's build-state column, so the hold's pinned wake re-reads a different row than the one the swap prepared, and `statelessCurrent` refuses it (`stateless.go:44-45`). - The request wake that followed read the reconcile index, which had not yet seen the passed release. The record refused its begin, and `statelessrelease.go:142-143` reported that as "result is unknown". - **Tests:** - New production-wired witnesses: `TestStatefulToStatelessSwitchProductionWiring` failed before the fix and passes now. `TestStatefulToStatelessFailedReleaseHolds` passes; it guards F10 behaviour, which already worked. - Two activator unit tests failed before the fix and pass now. - 5 mutations, all killed. Guards, the three cross-compiles and both censuses pass. The census name is `task3f`, because census names must be lower case. - **Concerns:** - There is still a gap of about 3 s after the switch: if the new build exits before the next reconcile pass, its restart is refused. It now logs truthfully, but closing it is a design choice: the box remembers its own committed release reply, or a fresh record read on a refused begin. - That refusal still counts toward the always-on backoff. - The new line SR-4-C55 is provisional and needs Paul's copy review. - A reviewer may prefer an explicit list of row columns allowed to differ for the pinned wake. - **Report:** `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/stateless-replicas-4/.superpowers/sdd/2026-11-01-stateless-replicas-4-deploy-and-drill/task-3F-report.md`</result> <usage><subagent_tokens>323430</subagent_tokens><tool_uses>141</tool_uses><duration_ms>3817160</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bjs86rkdq</task-id> <tool-use-id>toolu_018vm7jGGjfPimf2usAwtbzr</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/bjs86rkdq.output</output-file> <status>completed</status> <summary>Background command "Astra review of F11" completed (exit code 0)</summary> </task-notification>

Human

<paseo-system version="1" kind="agent-message" source-agent-id="58a6481f-ac92-4d29-8cf5-21bd318a7e0c" message-id="1c6643e2-4efd-4bde-b40e-e24988c23621" source-agent-title="CI fleet: fix carlos/platform env failures (#897)"> From the CI operator for 8a3d302 (paseo 58a6481), about carlos/platform main&apos;s activator test failures, which are in your stateless-replica area. Telling you before I touch anything so we don&apos;t collide. Symptom on CI (main bffe1b7 and others): TestStatelessMovedBeforeSpawn, TestReplicaReleaseProofBeforeSuccess, TestReplicaReconcileMemberWakeVerifiesGeneration/stateless-starts and TestNoWorkerAfterAFailedRelease fail now and then with &quot;TempDir RemoveAll cleanup: unlinkat .../00N: directory not empty&quot;. I reproduced it on DOCS-T1 (about 5 in 240 runs under load). Cause, from goroutine dumps taken at cleanup: a release whose stop wasn&apos;t proven leaves a settle attempt to retry. When it succeeds, cmdHold.settle runs onProven -&gt; Service.releaseProven -&gt; persistGenerations -&gt; release.WriteGenerations on the settle goroutine, AFTER settleRelease / stop returned. That ordering is by design (cmd.go:241: &quot;no stop waits for them&quot;). The test then returns, and t.TempDir&apos;s RemoveAll races that write: the dir holds generations.json, generations.seq and a .carlos-write-* temp file. newReleaseRig doesn&apos;t shut the Service down at all. newWakeRelRig&apos;s Shutdown doesn&apos;t wait for those settle goroutines either. Proposed TEST-ONLY fix (nothing in the product): the rigs wait for outstanding release proofs before their temp dirs go. Each test that leaves a proof in flight wraps op.hold.onProven to signal when it returns and waits on that, or the rig cleanup (registered after the TempDirs, so it runs first) waits for those signals. No behaviour change. Questions: (1) Does your stateless-replicas-4 branch touch rootfsrelease_test.go, statelessrelease_test.go, stateless_test.go, replica_reconcile_wake_test.go or rootfs_wake_release_test.go, or change releaseProven/cmdHold.settle? (2) Would you rather take this yourself on your branch? If you&apos;re not touching those files, I&apos;ll ship it as its own small branch off main. Reply via paseo send 58a6481. </paseo-system>

Human

<task-notification> <task-id>b2ivx2apv</task-id> <tool-use-id>toolu_013BbfSYdjELQTiAaKoEq4xL</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/72128d15-58b8-452f-9f7e-8e864e8854d2/tasks/b2ivx2apv.output</output-file> <status>completed</status> <summary>Background command "Fable review of F11" completed (exit code 0)</summary> </task-notification>

Human

<paseo-system version="1" kind="agent-message" source-agent-id="58a6481f-ac92-4d29-8cf5-21bd318a7e0c" message-id="adf3e1f3-c8c2-415c-b82f-4e8a564ebc8c" source-agent-title="CI fleet: fix carlos/platform env failures (#897)"> From 58a6481, for platform-a9: the activator temp-dir fix is on branch activator-settle-wait (edbf1fd0), in Astra review now. Shared helper: waitBackground(t, a) in internal/activator/background_test.go. It waits until a.background, a new atomic.Int64 on Service, reaches zero (it gives up after 10 s with t.Errorf). a.background counts (1) wake goroutines, from Service.wake&apos;s first statement, because a wake answers the request by closing e.ready and only then records its outcome and writes the generations file; and (2) each cmdHold settle attempt until its proof callbacks have run (releaseProven writes the file). newReleaseRig and newWakeRelRig call it in a cleanup registered after their TempDirs. If your new tests build a Service another way, add t.Cleanup(func() { waitBackground(t, a) }) after its TempDir calls. A side observation, not fixed: watchResidentLease goroutines from earlier test instances are still alive in the process at cleanup (seen in dumps), so the rigs leak a watcher per test. </paseo-system>

Attributed to this commit: 30.2 g CO₂e (3,791,571 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on stateless-replicas-4, 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/docs/superpowers/notes/census-proposal-stateless-replicas-4-task3f.md b/docs/superpowers/notes/census-proposal-stateless-replicas-4-task3f.md
index 22c056c4e..ad5956afb 100644
--- a/docs/superpowers/notes/census-proposal-stateless-replicas-4-task3f.md
+++ b/docs/superpowers/notes/census-proposal-stateless-replicas-4-task3f.md
@@ -1,21 +1,29 @@
# Census approval: stateless-replicas-4-task3f
-Ruling `census-ruling-stateless-replicas-4-task3f`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-stateless-replicas-4-task3f`. The independent reviewer approves or rejects every change below, 3 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
-| `internal/activator/statelessrelease.go` `Service.prepareStatelessRelease` | body | unchanged (17) | Task 3F (#511 F11): a begin the record writer refuses (replicas.ErrFenced or ErrInvalid) returns errReplicaObservationBehind (SR-4-C55) instead of ErrReplicaReleaseUnknown; nothing ran either way, and a begin with any other error keeps the unknown answer. Error mapping only; same calls, no read or write added. |
-| `internal/activator/stateless.go` `Service.prepareStateless` | sites | +whole:Route ×6 | Task 3F (#511 F11): a hold's pinned wake that carries the swap's preparation, when the row it re-read differs from the row the swap prepared on, moves the preparation onto the wake's row only after the prepared row passes statelessCurrent against the registry, and then checks the wake's row with statelessCurrent too; a launch field that differs still refuses. The added sites are whole-Route comparisons and copies of the handed and prepared routes (no new reader). No store read or write added; no new authority. |
+| `internal/activator/stateless.go` `Service.statelessCurrent` | body | unchanged (20) | Task 3F fix round 1 (#511 F11): its two route refusals return errStatelessRowChanged (SR-4-C58), a value that is ErrFenced to every errors.Is caller but names no fence. Same reads and comparisons; refusal text only. |
+| `internal/activator/stateless.go` `Service.prepareStateless` | sites | +whole:Route ×8 | Task 3F (#511 F11): a hold's pinned wake carrying the swap's preparation, when the row it re-read differs from the prepared row, moves the preparation onto the wake's row only if the prepared row passes statelessCurrent against the registry, the two rows have the same Incarnation, ServingSeq, HoldOp and Version (sameRowLifetime, fix round 1), and the wake's row then passes statelessCurrent; otherwise it refuses with errStatelessRowChanged. The added sites are whole-Route comparisons and copies of the handed and prepared routes. No store read or write added; no new authority. |
+| `internal/activator/statelessrelease.go` `Service.prepareStatelessRelease` | sites | +whole:Route ×2 | Task 3F fix round 1 (#511 F11): R9 adoption moves into adoptDurable (same phases, same escrow initializer call). A begin, or the unknown close of an observed releasing attempt, that the writer refuses with replicas.ReleaseRefused re-runs adoptDurable once on the record attempt that refusal carries (read by the adapter in the same call), with no read of its own; the exec's fresh record check stays the final gate. Other step failures map to errReplicaRecordRefused, errReplicaTermLost or errReplicaStepUnconfirmed (SR-4-C55 to C57), all ran-nothing refusals. The added sites pass the handed route to adoptDurable and refusedStep. No new store read or write. |
-Envelopes re-pinned: `internal/activator`.
+Envelopes re-pinned: `internal/activator`, `internal/host`, `internal/replicas`.
Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
Recorded dispositions, which each change must still satisfy:
-- `internal/activator/statelessrelease.go` `Service.prepareStatelessRelease`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-stateless-replicas-4-task1;basis=The former PrepareStatelessRelease body. R9: adopts the record's attempt for this lifetime and target in every phase before any coordination; otherwise acquires the term first and only then selects the ID (R1); a begin carries RetryOf only when consuming a durable retry. Same calls (ObserveReplicaRelease, coordinator, escrow initializer, actEntry, runReleaseAdmitted); same gates, proof and SafeUntil checks; no new store read or writer.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: refuses with provision.ErrReplicaSwitchOpen (SR-4-C31) before term acquisition when the observed record already has an unresolved copy-switch permit, instead of a begin the writer refuses and that read as an unknown result. Refusal only; same calls, no read added.
+- `internal/activator/stateless.go` `Service.statelessCurrent`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Recheck current registry launch inputs and fresh record lifetime against the attempt observation without a serving lease; refuse changed configuration or missing evidence. No writes; runtime caller remains to be wired. Fix 3a round 1 I2: repeated gates inspect only the current registry row and attempt-local observation. Fresh record validation moved, not removed: statelessFinalRecord at final backend exec gate. All launch-shape and lifecycle row checks retained.
- `internal/activator/stateless.go` `Service.prepareStateless`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Capture RecordFacts from the existing record source, obtain the durable FailureBook deploy ID, and call Task 2 PrepareStatelessRelease with the canonical verdict/digest carrier. Carry a successful attempt through its hold only after another current-record check; no serving lease or polling loop. Fix 3a round 1 I2: preparation uses reconcile observations and records the successful deploy ID. Carry prepared evidence through hold; fresh backend read must confirm that same released deploy before web runs.;rev3=census-ruling-stateless-failed-release-held;basis=For recovery onto a different installed version's exact committed good version and artifact digest, retain recovery evidence without selecting or writing another deploy. Adds the existing committedGood registry read, with its route and incarnation check. Canonical storage declaration and observed lifetime gates remain.;rev3=census-ruling-stateless-replicas-4-task1;basis=R1: no longer calls ReplicaDeployID before preparation; hands the same a.ReplicaDeployID selector to prepareStatelessRelease, which calls it only after coordinator term acquisition. The ObservedReplicaRelease call stays as a validity check. Same read sites; no new read, write or authority.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2 (D4): for a set row, prepares the record baseline with no release, and refuses a build the row Version does not name before any release; reads the route it is handed (FleetBoxes, Version). No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: for a set row, a build its pointer does not name starts only as the record baseline or the committed permitted target, the latter adopted through prepareStatelessRelease durable path (never a new attempt); a named build, a rollback included, takes the release path. The added reads are the handed route (FleetBoxes, Version) and a copy of it with Stateless set for the adoption, as the release path already builds. No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: for a set row the no-release start is decided per box from the record (this box baseline, or its permitted target adopted through the durable path), whatever the pointer says; only a build that is neither and that the pointer names begins a new attempt. Same reads (the handed route and its copy); no store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: this box baseline is checked before the adopt path, so a completed box restarts on the target while a retry is requested; for the passed target it calls the existing escrow initializer (prepareStatelessEscrow) that the adopt path ran, with the same route and identity. No new reader; no record write.
+- `internal/activator/statelessrelease.go` `Service.prepareStatelessRelease`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-stateless-replicas-4-task1;basis=The former PrepareStatelessRelease body. R9: adopts the record's attempt for this lifetime and target in every phase before any coordination; otherwise acquires the term first and only then selects the ID (R1); a begin carries RetryOf only when consuming a durable retry. Same calls (ObserveReplicaRelease, coordinator, escrow initializer, actEntry, runReleaseAdmitted); same gates, proof and SafeUntil checks; no new store read or writer.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: refuses with provision.ErrReplicaSwitchOpen (SR-4-C31) before term acquisition when the observed record already has an unresolved copy-switch permit, instead of a begin the writer refuses and that read as an unknown result. Refusal only; same calls, no read added.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/activator/stateless.go:sameRowLifetime`: reads +registry:HoldOp ×2, +registry:Incarnation ×2, +registry:ServingSeq ×2, +registry:Version ×2; written legacy, accepted-legacy, frozen
+- new `internal/activator/statelessrelease.go:Service.adoptDurable`: reads +whole:Route; written legacy, accepted-legacy, frozen
+- new `internal/activator/statelessrelease.go:Service.refusedStep`: reads +whole:Route; written legacy, accepted-legacy, frozen
-Seal: `bd25367161555e8a9c5b0df079ad2d8eb648ebaeae3f407e6c638f2f7f01605b` → `58ffb8f3ce4de8ed75c9c52c33c72046f418638bb8148335c6a76e3a81b7b50d`.
+Seal: `bd25367161555e8a9c5b0df079ad2d8eb648ebaeae3f407e6c638f2f7f01605b` → `a1073d6c41fbe29eb8068fa6665fa3c5aab9ae0a90423a53e781403bdbd575ac`.
Overlay: `internal/provision/testdata/plan14-root-reads-stateless-replicas-4-task3f.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
index 5b35f1653..f8f1fd56a 100644
--- a/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
@@ -126,4 +126,7 @@ copy too. Internal wire enums are not an excuse to expose unreviewed text.
| SR-4-C52 | docs/site/cli.md | An instance with more than one copy keeps a separate page cache on each copy's box. A purge clears only the cache of the copy that sent it, so another copy can serve its own saved page until it expires or that copy purges it too. | pending (added by Plan 4 Task 3 per ruling D6; awaiting Paul's copy review) |
| SR-4-C53 | docs/site/cli.md | An app that runs more than one copy of an instance refuses `carlos restart --app` and `--environment`, because every copy would restart at the same time. Deploy a new build instead: its copies switch one box at a time. | pending (added by Plan 4 Task 3 for the F2 restart refusal; awaiting Paul's copy review) |
| SR-4-C54 | internal/console/templates/app_overview.html | <unknown> of <desired> copies unknown; <running> known running | pending (added by Plan 4 Task 3 fix round 1: the overview count when any copy has no live reading, so an unread copy is never counted as stopped; awaiting Paul's copy review) |
-| SR-4-C55 | internal/activator/statelessrelease.go | this box has not yet read the deploy's latest state, so nothing ran. it tries again after its next read | pending (added by Plan 4 Task 3F for F11: a release attempt whose begin the record refused, which ran nothing and was logged as an unknown result; awaiting Paul's copy review) |
+| SR-4-C55 | internal/activator/statelessrelease.go | the deploy record did not accept this release step, so nothing started | pending (added by Plan 4 Task 3F for F11: a release step the record's writer refused, whose record holds no attempt this box adopts; fix round 1 replaced the first draft, which named a cause that was not always known; awaiting Paul's copy review) |
+| SR-4-C56 | internal/activator/statelessrelease.go | this box is no longer coordinating this deploy, so nothing started | pending (added by Plan 4 Task 3F fix round 1: a release step this box did not send because it no longer held the coordinator term, or was shutting down; awaiting Paul's copy review) |
+| SR-4-C57 | internal/activator/statelessrelease.go | the deploy record did not confirm this release step, so nothing started. the next start tries again | pending (added by Plan 4 Task 3F fix round 1: a release step whose answer was lost or did not match, which used to read as an unknown command result; awaiting Paul's copy review) |
+| SR-4-C58 | internal/activator/stateless.go | the instance's settings changed while this start was prepared, so nothing started | pending (added by Plan 4 Task 3F fix round 1: a stateless start whose route row changed after its preparation, which used to read as "maintenance fence active"; awaiting Paul's copy review) |
diff --git a/internal/activator/coordinator.go b/internal/activator/coordinator.go
index 4392cca70..44a6f6325 100644
--- a/internal/activator/coordinator.go
+++ b/internal/activator/coordinator.go
@@ -3,12 +3,18 @@ package activator
import (
"context"
"errors"
+ "fmt"
"sync"
"time"
"github.com/carlosframework/platform/internal/replicas"
)
+// errReleaseTermNotHeld is ReleaseState's own refusal before any request:
+// this client does not hold the term (lost, expired, another term, or the
+// client closed). It is replicas.ErrFenced to every caller.
+var errReleaseTermNotHeld = fmt.Errorf("%w: this box does not hold the coordinator term", replicas.ErrFenced)
+
var ErrReplicaReleaseUnknown = errors.New("the release command's result is unknown, so the deploy stopped and the previous build keeps serving. deploy again to retry the command")
type CoordinatorClient interface {
@@ -238,7 +244,7 @@ func (c *CoordinationClient) ReleaseState(ctx context.Context, id replicas.Ident
}
if c.closed || a == nil || a.errLocked() != nil || a.term != change.Term || c.release == nil {
c.mu.Unlock()
- return replicas.Deploy{}, replicas.ErrFenced
+ return replicas.Deploy{}, errReleaseTermNotHeld
}
c.mu.Unlock()
d, err := c.release(ctx, id, change)
diff --git a/internal/activator/stateless.go b/internal/activator/stateless.go
index 2933b6a0f..96ac8f3b4 100644
--- a/internal/activator/stateless.go
+++ b/internal/activator/stateless.go
@@ -39,10 +39,10 @@ func (a *Service) statelessCurrent(ctx context.Context, rt registry.Route) error
return err
}
if rootfsGateKey(rt) != rootfsGateKey(*now) || rt.Channel != now.Channel || rt.Environment != now.Environment || rt.Caps != now.Caps || rt.Args != now.Args || rt.CreatedAt != now.CreatedAt || rt.Stateless != now.Stateless {
- return ErrFenced
+ return errStatelessRowChanged
}
if observed, ok := ctx.Value(statelessRecordKey{}).(registry.Route); !ok || observed != rt {
- return ErrFenced
+ return errStatelessRowChanged
}
_, _, _, err = ObservedReplicaRelease(ctx, rt)
return err
@@ -50,6 +50,28 @@ func (a *Service) statelessCurrent(ctx context.Context, rt registry.Route) error
type statelessRecordKey struct{}
+// statelessRowChanged is a stateless start refused because the route row it
+// was prepared on is not the row it would start on (#511 F11). Nothing
+// started. It is ErrFenced to every classifier, as before, but its text
+// names no fence, since none is involved. copy SR-4-C58 (provisional)
+type statelessRowChanged struct{}
+
+func (statelessRowChanged) Error() string {
+ return "the instance's settings changed while this start was prepared, so nothing started"
+}
+func (statelessRowChanged) Is(target error) bool { return target == ErrFenced }
+
+var errStatelessRowChanged error = statelessRowChanged{}
+
+// sameRowLifetime reports whether a hold's pinned wake may move its swap's
+// preparation from the row the swap read (prepared) onto the row the wake
+// read (wake): the same row lifetime (Incarnation, ServingSeq), no hold
+// operation begun or ended, and the same pointer build. Every other column
+// may differ; statelessCurrent then checks the launch fields.
+func sameRowLifetime(prepared, wake registry.Route) bool {
+ return prepared.Incarnation == wake.Incarnation && prepared.ServingSeq == wake.ServingSeq && prepared.HoldOp == wake.HoldOp && prepared.Version == wake.Version
+}
+
func (b *ExecBackend) coordinationAuthority(host string) replicas.Authority {
if b.Coordination == nil {
return nil
@@ -391,13 +413,16 @@ func (a *Service) prepareStateless(ctx context.Context, rt registry.Route, id re
}
// A hold's pinned wake (#511 F11): the swap prepared, and ran, the
// release on the row it read before the incumbent stopped. The wake
- // re-reads the row after that stop, and the release's own
- // build-state write (and the stop's next-due write, when it changes
- // the time) lands in between. The prepared row still matches the
- // registry in every field statelessCurrent checks, so the
- // preparation moves onto the row this wake read, and that row is
- // checked the same way. Every later gate, the exec's fresh record
- // read included, then reads one row.
+ // re-reads the row after that stop, and other writers (the release's
+ // own build-state write among them) land in between. With the same
+ // row lifetime, hold operation and pointer build, and a prepared row
+ // that still matches the registry in every field statelessCurrent
+ // checks, the preparation moves onto the row this wake read, and
+ // that row is checked the same way. Every later gate, the exec's
+ // fresh record read included, then reads one row.
+ if !sameRowLifetime(prepared.route, rt) {
+ return ctx, errStatelessRowChanged
+ }
rebased := *prepared
rebased.route = rt
observed = context.WithValue(observed, statelessRecordKey{}, rt)
diff --git a/internal/activator/stateless_holdwake_test.go b/internal/activator/stateless_holdwake_test.go
index 3dc226d0b..f1950d908 100644
--- a/internal/activator/stateless_holdwake_test.go
+++ b/internal/activator/stateless_holdwake_test.go
@@ -3,6 +3,7 @@ package activator
import (
"context"
"errors"
+ "strings"
"testing"
"time"
@@ -20,7 +21,7 @@ import (
// differs refuses it as before.
func TestStatelessHoldWakeRebasesPreparation(t *testing.T) {
began := testRoute("shop.example.com")
- began.Account, began.App, began.Runtime, began.Channel = "bab", "shop", registry.RuntimeRootfsV1, "edge"
+ began.Account, began.App, began.Runtime, began.Channel, began.Version = "bab", "shop", registry.RuntimeRootfsV1, "edge", "v2"
facts, err := RecordFactsOf(provision.Record{Account: began.Account, App: began.App, Host: began.Host, CreatedAt: time.Unix(1, 0)})
if err != nil {
t.Fatal(err)
@@ -65,6 +66,8 @@ func TestStatelessHoldWakeRebasesPreparation(t *testing.T) {
}
})
+ // Refused: a launch field, or the row's lifetime, hold operation or
+ // pointer build, differs between the swap's row and the wake's.
for _, tc := range []struct {
name string
edit func(registry, wake *registry.Route)
@@ -72,47 +75,142 @@ func TestStatelessHoldWakeRebasesPreparation(t *testing.T) {
{"registry caps", func(r, w *registry.Route) { r.Caps, w.Caps = "net", "net" }},
{"registry channel", func(r, w *registry.Route) { r.Channel, w.Channel = "stable", "stable" }},
{"wake row caps", func(_, w *registry.Route) { w.Caps = "net" }},
+ {"incarnation", func(r, w *registry.Route) { r.Incarnation, w.Incarnation = 2, 2 }},
+ {"serving seq", func(r, w *registry.Route) { r.ServingSeq, w.ServingSeq = 7, 7 }},
+ {"hold op", func(r, w *registry.Route) { r.HoldOp, w.HoldOp = "moving", "moving" }},
+ {"pointer build", func(r, w *registry.Route) { r.Version, w.Version = "v3", "v3" }},
} {
t.Run(tc.name, func(t *testing.T) {
now, wake := began, began
now.BuildState, wake.BuildState = "moved", "moved"
tc.edit(&now, &wake)
a, prepared := prepare(now)
- if _, err := a.prepareStateless(carryStatelessPreparation(context.Background(), prepared), wake, id, "canonical"); !errors.Is(err, ErrFenced) {
- t.Fatalf("launch change admitted: %v", err)
+ _, err := a.prepareStateless(carryStatelessPreparation(context.Background(), prepared), wake, id, "canonical")
+ if !errors.Is(err, errStatelessRowChanged) || !errors.Is(err, ErrFenced) {
+ t.Fatalf("change admitted or misread: %v", err)
+ }
+ if strings.Contains(err.Error(), "fence") {
+ t.Fatalf("a row change names a fence: %v", err)
}
})
}
}
-// TestReplicaReleaseBeginRefusalRanNothing is #511 F11's log: a box whose
-// observation predates a release that passed asks the writer to begin an
-// attempt, and the writer refuses. No release command ran and none began,
-// so the result is not unknown. A begin whose reply is lost keeps the
-// unknown answer it had.
-func TestReplicaReleaseBeginRefusalRanNothing(t *testing.T) {
- t.Run("stale observation", func(t *testing.T) {
- r, s := replicaReleaseRig(t)
- s.d = &replicas.Deploy{ID: "deploy", Incarnation: "life", Term: "term", Target: replicas.Build{Version: r.id.Version, Digest: "canonical-manifest"}, Phase: "released", Revision: 3}
+// refusingRecord is replicaReleaseStore whose revision refusals carry the
+// record's attempt, as both adapters return it (host replicaCoordinatorStore
+// and the console's /release 409).
+type refusingRecord struct{ *replicaReleaseStore }
+
+func (r refusingRecord) ReleaseState(ctx context.Context, id replicas.Identity, c replicas.ReleaseChange) (replicas.Deploy, error) {
+ d, err := r.replicaReleaseStore.ReleaseState(ctx, id, c)
+ if errors.Is(err, replicas.ErrFenced) && r.held.Err() == nil {
+ return d, &replicas.ReleaseRefused{Err: err, Current: r.snapshot()}
+ }
+ return d, err
+}
+
+// TestReplicaReleaseStaleObservationAdopts is #511 F11's log and its gap: a
+// box whose observation predates the record asks the writer for a step,
+// and the writer refuses with the record's attempt. The box adopts it once,
+// with no read of its own, and starts no release. A refusal it cannot
+// adopt, a lost answer and a lost term each say that nothing started, and
+// none is an unknown result.
+func TestReplicaReleaseStaleObservationAdopts(t *testing.T) {
+ stale := func(r *releaseRig, old *replicas.Deploy) {
r.a.ObserveReplicaRelease = func(context.Context, registry.Route) (replicas.Identity, replicas.Build, *replicas.Deploy, error) {
- return replicas.Identity{Account: r.rt.Account, App: r.rt.App, Host: r.rt.Host, Incarnation: "life"}, replicas.Build{Version: r.id.Version, Digest: "canonical-manifest"}, nil, nil
+ return replicas.Identity{Account: r.rt.Account, App: r.rt.App, Host: r.rt.Host, Incarnation: "life"}, replicas.Build{Version: r.id.Version, Digest: "canonical-manifest"}, old, nil
}
+ }
+ target := func(r *releaseRig) replicas.Build {
+ return replicas.Build{Version: r.id.Version, Digest: "canonical-manifest"}
+ }
+ for _, tc := range []struct {
+ name string
+ observed func(*releaseRig) *replicas.Deploy
+ }{
+ {"nil observation", func(*releaseRig) *replicas.Deploy { return nil }},
+ {"pending observation", func(r *releaseRig) *replicas.Deploy {
+ return &replicas.Deploy{ID: "deploy", Incarnation: "life", Term: "other", Target: target(r), Phase: "pending", Revision: 1}
+ }},
+ {"releasing observation", func(r *releaseRig) *replicas.Deploy {
+ return &replicas.Deploy{ID: "deploy", Incarnation: "life", Term: "other", Target: target(r), Phase: "releasing", Revision: 2}
+ }},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.a.Coordinator = refusingRecord{s}
+ s.d = &replicas.Deploy{ID: "deploy", Incarnation: "life", Term: "term", Target: target(r), Phase: "released", Revision: 3}
+ stale(r, tc.observed(r))
+ if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); err != nil {
+ t.Fatalf("stale observation of a passed release: %v", err)
+ }
+ if r.b.startCount() != 0 || s.snapshot().Phase != "released" || s.snapshot().Revision != 3 {
+ t.Fatalf("starts=%d record=%+v", r.b.startCount(), s.snapshot())
+ }
+ })
+ }
+ t.Run("refused, nothing to adopt", func(t *testing.T) {
+ r, s := replicaReleaseRig(t)
+ r.a.Coordinator = refusingRecord{s}
+ s.d = &replicas.Deploy{ID: "other", Incarnation: "life", Term: "term", Target: replicas.Build{Version: "v0", Digest: "d0"}, Phase: "released", Revision: 3}
+ stale(r, nil)
err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy")
- if !errors.Is(err, errReplicaObservationBehind) || errors.Is(err, ErrReplicaReleaseUnknown) {
- t.Fatalf("refused begin: %v", err)
+ if !errors.Is(err, errReplicaRecordRefused) || errors.Is(err, ErrReplicaReleaseUnknown) || r.b.startCount() != 0 {
+ t.Fatalf("refused begin: %v, starts=%d", err, r.b.startCount())
}
- if r.b.startCount() != 0 || s.snapshot().Phase != "released" {
- t.Fatalf("starts=%d record=%+v", r.b.startCount(), s.snapshot())
+ })
+ t.Run("old console refusal", func(t *testing.T) {
+ // A refusal with no record (a console before F11) stays unconfirmed.
+ r, s := replicaReleaseRig(t)
+ s.d = &replicas.Deploy{ID: "deploy", Incarnation: "life", Term: "term", Target: target(r), Phase: "released", Revision: 3}
+ stale(r, nil)
+ err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy")
+ if !errors.Is(err, errReplicaStepUnconfirmed) || errors.Is(err, ErrReplicaReleaseUnknown) || r.b.startCount() != 0 {
+ t.Fatalf("refusal without a record: %v", err)
}
})
t.Run("lost begin reply", func(t *testing.T) {
r, s := replicaReleaseRig(t)
s.beginHook = func() error { return context.DeadlineExceeded }
- if err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy"); !errors.Is(err, ErrReplicaReleaseUnknown) {
+ err := r.a.PrepareStatelessRelease(context.Background(), r.rt, r.id, "deploy")
+ if !errors.Is(err, errReplicaStepUnconfirmed) || errors.Is(err, ErrReplicaReleaseUnknown) || r.b.startCount() != 0 {
t.Fatalf("lost begin: %v", err)
}
- if r.b.startCount() != 0 {
- t.Fatal("ran after a lost begin")
+ })
+ t.Run("term not held", func(t *testing.T) {
+ c := NewCoordinatorClient("box", "boot", nil, nil)
+ _, err := c.ReleaseState(context.Background(), replicas.Identity{Account: "bab", App: "shop", Host: "shop.example.com", Incarnation: "life"}, replicas.ReleaseChange{Op: "begin", ID: "deploy"})
+ if !errors.Is(err, errReleaseTermNotHeld) || !errors.Is(err, replicas.ErrFenced) {
+ t.Fatalf("precheck: %v", err)
+ }
+ r, _ := replicaReleaseRig(t)
+ if _, got := r.a.refusedStep(context.Background(), r.rt, replicas.Identity{}, replicas.Build{}, "deploy", err); !errors.Is(got, errReplicaTermLost) {
+ t.Fatalf("term lost reads as %v", got)
}
})
}
+
+// TestReplicaStepRefusalNoBackoff is #511 F11's backoff: a release step
+// that did not go through ran nothing, so it is no failure of the build,
+// and an always-on instance's retry stays immediate.
+func TestReplicaStepRefusalNoBackoff(t *testing.T) {
+ rt := testRoute("shop.example.com")
+ rt.Hibernate, rt.Runtime = false, registry.RuntimeRootfsV1
+ now := time.Unix(1000, 0)
+ for _, err := range []error{errReplicaRecordRefused, errReplicaTermLost, errReplicaStepUnconfirmed, errStatelessRowChanged} {
+ if residentFailure(err) {
+ t.Fatalf("%v counts as a resident failure", err)
+ }
+ a := &Service{now: func() time.Time { return now }}
+ e := &actEntry{host: rt.Host, route: rt}
+ a.mu.Lock()
+ for i := 0; i < 3; i++ {
+ a.noteResidentWakeLocked(e, err)
+ }
+ st := a.residents[rt.Host]
+ a.mu.Unlock()
+ if st == nil || st.failures != 0 || !st.retryAt.Equal(now) {
+ t.Fatalf("%v: backoff %+v", err, st)
+ }
+ }
+}
diff --git a/internal/activator/statelessrelease.go b/internal/activator/statelessrelease.go
index 412aed5d4..64d7bb766 100644
--- a/internal/activator/statelessrelease.go
+++ b/internal/activator/statelessrelease.go
@@ -16,9 +16,63 @@ import (
var errReplicaReleaseFailed = fmt.Errorf("release: %w", errReleaseNotPassed)
var errReplicaReleaseUnknown = fmt.Errorf("release: %w", ErrReplicaReleaseUnknown)
-// errReplicaObservationBehind is a release attempt whose begin the record's
-// writer refused: nothing ran. copy SR-4-C55 (provisional)
-var errReplicaObservationBehind = errors.New("this box has not yet read the deploy's latest state, so nothing ran. it tries again after its next read")
+// A release step that did not go through, and ran nothing, says only what
+// is known (#511 F11). None is an unknown command result, and none is a
+// failure of the build (verdictOf).
+var (
+ // errReplicaRecordRefused: the record's writer refused the step, and the
+ // attempt it holds is not one this box adopts. copy SR-4-C55 (provisional)
+ errReplicaRecordRefused = errors.New("the deploy record did not accept this release step, so nothing started")
+ // errReplicaTermLost: this box no longer held the coordinator term, so
+ // it asked the record nothing. copy SR-4-C56 (provisional)
+ errReplicaTermLost = errors.New("this box is no longer coordinating this deploy, so nothing started")
+ // errReplicaStepUnconfirmed: the step's answer did not arrive or did not
+ // match (a lost reply); the begin may have been recorded, and an
+ // identical begin replays it. copy SR-4-C57 (provisional)
+ errReplicaStepUnconfirmed = errors.New("the deploy record did not confirm this release step, so nothing started. the next start tries again")
+)
+
+// adoptDurable is R9's adoption of the record's attempt d for this lifetime
+// and target: a passed release (with its escrow recovery), a failed one or
+// an unknown one. ok is false when d holds no such attempt in one of those
+// phases.
+func (a *Service) adoptDurable(ctx context.Context, rt registry.Route, identity replicas.Identity, target replicas.Build, d *replicas.Deploy) (string, error, bool) {
+ durable := replicas.DurableAttempt(d, identity.Incarnation, target)
+ if durable == nil {
+ return "", nil, false
+ }
+ switch {
+ case replicas.ReleasePassed(durable.Phase):
+ if escrow, ok := a.backend.(statelessEscrowInitializer); ok {
+ return durable.ID, escrow.prepareStatelessEscrow(ctx, rt, identity), true
+ }
+ return durable.ID, nil, true
+ case durable.Phase == "unknown":
+ return durable.ID, errReplicaReleaseUnknown, true
+ case durable.Phase == "failed":
+ return durable.ID, errReplicaReleaseFailed, true
+ }
+ return "", nil, false
+}
+
+// refusedStep is a release step's answer when it did not go through. A
+// writer's refusal carries the record's attempt as the writer's caller read
+// it: adoption runs on it once, with no read of this box's own, and the
+// exec's fresh record check stays the final gate. Anything else ran nothing
+// and says which kind of answer it was.
+func (a *Service) refusedStep(ctx context.Context, rt registry.Route, identity replicas.Identity, target replicas.Build, deployID string, err error) (string, error) {
+ var refused *replicas.ReleaseRefused
+ switch {
+ case errors.As(err, &refused):
+ if id, aerr, ok := a.adoptDurable(ctx, rt, identity, target, refused.Current); ok {
+ return id, aerr
+ }
+ return deployID, errReplicaRecordRefused
+ case errors.Is(err, errReleaseTermNotHeld):
+ return deployID, errReplicaTermLost
+ }
+ return deployID, errReplicaStepUnconfirmed
+}
// PrepareStatelessRelease runs one release attempt named deployID. The
// production path is prepareStatelessRelease with the box's ID selector.
@@ -56,18 +110,8 @@ func (a *Service) prepareStatelessRelease(ctx context.Context, rt registry.Route
if identity.Account != rt.Account || identity.App != rt.App || identity.Host != rt.Host || identity.Incarnation == "" || target.Version != id.Version || target.Digest == "" {
return "", replicas.ErrFenced
}
- if durable := replicas.DurableAttempt(old, identity.Incarnation, target); durable != nil {
- switch {
- case replicas.ReleasePassed(durable.Phase):
- if escrow, ok := a.backend.(statelessEscrowInitializer); ok {
- return durable.ID, escrow.prepareStatelessEscrow(ctx, rt, identity)
- }
- return durable.ID, nil
- case durable.Phase == "unknown":
- return durable.ID, errReplicaReleaseUnknown
- case durable.Phase == "failed":
- return durable.ID, errReplicaReleaseFailed
- }
+ if id, err, ok := a.adoptDurable(ctx, rt, identity, target, old); ok {
+ return id, err
}
if old.PermitOutstanding() {
// R2: no new attempt begins while another attempt's copy switch is
@@ -135,6 +179,12 @@ func (a *Service) prepareStatelessRelease(ctx context.Context, rt registry.Route
// A releasing observation is never permission to execute, even when
// this client still holds its term after a lost begin/exec response.
closed, closeErr := a.Coordinator.ReleaseState(ctx, identity, replicas.ReleaseChange{Op: "unknown", ID: old.ID, Target: old.Target, Revision: old.Revision})
+ var refused *replicas.ReleaseRefused
+ if errors.As(closeErr, &refused) {
+ // The record moved past the observed releasing attempt: the
+ // observation was stale (#511 F11), and the record decides.
+ return a.refusedStep(ctx, rt, identity, target, deployID, closeErr)
+ }
if closeErr != nil || old.ID == deployID {
return deployID, ErrReplicaReleaseUnknown
}
@@ -144,14 +194,10 @@ func (a *Service) prepareStatelessRelease(ctx context.Context, rt registry.Route
return deployID, ErrReplicaReleaseUnknown
}
if _, err := change("begin"); err != nil {
- if errors.Is(err, replicas.ErrFenced) || errors.Is(err, replicas.ErrInvalid) {
- // The writer refused the begin, so no release command ran and no
- // attempt began here. Its usual cause is an observation older
- // than the record: the reconcile index has not yet read a release
- // that passed (#511 F11). Its result is not unknown.
- return deployID, errReplicaObservationBehind
- }
- return deployID, ErrReplicaReleaseUnknown
+ // No release command ran. A refusal usually means the observation
+ // is older than the record (the reconcile index has not yet read a
+ // release that passed, #511 F11); the record's attempt decides.
+ return a.refusedStep(ctx, rt, identity, target, deployID, err)
}
// Only this path discards stateful good-build inference. The durable
// deploy ID, canonical target and lifetime decide whether work is due.
diff --git a/internal/activator/swap.go b/internal/activator/swap.go
index 03a574dfc..92be24158 100644
--- a/internal/activator/swap.go
+++ b/internal/activator/swap.go
@@ -250,6 +250,11 @@ const (
// the build runs, at the admission or at the exec, so a refusal that
// surfaces from inside the spawn is abandonment, never the build's failure.
//
+// A stateless release step that did not go through (#511 F11:
+// errReplicaRecordRefused, errReplicaTermLost, errReplicaStepUnconfirmed)
+// is NoOwnership too: no release command ran and no attempt began, so it
+// is never the build's failure, and a resident's backoff does not grow.
+//
// errSwapStopped (the barrier's cancel, from memberCurrentLocked) is
// NoOwnership too: the entry is stopping, so nothing may spawn for it.
// classifyStep reads it as stepCancelled before it asks this.
@@ -275,7 +280,8 @@ func verdictOf(err error) gateVerdict {
errors.Is(err, instancectl.ErrStagedImage), errors.Is(err, errRootfsRefused),
errors.Is(err, errRootfsBinaryLaunch), errors.Is(err, errNoRootfsControl),
errors.Is(err, errBuildStateUnwritten), errors.Is(err, errOwnershipRefused),
- errors.Is(err, errReleaseOpen), errors.Is(err, errReleaseNotPassed), errors.Is(err, errReleaseTurnedOff):
+ errors.Is(err, errReleaseOpen), errors.Is(err, errReleaseNotPassed), errors.Is(err, errReleaseTurnedOff),
+ errors.Is(err, errReplicaRecordRefused), errors.Is(err, errReplicaTermLost), errors.Is(err, errReplicaStepUnconfirmed):
return gateNoOwnership
}
return gateProceed
diff --git a/internal/console/replicacoordinator.go b/internal/console/replicacoordinator.go
index 170a29596..c15ffdb6a 100644
--- a/internal/console/replicacoordinator.go
+++ b/internal/console/replicacoordinator.go
@@ -176,12 +176,19 @@ func (s *Server) handleReplicaRelease(w http.ResponseWriter, r *http.Request) {
var result *provision.Record
unauthorized := false
changed := false
+ var read *replicas.Deploy
+ readOK := false
err := s.withRecordLock(id.Account, id.App, func() error {
current, _, proof, ok := s.replicaFleetRecord(r)
if !ok {
unauthorized = true
return replicas.ErrFenced
}
+ read, readOK = nil, true
+ if current.ReplicaDeploy != nil {
+ d := current.ReplicaDeploy.Clone()
+ read = &d
+ }
if current.Coordinator == nil || current.Coordinator.Box != box || current.Coordinator.Term != req.Term {
return replicas.ErrFenced
}
@@ -211,6 +218,13 @@ func (s *Server) handleReplicaRelease(w http.ResponseWriter, r *http.Request) {
if errors.Is(err, replicas.ErrFenced) || errors.Is(err, replicas.ErrInvalid) || errors.As(err, &held) {
status = http.StatusConflict
}
+ if status == http.StatusConflict && readOK && held == nil {
+ // The refusal names the attempt this call read, so the box adopts
+ // from it with no read of its own (#511 F11). It is the record
+ // the fleet box was already allowed to change.
+ writeJSON(w, status, replicaReleaseRefusal{Error: replicaReleaseChanged, Refused: true, Current: read})
+ return
+ }
jsonError(w, status, replicaReleaseChanged)
return
}
@@ -220,3 +234,12 @@ func (s *Server) handleReplicaRelease(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(result.ReplicaDeploy)
}
+
+// replicaReleaseRefusal is a refused release transition's 409 body: the
+// error every refusal carries, and the record's attempt as the handler read
+// it (null when the record held none).
+type replicaReleaseRefusal struct {
+ Error string `json:"error"`
+ Refused bool `json:"refused"`
+ Current *replicas.Deploy `json:"replica_deploy"`
+}
diff --git a/internal/console/replicarelease_refusal_test.go b/internal/console/replicarelease_refusal_test.go
new file mode 100644
index 000000000..320dc16c3
--- /dev/null
+++ b/internal/console/replicarelease_refusal_test.go
@@ -0,0 +1,44 @@
+package console
+
+import (
+ "encoding/json"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/replicas"
+)
+
+// TestReplicaReleaseRefusalNamesRecordConsole is #511 F11 at the console:
+// a release step the writer refuses answers 409 with the record's attempt
+// as the handler read it, so the box adopts with no read of its own.
+func TestReplicaReleaseRefusalNamesRecordConsole(t *testing.T) {
+ fx, token, inc := replicaAPIFixture(t)
+ base := "/api/fleet/replicas/" + fx.acct + "/shop/" + ixHost
+ code, raw := replicaPost(t, fx, base+"/coordinator", "home/b1", token, map[string]any{"incarnation": inc, "op": "acquire", "boot_id": "boot"})
+ if code != 200 {
+ t.Fatalf("acquire %d %s", code, raw)
+ }
+ var reply replicas.CoordinatorReply
+ if err := json.Unmarshal(raw, &reply); err != nil {
+ t.Fatal(err)
+ }
+ target := replicas.Build{Version: "v1", Digest: "digest"}
+ var d replicas.Deploy
+ for _, op := range []string{"begin", "releasing", "released"} {
+ code, raw = replicaPost(t, fx, base+"/release", "home/b1", token, map[string]any{"incarnation": inc, "op": op, "id": "deploy-1", "term": reply.Lease.Term, "revision": d.Revision, "target": target})
+ if code != 200 {
+ t.Fatalf("%s %d %s", op, code, raw)
+ }
+ if err := json.Unmarshal(raw, &d); err != nil {
+ t.Fatal(err)
+ }
+ }
+ // A box whose observation predates the release begins again.
+ code, raw = replicaPost(t, fx, base+"/release", "home/b1", token, map[string]any{"incarnation": inc, "op": "begin", "id": "deploy-1", "term": reply.Lease.Term, "revision": 0, "target": target})
+ var refused replicaReleaseRefusal
+ if err := json.Unmarshal(raw, &refused); err != nil || code != 409 {
+ t.Fatalf("refusal %d %s: %v", code, raw, err)
+ }
+ if !refused.Refused || refused.Error != replicaReleaseChanged || refused.Current == nil || refused.Current.ID != "deploy-1" || refused.Current.Phase != "released" || refused.Current.Revision != d.Revision {
+ t.Fatalf("refusal body: %s", raw)
+ }
+}
diff --git a/internal/host/replicacoordinator.go b/internal/host/replicacoordinator.go
index 990c18e88..0736bd96f 100644
--- a/internal/host/replicacoordinator.go
+++ b/internal/host/replicacoordinator.go
@@ -46,11 +46,18 @@ func (s *replicaCoordinatorStore) coordinator(ctx context.Context, id replicas.I
}
func (s *replicaCoordinatorStore) releaseState(ctx context.Context, id replicas.Identity, change replicas.ReleaseChange) (replicas.Deploy, error) {
var result replicas.Deploy
+ var read *replicas.Deploy
+ readOK := false
err := release.WithAppMutation(ctx, s.store, id.Account, id.App, "host.replicaRelease", func(ctx context.Context) error {
current, _, err := provision.ReadRecordJudged(ctx, s.store, provision.JudgeFrom(ctx), id.Account, id.App, id.Host)
if err != nil {
return err
}
+ read, readOK = nil, true
+ if current.ReplicaDeploy != nil {
+ d := current.ReplicaDeploy.Clone()
+ read = &d
+ }
next := replicas.Deploy{ID: change.ID, Incarnation: id.Incarnation, Term: change.Term, Target: change.Target, Phase: change.Op, RetryOf: change.RetryOf}
if next.Phase == "begin" {
next.Phase = "pending"
@@ -68,7 +75,17 @@ func (s *replicaCoordinatorStore) releaseState(ctx context.Context, id replicas.
}
return nil
})
- return result, err
+ return result, releaseRefusal(err, read, readOK)
+}
+
+// releaseRefusal is err, carrying the record's attempt as this call read it
+// when the writer refused the transition (#511 F11): the box adopts from it
+// with no read of its own. Any other error is returned as it is.
+func releaseRefusal(err error, current *replicas.Deploy, read bool) error {
+ if err == nil || !read || !(errors.Is(err, replicas.ErrFenced) || errors.Is(err, replicas.ErrInvalid)) {
+ return err
+ }
+ return &replicas.ReleaseRefused{Err: err, Current: current}
}
type replicaCoordinatorAPI struct {
@@ -113,6 +130,17 @@ func (a *replicaCoordinatorAPI) post(ctx context.Context, id replicas.Identity,
return &replicas.CoordinatorHeldError{RetryAt: held.RetryAt}
}
}
+ if resp.StatusCode == http.StatusConflict && op == "release" {
+ // A console that read the record names its attempt with the
+ // refusal (#511 F11); an older console sends none.
+ var refused struct {
+ Refused bool `json:"refused"`
+ Current *replicas.Deploy `json:"replica_deploy"`
+ }
+ if d.Decode(&refused) == nil && refused.Refused {
+ return &replicas.ReleaseRefused{Err: replicas.ErrFenced, Current: refused.Current}
+ }
+ }
return replicas.ErrFenced
}
if err := d.Decode(out); err != nil {
diff --git a/internal/host/replicarelease_refusal_test.go b/internal/host/replicarelease_refusal_test.go
new file mode 100644
index 000000000..09b398b69
--- /dev/null
+++ b/internal/host/replicarelease_refusal_test.go
@@ -0,0 +1,89 @@
+package host
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/provision"
+ "github.com/carlosframework/platform/internal/release"
+ "github.com/carlosframework/platform/internal/replicas"
+)
+
+// TestCoordinatorStoreRefusalCarriesRecord is #511 F11 at the trusted store
+// adapter: a step the writer refuses comes back with the record's attempt
+// as the same call read it, still ErrFenced to every caller.
+func TestCoordinatorStoreRefusalCarriesRecord(t *testing.T) {
+ ctx := context.Background()
+ store := release.NewDirStore(t.TempDir())
+ rec := provision.Record{Schema: 1, Account: "acme", App: "shop", Host: "shop.example.com", Slug: "shop", Pool: "shop", Channel: "stable", Region: "ie", CreatedAt: time.Now(), CreatedBy: "test"}
+ if err := provision.CreateRecord(ctx, store, rec); err != nil {
+ t.Fatal(err)
+ }
+ inc, err := provision.Incarnation(rec.Account, rec.App, rec.Host, rec.CreatedAt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ id := replicas.Identity{Account: rec.Account, App: rec.App, Host: rec.Host, Incarnation: inc}
+ adapter := &replicaCoordinatorStore{store: store}
+ reply, err := adapter.coordinator(ctx, id, replicas.CoordinatorChange{Op: "acquire", Box: "local", BootID: "boot"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ target := replicas.Build{Version: "v1", Digest: "canonical"}
+ var deploy replicas.Deploy
+ for _, op := range []string{"begin", "releasing", "released"} {
+ if deploy, err = adapter.releaseState(ctx, id, replicas.ReleaseChange{Op: op, ID: "deploy", Term: reply.Lease.Term, Revision: deploy.Revision, Target: target}); err != nil {
+ t.Fatalf("%s: %v", op, err)
+ }
+ }
+ for _, change := range []replicas.ReleaseChange{
+ {Op: "begin", ID: "deploy", Term: reply.Lease.Term, Target: target}, // a nil observation
+ {Op: "unknown", ID: "deploy", Term: reply.Lease.Term, Target: target, Revision: deploy.Revision - 1}, // a releasing one
+ } {
+ _, err = adapter.releaseState(ctx, id, change)
+ var refused *replicas.ReleaseRefused
+ if !errors.As(err, &refused) || !errors.Is(err, replicas.ErrFenced) && !errors.Is(err, replicas.ErrInvalid) {
+ t.Fatalf("%s refusal: %v", change.Op, err)
+ }
+ if refused.Current == nil || refused.Current.Phase != "released" || refused.Current.Revision != deploy.Revision {
+ t.Fatalf("%s refusal record: %+v", change.Op, refused.Current)
+ }
+ }
+}
+
+// TestCoordinatorAPIRefusalCarriesRecord: the console API adapter reads the
+// record a 409 names; a 409 without one (an older console) is ErrFenced.
+func TestCoordinatorAPIRefusalCarriesRecord(t *testing.T) {
+ current := replicas.Deploy{ID: "deploy", Incarnation: "life", Phase: "released", Revision: 3, Target: replicas.Build{Version: "v1", Digest: "d"}}
+ for _, tc := range []struct {
+ name string
+ body any
+ want bool
+ }{
+ {"names the record", map[string]any{"error": "changed", "refused": true, "replica_deploy": current}, true},
+ {"older console", map[string]any{"error": "changed"}, false},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("X-Carlos-Version", "test")
+ w.WriteHeader(http.StatusConflict)
+ _ = json.NewEncoder(w).Encode(tc.body)
+ }))
+ defer server.Close()
+ api := &replicaCoordinatorAPI{base: server.URL, client: server.Client()}
+ _, err := api.releaseState(context.Background(), replicas.Identity{Account: "acme", App: "shop", Host: "shop.example.com", Incarnation: "life"}, replicas.ReleaseChange{Op: "begin", ID: "deploy"})
+ var refused *replicas.ReleaseRefused
+ if !errors.Is(err, replicas.ErrFenced) || errors.As(err, &refused) != tc.want {
+ t.Fatalf("%v", err)
+ }
+ if tc.want && (refused.Current == nil || refused.Current.ID != current.ID || refused.Current.Phase != current.Phase || refused.Current.Revision != current.Revision || refused.Current.Target != current.Target) {
+ t.Fatalf("record %+v", refused.Current)
+ }
+ })
+ }
+}
diff --git a/internal/host/stateless_switch_test.go b/internal/host/stateless_switch_test.go
index fb2fd5485..99e0eb10f 100644
--- a/internal/host/stateless_switch_test.go
+++ b/internal/host/stateless_switch_test.go
@@ -230,6 +230,10 @@ func statefulToStatelessSwitch(t *testing.T, fail bool) {
)
stop := make(chan struct{})
done := make(chan struct{})
+ var stopOnce sync.Once
+ stopRequests := func() { stopOnce.Do(func() { close(stop) }); <-done }
+ // Registered at once: a t.Fatal below must not leave the loop running.
+ t.Cleanup(stopRequests)
go func() {
defer close(done)
for {
@@ -267,8 +271,7 @@ func statefulToStatelessSwitch(t *testing.T, fail bool) {
return ok && g.Build == "C" && g.Stateless && row.GoodVersion == "C"
})
}
- close(stop)
- <-done
+ stopRequests()
code, body := request()
reqMu.Lock()
got := append(slices.Clone(answers), fmt.Sprintf("%d %s", code, body))
@@ -327,17 +330,15 @@ func statefulToStatelessSwitch(t *testing.T, fail bool) {
}
} else {
// Still before the reconcile pass reads the passed release: the box's
- // observation has no attempt, so a rewake may not begin one. It runs
- // nothing and says so, then starts C once the pass has read it.
- g, _ := svc.Current(rt.Host)
- be.mu.Lock()
- be.procs[g.N].exited.Store(true)
- be.mu.Unlock()
- wait("rewake refused", func() bool {
- return strings.Contains(logs.String(), "has not yet read the deploy's latest state, so nothing ran")
- })
- reconcile()
- wait("C rewoken", func() bool { g2, ok := svc.Current(rt.Host); return ok && g2.N != g.N && g2.Build == "C" })
+ // observation has no attempt, and C exits. The rewake's begin is
+ // refused with the record's passed attempt, which it adopts: C comes
+ // back with no reconcile pass and no second release.
+ exit("C")
+ for _, line := range []string{"did not accept this release step", "did not confirm this release step", "no longer coordinating"} {
+ if strings.Contains(logs.String(), line) {
+ t.Errorf("the rewake was refused: %q", line)
+ }
+ }
if code, body := request(); code != 200 || body != "C" {
t.Errorf("after C's restart: %d %s", code, body)
}
diff --git a/internal/provision/stateless_replicas_4_task3f_census_test.go b/internal/provision/stateless_replicas_4_task3f_census_test.go
index 7878016fe..549fdbb4a 100644
--- a/internal/provision/stateless_replicas_4_task3f_census_test.go
+++ b/internal/provision/stateless_replicas_4_task3f_census_test.go
@@ -17,10 +17,27 @@ package provision
// the coordinator client, and its source holds no record-write site of
// its own.
// - No new record writer.
+//
+// Fix round 1, self-review:
+// - statelessCurrent: its two refusals return errStatelessRowChanged, which
+// is ErrFenced to every caller; the statelessRecordKey reference is
+// unchanged. No record write.
+// - prepareStateless: the rebase also requires the same Incarnation,
+// ServingSeq, HoldOp and Version (sameRowLifetime). Still no record
+// write.
+// - replicaCoordinatorStore.releaseState and Server.handleReplicaRelease:
+// a writer refusal now carries the record's ReplicaDeploy as the same
+// call already read it (replicas.ReleaseRefused; the console's 409
+// body). The write is the same SetRecordReplicaRelease, under the same
+// lock, term and proof checks; the extra is a clone of a value already
+// read. No new read or write path.
func statelessReplicas4Task3FWriteCensusInventory() []censusEntry {
entries := append([]censusEntry(nil), statelessReplicas4Task3WriteCensusInventory()...)
for _, r := range []censusEntry{
- {"internal/activator/stateless.go", "Service.prepareStateless", "reference", "key:statelessRecordKey", "c04761ad73532aaa699eb6efcce3b6786dcae5fa4fd6fab6f0768d82df0f51f1"},
+ {"internal/activator/stateless.go", "Service.prepareStateless", "reference", "key:statelessRecordKey", "5feaf2e3e8d7f3c6a2cd2b86aa837bd926d26913dc4a79ae473c5af7a8e50c6b"},
+ {"internal/activator/stateless.go", "Service.statelessCurrent", "reference", "key:statelessRecordKey", "bb80cfe535efc3a5b30d4a81ab759242e46dc6fd7bc41de9638e8c01f74cc4dc"},
+ {"internal/console/replicacoordinator.go", "Server.handleReplicaRelease", "record-writer", "key:SetRecordReplicaRelease", "69e76952aedbcc5d59316523d687ed9574184de601414ed77a7e9c342a49ee79"},
+ {"internal/host/replicacoordinator.go", "replicaCoordinatorStore.releaseState", "record-writer", "key:SetRecordReplicaRelease", "8189624abfbfe7f287b3b35b57ff92abfe3aabadb2d5950b1e8aea79be77e6b7"},
} {
replaced := false
for i, e := range entries {
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index fcbd70d36..d73a0825e 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -177,4 +177,4 @@ plan14-root-reads-stateless-replicas-4-task2-fix1.tsv 1a0605f79ac62c776bccc1ae8d
plan14-root-reads-stateless-replicas-4-task2-fix2.tsv 5f83de2e018b47543789a8dbe2cccb86b2d644fbe9ee5771e5d621704ae46e0b
plan14-root-reads-stateless-replicas-4-task2-fix3.tsv bd25367161555e8a9c5b0df079ad2d8eb648ebaeae3f407e6c638f2f7f01605b
plan14-root-reads-stateless-replicas-4-task3.tsv bd25367161555e8a9c5b0df079ad2d8eb648ebaeae3f407e6c638f2f7f01605b
-plan14-root-reads-stateless-replicas-4-task3f.tsv 58ffb8f3ce4de8ed75c9c52c33c72046f418638bb8148335c6a76e3a81b7b50d
+plan14-root-reads-stateless-replicas-4-task3f.tsv a1073d6c41fbe29eb8068fa6665fa3c5aab9ae0a90423a53e781403bdbd575ac
diff --git a/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-task3f.tsv b/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-task3f.tsv
index 16c23d419..3cb0ffcde 100644
--- a/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-task3f.tsv
+++ b/internal/provision/testdata/plan14-root-reads-stateless-replicas-4-task3f.tsv
@@ -1,7 +1,18 @@
# Census overlay stateless-replicas-4-task3f, written by census-propose (#369). census-ruling-stateless-replicas-4-task3f, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-stateless-replicas-4-task3f.md.
-# 1 body, 1 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-@legacy 16c56489908f62f227bfea6a318d78c839c814c7598c5c9748a71f8be5cfd517 internal/activator/statelessrelease.go Service.prepareStatelessRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task1;basis=The former PrepareStatelessRelease body. R9: adopts the record's attempt for this lifetime and target in every phase before any coordination; otherwise acquires the term first and only then selects the ID (R1); a begin carries RetryOf only when consuming a durable retry. Same calls (ObserveReplicaRelease, coordinator, escrow initializer, actEntry, runReleaseAdmitted); same gates, proof and SafeUntil checks; no new store read or writer.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: refuses with provision.ErrReplicaSwitchOpen (SR-4-C31) before term acquisition when the observed record already has an unresolved copy-switch permit, instead of a begin the writer refuses and that read as an unknown result. Refusal only; same calls, no read added.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F (#511 F11): a begin the record writer refuses (replicas.ErrFenced or ErrInvalid) returns errReplicaObservationBehind (SR-4-C55) instead of ErrReplicaReleaseUnknown; nothing ran either way, and a begin with any other error keeps the unknown answer. Error mapping only; same calls, no read or write added. registry:Account@634,registry:App@664,registry:GoodDemand@4427,registry:GoodDigest@4412,registry:GoodVersion@4396,registry:Host@1646,registry:Host@301,registry:Host@4483,registry:Host@4541,registry:Host@4757,registry:Host@4825,registry:Host@691,whole:Route@1093,whole:Route@4550,whole:Route@4557,whole:Route@5109,whole:Route@569 a4951691343e8ca2014832d2a25b6313d457d900dd492c2fcc6e74a61d007877
-@legacy 2b3cbccf8dacf981d010357a9cd2a8612ca825cd94ea5ebb7ea0456295cac135 internal/activator/stateless.go Service.prepareStateless legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Capture RecordFacts from the existing record source, obtain the durable FailureBook deploy ID, and call Task 2 PrepareStatelessRelease with the canonical verdict/digest carrier. Carry a successful attempt through its hold only after another current-record check; no serving lease or polling loop. Fix 3a round 1 I2: preparation uses reconcile observations and records the successful deploy ID. Carry prepared evidence through hold; fresh backend read must confirm that same released deploy before web runs.;rev3=census-ruling-stateless-failed-release-held;basis=For recovery onto a different installed version's exact committed good version and artifact digest, retain recovery evidence without selecting or writing another deploy. Adds the existing committedGood registry read, with its route and incarnation check. Canonical storage declaration and observed lifetime gates remain.;rev3=census-ruling-stateless-replicas-4-task1;basis=R1: no longer calls ReplicaDeployID before preparation; hands the same a.ReplicaDeployID selector to prepareStatelessRelease, which calls it only after coordinator term acquisition. The ObservedReplicaRelease call stays as a validity check. Same read sites; no new read, write or authority.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2 (D4): for a set row, prepares the record baseline with no release, and refuses a build the row Version does not name before any release; reads the route it is handed (FleetBoxes, Version). No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: for a set row, a build its pointer does not name starts only as the record baseline or the committed permitted target, the latter adopted through prepareStatelessRelease durable path (never a new attempt); a named build, a rollback included, takes the release path. The added reads are the handed route (FleetBoxes, Version) and a copy of it with Stateless set for the adoption, as the release path already builds. No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: for a set row the no-release start is decided per box from the record (this box baseline, or its permitted target adopted through the durable path), whatever the pointer says; only a build that is neither and that the pointer names begins a new attempt. Same reads (the handed route and its copy); no store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: this box baseline is checked before the adopt path, so a completed box restarts on the target while a retry is requested; for the passed target it calls the existing escrow initializer (prepareStatelessEscrow) that the adopt path ran, with the same route and identity. No new reader; no record write.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F (#511 F11): a hold's pinned wake that carries the swap's preparation, when the row it re-read differs from the row the swap prepared on, moves the preparation onto the wake's row only after the prepared row passes statelessCurrent against the registry, and then checks the wake's row with statelessCurrent too; a launch field that differs still refuses. The added sites are whole-Route comparisons and copies of the handed and prepared routes (no new reader). No store read or write added; no new authority. registry:Account@284,registry:Account@310,registry:App@324,registry:App@346,registry:Digest@4660,registry:FleetBoxes@1847,registry:FleetBoxes@4303,registry:Host@250,registry:Host@273,registry:Stateless@3385,registry:Stateless@3910,registry:Stateless@4958,registry:Version@4195,registry:Version@4340,registry:Version@4630,whole:Route@1309,whole:Route@1317,whole:Route@1383,whole:Route@1503,whole:Route@1617,whole:Route@1724,whole:Route@259,whole:Route@2758,whole:Route@2765,whole:Route@293,whole:Route@333,whole:Route@3377,whole:Route@3464,whole:Route@3904,whole:Route@3990,whole:Route@4580,whole:Route@4724,whole:Route@4731,whole:Route@4954,whole:Route@5108,whole:Route@5212,whole:Route@5219,whole:Route@540,whole:Route@597,whole:Route@646,whole:Route@661 c04761ad73532aaa699eb6efcce3b6786dcae5fa4fd6fab6f0768d82df0f51f1
-internal/activator/statelessrelease.go Service.prepareStatelessRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task1;basis=The former PrepareStatelessRelease body. R9: adopts the record's attempt for this lifetime and target in every phase before any coordination; otherwise acquires the term first and only then selects the ID (R1); a begin carries RetryOf only when consuming a durable retry. Same calls (ObserveReplicaRelease, coordinator, escrow initializer, actEntry, runReleaseAdmitted); same gates, proof and SafeUntil checks; no new store read or writer.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: refuses with provision.ErrReplicaSwitchOpen (SR-4-C31) before term acquisition when the observed record already has an unresolved copy-switch permit, instead of a begin the writer refuses and that read as an unknown result. Refusal only; same calls, no read added.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F (#511 F11): a begin the record writer refuses (replicas.ErrFenced or ErrInvalid) returns errReplicaObservationBehind (SR-4-C55) instead of ErrReplicaReleaseUnknown; nothing ran either way, and a begin with any other error keeps the unknown answer. Error mapping only; same calls, no read or write added. registry:Account@634,registry:App@664,registry:GoodDemand@4427,registry:GoodDigest@4412,registry:GoodVersion@4396,registry:Host@1646,registry:Host@301,registry:Host@4483,registry:Host@4541,registry:Host@4757,registry:Host@4825,registry:Host@691,whole:Route@1093,whole:Route@4550,whole:Route@4557,whole:Route@5109,whole:Route@569 a4951691343e8ca2014832d2a25b6313d457d900dd492c2fcc6e74a61d007877
-internal/activator/stateless.go Service.prepareStateless legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Capture RecordFacts from the existing record source, obtain the durable FailureBook deploy ID, and call Task 2 PrepareStatelessRelease with the canonical verdict/digest carrier. Carry a successful attempt through its hold only after another current-record check; no serving lease or polling loop. Fix 3a round 1 I2: preparation uses reconcile observations and records the successful deploy ID. Carry prepared evidence through hold; fresh backend read must confirm that same released deploy before web runs.;rev3=census-ruling-stateless-failed-release-held;basis=For recovery onto a different installed version's exact committed good version and artifact digest, retain recovery evidence without selecting or writing another deploy. Adds the existing committedGood registry read, with its route and incarnation check. Canonical storage declaration and observed lifetime gates remain.;rev3=census-ruling-stateless-replicas-4-task1;basis=R1: no longer calls ReplicaDeployID before preparation; hands the same a.ReplicaDeployID selector to prepareStatelessRelease, which calls it only after coordinator term acquisition. The ObservedReplicaRelease call stays as a validity check. Same read sites; no new read, write or authority.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2 (D4): for a set row, prepares the record baseline with no release, and refuses a build the row Version does not name before any release; reads the route it is handed (FleetBoxes, Version). No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: for a set row, a build its pointer does not name starts only as the record baseline or the committed permitted target, the latter adopted through prepareStatelessRelease durable path (never a new attempt); a named build, a rollback included, takes the release path. The added reads are the handed route (FleetBoxes, Version) and a copy of it with Stateless set for the adoption, as the release path already builds. No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: for a set row the no-release start is decided per box from the record (this box baseline, or its permitted target adopted through the durable path), whatever the pointer says; only a build that is neither and that the pointer names begins a new attempt. Same reads (the handed route and its copy); no store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: this box baseline is checked before the adopt path, so a completed box restarts on the target while a retry is requested; for the passed target it calls the existing escrow initializer (prepareStatelessEscrow) that the adopt path ran, with the same route and identity. No new reader; no record write.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F (#511 F11): a hold's pinned wake that carries the swap's preparation, when the row it re-read differs from the row the swap prepared on, moves the preparation onto the wake's row only after the prepared row passes statelessCurrent against the registry, and then checks the wake's row with statelessCurrent too; a launch field that differs still refuses. The added sites are whole-Route comparisons and copies of the handed and prepared routes (no new reader). No store read or write added; no new authority. registry:Account@284,registry:Account@310,registry:App@324,registry:App@346,registry:Digest@4660,registry:FleetBoxes@1847,registry:FleetBoxes@4303,registry:Host@250,registry:Host@273,registry:Stateless@3385,registry:Stateless@3910,registry:Stateless@4958,registry:Version@4195,registry:Version@4340,registry:Version@4630,whole:Route@1309,whole:Route@1317,whole:Route@1383,whole:Route@1503,whole:Route@1617,whole:Route@1724,whole:Route@259,whole:Route@2758,whole:Route@2765,whole:Route@293,whole:Route@333,whole:Route@3377,whole:Route@3464,whole:Route@3904,whole:Route@3990,whole:Route@4580,whole:Route@4724,whole:Route@4731,whole:Route@4954,whole:Route@5108,whole:Route@5212,whole:Route@5219,whole:Route@540,whole:Route@597,whole:Route@646,whole:Route@661 c04761ad73532aaa699eb6efcce3b6786dcae5fa4fd6fab6f0768d82df0f51f1
-@coverage internal/activator 94ecfebefb3782e7de98f0d11e8012f4dae6392ac5c944cae37a1424cb672123
+# 1 body, 2 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 3 new dispositions: 0 reads re-frozen at their disposition with the claim, 3 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 887db36e2cd53538e437a0ce0c2e466e7143332f7014b031749ce984d892f7f2 internal/activator/stateless.go Service.statelessCurrent legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Recheck current registry launch inputs and fresh record lifetime against the attempt observation without a serving lease; refuse changed configuration or missing evidence. No writes; runtime caller remains to be wired. Fix 3a round 1 I2: repeated gates inspect only the current registry row and attempt-local observation. Fresh record validation moved, not removed: statelessFinalRecord at final backend exec gate. All launch-shape and lifecycle row checks retained.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): its two route refusals return errStatelessRowChanged (SR-4-C58), a value that is ErrFenced to every errors.Is caller but names no fence. Same reads and comparisons; refusal text only. registry:Args@467,registry:Args@478,registry:Caps@444,registry:Caps@455,registry:Channel@378,registry:Channel@392,registry:CreatedAt@490,registry:CreatedAt@506,registry:Environment@407,registry:Environment@425,registry:Host@204,registry:Stateless@523,registry:Stateless@539,whole:Route@275,whole:Route@279,whole:Route@348,whole:Route@370,whole:Route@667,whole:Route@679,whole:Route@763 bb80cfe535efc3a5b30d4a81ab759242e46dc6fd7bc41de9638e8c01f74cc4dc
+@legacy f6033b40e9a95ab1f0791170ec35188eaac78219f2b7552408dc9766ce27e639 internal/activator/stateless.go sameRowLifetime legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): new. Compares four fields (Incarnation, ServingSeq, HoldOp, Version) of two in-memory route rows it is handed; no read, write or authority. registry:HoldOp@153,registry:HoldOp@172,registry:Incarnation@67,registry:Incarnation@91,registry:ServingSeq@111,registry:ServingSeq@134,registry:Version@187,registry:Version@207 8cc7ffa914050e09404a4e4a13657db356014ff97cca8cc641dafdaa16a1d6cc
+@legacy 16c7f9c2393d58e24e579c3a2a16e3c676aae502bab5edd51c8b178238563b93 internal/activator/statelessrelease.go Service.adoptDurable legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): new; the R9 adoption switch moved out of prepareStatelessRelease unchanged: DurableAttempt on the attempt it is handed, then the same escrow initializer call (prepareStatelessEscrow) for a passed release, or the failed or unknown sentinel. No new read, write or authority. whole:Route@459 4c32b8d100a319d2a099db1faa9f36b40fedf095583a6ff30ec5ad1345cc41c8
+@legacy f80b56b86ec72c00c7bf79adb30465ddd32312dae206decf575deb68aac5ee1d internal/activator/statelessrelease.go Service.refusedStep legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): new. For a writer refusal (replicas.ReleaseRefused) it calls adoptDurable once on the record attempt the refusal carries; otherwise it maps the error to a ran-nothing sentinel. It reads only the handed route and error; no store read, write or authority. whole:Route@288 1b6b3ec116858d006ae3ffcc558eb456370f8e304a9a23edc8f7ed3985d0b910
+@legacy 23ffec670212b09610996854bd32476cef1a8e192b3824a12a79ee946735707d internal/activator/stateless.go Service.prepareStateless legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Capture RecordFacts from the existing record source, obtain the durable FailureBook deploy ID, and call Task 2 PrepareStatelessRelease with the canonical verdict/digest carrier. Carry a successful attempt through its hold only after another current-record check; no serving lease or polling loop. Fix 3a round 1 I2: preparation uses reconcile observations and records the successful deploy ID. Carry prepared evidence through hold; fresh backend read must confirm that same released deploy before web runs.;rev3=census-ruling-stateless-failed-release-held;basis=For recovery onto a different installed version's exact committed good version and artifact digest, retain recovery evidence without selecting or writing another deploy. Adds the existing committedGood registry read, with its route and incarnation check. Canonical storage declaration and observed lifetime gates remain.;rev3=census-ruling-stateless-replicas-4-task1;basis=R1: no longer calls ReplicaDeployID before preparation; hands the same a.ReplicaDeployID selector to prepareStatelessRelease, which calls it only after coordinator term acquisition. The ObservedReplicaRelease call stays as a validity check. Same read sites; no new read, write or authority.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2 (D4): for a set row, prepares the record baseline with no release, and refuses a build the row Version does not name before any release; reads the route it is handed (FleetBoxes, Version). No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: for a set row, a build its pointer does not name starts only as the record baseline or the committed permitted target, the latter adopted through prepareStatelessRelease durable path (never a new attempt); a named build, a rollback included, takes the release path. The added reads are the handed route (FleetBoxes, Version) and a copy of it with Stateless set for the adoption, as the release path already builds. No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: for a set row the no-release start is decided per box from the record (this box baseline, or its permitted target adopted through the durable path), whatever the pointer says; only a build that is neither and that the pointer names begins a new attempt. Same reads (the handed route and its copy); no store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: this box baseline is checked before the adopt path, so a completed box restarts on the target while a retry is requested; for the passed target it calls the existing escrow initializer (prepareStatelessEscrow) that the adopt path ran, with the same route and identity. No new reader; no record write.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F (#511 F11): a hold's pinned wake carrying the swap's preparation, when the row it re-read differs from the prepared row, moves the preparation onto the wake's row only if the prepared row passes statelessCurrent against the registry, the two rows have the same Incarnation, ServingSeq, HoldOp and Version (sameRowLifetime, fix round 1), and the wake's row then passes statelessCurrent; otherwise it refuses with errStatelessRowChanged. The added sites are whole-Route comparisons and copies of the handed and prepared routes. No store read or write added; no new authority. registry:Account@284,registry:Account@310,registry:App@324,registry:App@346,registry:Digest@4780,registry:FleetBoxes@1967,registry:FleetBoxes@4423,registry:Host@250,registry:Host@273,registry:Stateless@3505,registry:Stateless@4030,registry:Stateless@5078,registry:Version@4315,registry:Version@4460,registry:Version@4750,whole:Route@1341,whole:Route@1348,whole:Route@1429,whole:Route@1437,whole:Route@1503,whole:Route@1623,whole:Route@1737,whole:Route@1844,whole:Route@259,whole:Route@2878,whole:Route@2885,whole:Route@293,whole:Route@333,whole:Route@3497,whole:Route@3584,whole:Route@4024,whole:Route@4110,whole:Route@4700,whole:Route@4844,whole:Route@4851,whole:Route@5074,whole:Route@5228,whole:Route@5332,whole:Route@5339,whole:Route@540,whole:Route@597,whole:Route@646,whole:Route@661 5feaf2e3e8d7f3c6a2cd2b86aa837bd926d26913dc4a79ae473c5af7a8e50c6b
+@legacy 8b1e0908a8aae142731d82e96ac9a393959a416ffeea0855ffabea6f2ea65bcc internal/activator/statelessrelease.go Service.prepareStatelessRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task1;basis=The former PrepareStatelessRelease body. R9: adopts the record's attempt for this lifetime and target in every phase before any coordination; otherwise acquires the term first and only then selects the ID (R1); a begin carries RetryOf only when consuming a durable retry. Same calls (ObserveReplicaRelease, coordinator, escrow initializer, actEntry, runReleaseAdmitted); same gates, proof and SafeUntil checks; no new store read or writer.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: refuses with provision.ErrReplicaSwitchOpen (SR-4-C31) before term acquisition when the observed record already has an unresolved copy-switch permit, instead of a begin the writer refuses and that read as an unknown result. Refusal only; same calls, no read added.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): R9 adoption moves into adoptDurable (same phases, same escrow initializer call). A begin, or the unknown close of an observed releasing attempt, that the writer refuses with replicas.ReleaseRefused re-runs adoptDurable once on the record attempt that refusal carries (read by the adapter in the same call), with no read of its own; the exec's fresh record check stays the final gate. Other step failures map to errReplicaRecordRefused, errReplicaTermLost or errReplicaStepUnconfirmed (SR-4-C55 to C57), all ran-nothing refusals. The added sites pass the handed route to adoptDurable and refusedStep. No new store read or write. registry:Account@634,registry:App@664,registry:GoodDemand@4144,registry:GoodDigest@4129,registry:GoodVersion@4113,registry:Host@1252,registry:Host@301,registry:Host@4200,registry:Host@4258,registry:Host@4474,registry:Host@4542,registry:Host@691,whole:Route@3366,whole:Route@3928,whole:Route@4267,whole:Route@4274,whole:Route@4826,whole:Route@569,whole:Route@860 9fbd26b058a2a23eba1d8dff8c3096cfb66add60dc9f798ea0ed2c15b52c8030
+internal/activator/stateless.go Service.statelessCurrent legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Recheck current registry launch inputs and fresh record lifetime against the attempt observation without a serving lease; refuse changed configuration or missing evidence. No writes; runtime caller remains to be wired. Fix 3a round 1 I2: repeated gates inspect only the current registry row and attempt-local observation. Fresh record validation moved, not removed: statelessFinalRecord at final backend exec gate. All launch-shape and lifecycle row checks retained.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): its two route refusals return errStatelessRowChanged (SR-4-C58), a value that is ErrFenced to every errors.Is caller but names no fence. Same reads and comparisons; refusal text only. registry:Args@467,registry:Args@478,registry:Caps@444,registry:Caps@455,registry:Channel@378,registry:Channel@392,registry:CreatedAt@490,registry:CreatedAt@506,registry:Environment@407,registry:Environment@425,registry:Host@204,registry:Stateless@523,registry:Stateless@539,whole:Route@275,whole:Route@279,whole:Route@348,whole:Route@370,whole:Route@667,whole:Route@679,whole:Route@763 bb80cfe535efc3a5b30d4a81ab759242e46dc6fd7bc41de9638e8c01f74cc4dc
+internal/activator/stateless.go sameRowLifetime legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): new. Compares four fields (Incarnation, ServingSeq, HoldOp, Version) of two in-memory route rows it is handed; no read, write or authority. registry:HoldOp@153,registry:HoldOp@172,registry:Incarnation@67,registry:Incarnation@91,registry:ServingSeq@111,registry:ServingSeq@134,registry:Version@187,registry:Version@207 8cc7ffa914050e09404a4e4a13657db356014ff97cca8cc641dafdaa16a1d6cc
+internal/activator/statelessrelease.go Service.adoptDurable legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): new; the R9 adoption switch moved out of prepareStatelessRelease unchanged: DurableAttempt on the attempt it is handed, then the same escrow initializer call (prepareStatelessEscrow) for a passed release, or the failed or unknown sentinel. No new read, write or authority. whole:Route@459 4c32b8d100a319d2a099db1faa9f36b40fedf095583a6ff30ec5ad1345cc41c8
+internal/activator/statelessrelease.go Service.refusedStep legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): new. For a writer refusal (replicas.ReleaseRefused) it calls adoptDurable once on the record attempt the refusal carries; otherwise it maps the error to a ran-nothing sentinel. It reads only the handed route and error; no store read, write or authority. whole:Route@288 1b6b3ec116858d006ae3ffcc558eb456370f8e304a9a23edc8f7ed3985d0b910
+internal/activator/stateless.go Service.prepareStateless legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Capture RecordFacts from the existing record source, obtain the durable FailureBook deploy ID, and call Task 2 PrepareStatelessRelease with the canonical verdict/digest carrier. Carry a successful attempt through its hold only after another current-record check; no serving lease or polling loop. Fix 3a round 1 I2: preparation uses reconcile observations and records the successful deploy ID. Carry prepared evidence through hold; fresh backend read must confirm that same released deploy before web runs.;rev3=census-ruling-stateless-failed-release-held;basis=For recovery onto a different installed version's exact committed good version and artifact digest, retain recovery evidence without selecting or writing another deploy. Adds the existing committedGood registry read, with its route and incarnation check. Canonical storage declaration and observed lifetime gates remain.;rev3=census-ruling-stateless-replicas-4-task1;basis=R1: no longer calls ReplicaDeployID before preparation; hands the same a.ReplicaDeployID selector to prepareStatelessRelease, which calls it only after coordinator term acquisition. The ObservedReplicaRelease call stays as a validity check. Same read sites; no new read, write or authority.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2 (D4): for a set row, prepares the record baseline with no release, and refuses a build the row Version does not name before any release; reads the route it is handed (FleetBoxes, Version). No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix1;basis=Task 2 fix round 1: for a set row, a build its pointer does not name starts only as the record baseline or the committed permitted target, the latter adopted through prepareStatelessRelease durable path (never a new attempt); a named build, a rollback included, takes the release path. The added reads are the handed route (FleetBoxes, Version) and a copy of it with Stateless set for the adoption, as the release path already builds. No store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: for a set row the no-release start is decided per box from the record (this box baseline, or its permitted target adopted through the durable path), whatever the pointer says; only a build that is neither and that the pointer names begins a new attempt. Same reads (the handed route and its copy); no store read or write added.;rev3=census-ruling-stateless-replicas-4-task2-fix3;basis=Task 2 fix round 3: this box baseline is checked before the adopt path, so a completed box restarts on the target while a retry is requested; for the passed target it calls the existing escrow initializer (prepareStatelessEscrow) that the adopt path ran, with the same route and identity. No new reader; no record write.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F (#511 F11): a hold's pinned wake carrying the swap's preparation, when the row it re-read differs from the prepared row, moves the preparation onto the wake's row only if the prepared row passes statelessCurrent against the registry, the two rows have the same Incarnation, ServingSeq, HoldOp and Version (sameRowLifetime, fix round 1), and the wake's row then passes statelessCurrent; otherwise it refuses with errStatelessRowChanged. The added sites are whole-Route comparisons and copies of the handed and prepared routes. No store read or write added; no new authority. registry:Account@284,registry:Account@310,registry:App@324,registry:App@346,registry:Digest@4780,registry:FleetBoxes@1967,registry:FleetBoxes@4423,registry:Host@250,registry:Host@273,registry:Stateless@3505,registry:Stateless@4030,registry:Stateless@5078,registry:Version@4315,registry:Version@4460,registry:Version@4750,whole:Route@1341,whole:Route@1348,whole:Route@1429,whole:Route@1437,whole:Route@1503,whole:Route@1623,whole:Route@1737,whole:Route@1844,whole:Route@259,whole:Route@2878,whole:Route@2885,whole:Route@293,whole:Route@333,whole:Route@3497,whole:Route@3584,whole:Route@4024,whole:Route@4110,whole:Route@4700,whole:Route@4844,whole:Route@4851,whole:Route@5074,whole:Route@5228,whole:Route@5332,whole:Route@5339,whole:Route@540,whole:Route@597,whole:Route@646,whole:Route@661 5feaf2e3e8d7f3c6a2cd2b86aa837bd926d26913dc4a79ae473c5af7a8e50c6b
+internal/activator/statelessrelease.go Service.prepareStatelessRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-4-task1;basis=The former PrepareStatelessRelease body. R9: adopts the record's attempt for this lifetime and target in every phase before any coordination; otherwise acquires the term first and only then selects the ID (R1); a begin carries RetryOf only when consuming a durable retry. Same calls (ObserveReplicaRelease, coordinator, escrow initializer, actEntry, runReleaseAdmitted); same gates, proof and SafeUntil checks; no new store read or writer.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: refuses with provision.ErrReplicaSwitchOpen (SR-4-C31) before term acquisition when the observed record already has an unresolved copy-switch permit, instead of a begin the writer refuses and that read as an unknown result. Refusal only; same calls, no read added.;rev3=census-ruling-stateless-replicas-4-task3f;basis=Task 3F fix round 1 (#511 F11): R9 adoption moves into adoptDurable (same phases, same escrow initializer call). A begin, or the unknown close of an observed releasing attempt, that the writer refuses with replicas.ReleaseRefused re-runs adoptDurable once on the record attempt that refusal carries (read by the adapter in the same call), with no read of its own; the exec's fresh record check stays the final gate. Other step failures map to errReplicaRecordRefused, errReplicaTermLost or errReplicaStepUnconfirmed (SR-4-C55 to C57), all ran-nothing refusals. The added sites pass the handed route to adoptDurable and refusedStep. No new store read or write. registry:Account@634,registry:App@664,registry:GoodDemand@4144,registry:GoodDigest@4129,registry:GoodVersion@4113,registry:Host@1252,registry:Host@301,registry:Host@4200,registry:Host@4258,registry:Host@4474,registry:Host@4542,registry:Host@691,whole:Route@3366,whole:Route@3928,whole:Route@4267,whole:Route@4274,whole:Route@4826,whole:Route@569,whole:Route@860 9fbd26b058a2a23eba1d8dff8c3096cfb66add60dc9f798ea0ed2c15b52c8030
+@coverage internal/activator 5e8c75a2b44911b8079427d6dd733c23d01b6b8c6aa9e90764a031922101906d
+@coverage internal/host 235567aa39cdd23237c87b083d47b02c77c7499a58c7faec25116a1e12bf57e0
+@coverage internal/replicas 28b9161fa88128b941039eae68ef9948856435e4d29a2cda3af2f1d50ae907c9
diff --git a/internal/replicas/types.go b/internal/replicas/types.go
index 2224216f0..51c94869a 100644
--- a/internal/replicas/types.go
+++ b/internal/replicas/types.go
@@ -46,6 +46,19 @@ var ErrConsoleUnreachable = errors.New("console unreachable")
var ErrFenced = errors.New("replicas: fenced")
var ErrInvalid = errors.New("replicas: invalid transition")
+// ReleaseRefused is a release transition the record's writer refused
+// (ErrFenced or ErrInvalid, in Err), with the attempt the record held when
+// the writer's caller read it in the same call: Current, nil when the
+// record held none. A box re-runs its adoption on Current once (#511 F11),
+// so a refusal needs no further read.
+type ReleaseRefused struct {
+ Err error
+ Current *Deploy
+}
+
+func (e *ReleaseRefused) Error() string { return e.Err.Error() }
+func (e *ReleaseRefused) Unwrap() error { return e.Err }
+
type Authority interface {
Err() error
Lost() <-chan struct{}