carlos / platform Public

durability 3a: escrow knowledge has one writer; reads of the escrow fail closed

What this process knows the bucket holds for an escrowed host now has one
source, escrowState.known, fed only by learnBucket: after a manifest read
from the bucket in this process, or after a commit of this process that
actually wrote. A publisher opened from the ledger and a no-op commit on it
feed nothing, so a stale ledger can no longer suppress the restoration of
an escrowed trio file after a restart and a sweep (Astra r3, finding 1).
A go/ast guard holds the package to the one writer and its four callers.

The write-once check decides the trio first, by digest, before any read of
the sealed env. For an escrowed host, a failure to read its manifest or
sealed env from the bucket (errEscrowUnreadable, or an escrow that does
not open here) refuses the launch; it never reaches the later-launch
fallback, which now serves write failures only (finding 2).

Witnesses: the stale ledger with a no-op sweep before the restore; a
divergent instance.key beside an edited env with the sealed env
unreadable; an unreadable sealed env refusing the launch outright.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 1ead41b1cd5a88d0698b6652eb5461f95ff5d809 parent a20088f
7 files changed, +513 −86
  • docs/superpowers/notes/census-durability-3a-escrow-claims.md +7 −7
  • docs/superpowers/notes/census-proposal-durability-3a-escrow.md +3 −3
  • internal/activator/escrow.go +110 −60
  • internal/activator/escrow_known_guard_test.go +253 −0
  • internal/activator/escrow_test.go +124 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv +15 −15

Intent

Human

<task-notification> <task-id>a3ce1b31a8618f132</task-id> <tool-use-id>toolu_01YCYfKby7JA7KfRu2vpdR3A</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/a3ce1b31a8618f132.output</output-file> <status>completed</status> <summary>Agent "Implement Task 4: escrow for activator hosts" 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. Fix round 3 is in commit a20088f9 (on top of c5c64740), not pushed. - **P1-1, minted env variables:** the activator mints exactly two variables into `&lt;host&gt;.env`: CARLOS_ADMIN_TOKEN (admintoken.go:245) and CARLOS_INSTANCE_KEY (instancekey.go:557). Both are now write-once against the escrow, like the trio. A local value that differs refuses the launch, raises an alert and writes the marker if it can. The bucket re-read checks this before a retry, and every other env line stays editable. It costs one GET of the sealed env, and only when the env changed. - **Stale ledger:** the ledger no longer decides whether to restore a missing trio file. Only a bucket read or a commit made in this same process can rule that out, so the first such decision after a start reads the bucket, and the `checked` flag is gone. The cost is one GET per host per agent restart on its first wake, when a trio file is legitimately absent. - **Lease lost before commit:** the launch is now refused with an error that says the lease was lost; it never falls through to launching anyway. Tests: - The env-secret competing-mint test is back beside the instance.key one. - New witnesses: - a stale minted env variable with the marker write failing, then a restart; - the stale ledger when its removal fails, then a restart; - the stale ledger removed successfully, in the same process; - the lease lost before commit, through the launch. - All four new witnesses failed against c5c64740's code. - The covering tests pass under `-race` with no races. The full activator and host packages pass, as do the census and the cross-builds; 0 units are unclaimed. Concerns: - The test fixture envB now differs from envA only in an editable line, since rewriting a token is a conflict now. - TestLaunchPublishesItsOwnCapture therefore swaps in an editable line instead of the brief's "token B". Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/durability-3a/.superpowers/sdd/2026-10-30-durability-step3-escrow-fence-restore/task-4-report.md</result> <usage><subagent_tokens>720116</subagent_tokens><tool_uses>12</tool_uses><duration_ms>757592</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bjrds5qyy</task-id> <tool-use-id>toolu_01Tvgs5yiD84stAvJy3pLJdy</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/bjrds5qyy.output</output-file> <status>completed</status> <summary>Background command "Wait for the round-3 re-review" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a7c852058e1257fab</task-id> <tool-use-id>toolu_01M9bDzNj5Vknj55kQWCqjNv</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/a7c852058e1257fab.output</output-file> <status>completed</status> <summary>Agent "Task 4 fix round 4 (fresh, fable)" is waiting on its own background work</summary> <note>This agent stopped with background work of its own still running. It may resume on its own when that work completes or reports, and the same task-id notifies again if it does; the result below may be interim.</note> <result>Nothing else can proceed until the serial test run finishes (the census run must not overlap it, and the report needs its output), so I'm waiting for the background task's completion notice.</result> <usage><subagent_tokens>163525</subagent_tokens><tool_uses>45</tool_uses><duration_ms>676527</duration_ms></usage> </task-notification>

Attributed to this commit: 74.9 g CO₂e (4,117,894 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on durability-3a-escrow, 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-durability-3a-escrow-claims.md b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
index 06543e655..6ddb47b3c 100644
--- a/docs/superpowers/notes/census-durability-3a-escrow-claims.md
+++ b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
@@ -36,19 +36,19 @@ internal/host/schedule_wiring.go:scheduleHostEscrowed durability 3a Task 4: sche
internal/host/escrow_loop.go:escrowLoop durability 3a Task 4: new: every activator.EscrowEvery (30 s) lists the registry and runs svc.EscrowSweep over the rows; logs failures and deferrals; returns with no registry or no Service; the agent as carlos (carlos-edge.service), no root caller
internal/activator/escrow.go:ExecBackend.EscrowSweep durability 3a Task 4: new, the agent as carlos (carlos-edge.service), no root caller, from escrowLoop: classifies each row against the rows handed in (Classify), keeps eligible rows known not HA from memory (haKnown, no read), and in host order from a round-robin cursor stats each escrowed file (stampAt) and publishes the changed ones, 8 at a time, at most 256 a sweep (sweepPublish); a box without a files store or key does nothing; opens nothing outside the rows' own data directories; writes only the hibernate bucket's files/0 prefix and the ledger Fix round 1: a host whose instance lease this box does not hold (holdsLease) is skipped, and one with a conflict marker counts as failing and is not published; the report is tallied through one lock (P1-4).
internal/activator/escrow.go:ExecBackend.SecretsEscrowed durability 3a Task 4: new: haHostNow or escrowEligible; reads only what the HA classification already reads
-internal/activator/escrow.go:ExecBackend.escrowEnvOf durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady
+internal/activator/escrow.go:ExecBackend.escrowEnvOf durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady Fix round 4: a fetch that fails or an envelope that does not open wraps errEscrowUnreadable (no longer ErrEscrowNotReady); the same reads.
internal/activator/escrow.go:ExecBackend.escrowChanged durability 3a Task 4: new: compares each escrowed file's stamp (stampAt, beneath the row's data directory) with the last kept one; reads no bytes Fix round 1 (P1-4): the stamps are copied under the escrow mutex, entry by entry, before they are compared; the same opens, no read added.
internal/activator/escrow.go:ExecBackend.escrowEligible durability 3a Task 4: new: escrowEligibleAt on pathsFor's classification
internal/activator/escrow.go:ExecBackend.escrowEligibleAt durability 3a Task 4: new: a pure predicate over the row and a classification: ActivatorManaged, not unit, sidecar, HA, replica, held, a valid host shape and app, flat or nested, on a box with a hibernate bucket; reads only row fields
internal/activator/escrow.go:ExecBackend.escrowMintGuard durability 3a Task 4: new: on a box that is not ready refuses every mint (ErrEscrowNotReady); otherwise, once and only when a producer would mint, bucketEscrowEnv, and refuses (ErrInstanceKeyDeferred) when the escrowed env holds the variable; a mint it allows is noted in memory; only refuses Fix round 0 (controller readiness ruling): with no files store it is nil, and the producer mints as before 3a; with a files store and no sealing key it reads the bucket manifest at the mint (keylessEscrowed, fresh) and refuses (ErrEscrowNotReady) when the bucket holds any sealed item or the cutover marker for the host, and otherwise lets the mint go ahead (logged once); only refuses. Fix round 1: with a key it refuses while the conflict marker exists or while this box does not hold the host's lease (ErrInstanceKeyDeferred); its bucket read is bucketManifest, the preparation's shared read unless fresh (the backfill); without a key its keyless read is the same, with no cache across launches (P1-3); only refuses. Fix round 2: no longer notes the mints it allows in memory; only refuses.
internal/activator/escrow.go:ExecBackend.escrowReady durability 3a Task 4: new: FilesStore and EscrowKey set and sealerFor succeeds; reads nothing
-internal/activator/escrow.go:ExecBackend.escrowReread durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses.
-internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback.
+internal/activator/escrow.go:ExecBackend.escrowReread durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses. Fix round 4: the re-read manifest feeds what this process knows (learnBucket) once it parses; a failed open wraps errEscrowUnreadable; the same reads.
+internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback. Fix round 4: a publish that answers errEscrowUnreadable or ErrEscrowNotReady (the manifest or sealed env could not be read, or does not open here) refuses the launch, never the later-launch fallback; only refuses.
internal/activator/escrow.go:ExecBackend.haKnown durability 3a Task 4: new: the HA classification from memory only (haWakes, haLegacyRoute, the row's mark, the lifetime index); reads nothing
-internal/activator/escrow.go:ExecBackend.openEscrowLocked durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads.
+internal/activator/escrow.go:ExecBackend.openEscrowLocked durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads. Fix round 4: only an open from the bucket feeds what this process knows (learnBucket); an open from the ledger feeds nothing; a failed open or an unparseable manifest wraps errEscrowUnreadable; the same reads.
internal/activator/escrow.go:ExecBackend.publishEscrow durability 3a Task 4: new: publishEscrowAt on pathsFor
internal/activator/escrow.go:ExecBackend.publishEscrowAt durability 3a Task 4: new: escrowReady and the layout checked, then publishEscrowLocked under the host's lock Fix round 1: refuses while the conflict marker exists or while this box does not hold the host's lease (P1-2), before anything is read.
-internal/activator/escrow.go:ExecBackend.publishEscrowLocked durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown).
+internal/activator/escrow.go:ExecBackend.publishEscrowLocked durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes.
internal/activator/escrow.go:ExecBackend.restoreEscrowIfMissing durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise.
internal/activator/escrow.go:ExecBackend.sweepPublish durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert
internal/activator/escrow.go:Service.EscrowSweep durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one
@@ -61,9 +61,9 @@ internal/activator/escrow.go:ExecBackend.escrowModeOf durability 3a Task 4 fix r
internal/activator/escrow.go:ExecBackend.escrowOff durability 3a Task 4 fix round 0: new: one log line per host per process saying escrow is off and why; reads nothing
internal/activator/escrow.go:ExecBackend.keylessEscrowed durability 3a Task 4 fix rounds 0-1: new, on a box with a files store and no sealing key: whether the bucket holds an escrow for the host (any sealed item or the cutover marker), from bucketManifest: the read of the launch preparation in progress, or one hostfiles.Load (one GET); nothing is cached across launches (fix round 1, P1-3); a failed read is an error and the caller refuses; the agent as carlos (carlos-edge.service), no root caller
internal/activator/backend_exec.go:ExecBackend.Acquire durability 3a Task 4 fix round 1: after a successful acquire, records the instance lease it hands out (escrow.noteLease, memory only), so the escrow can ask whether this box holds the host's lease; the same acquire, no read added; the agent as carlos (carlos-edge.service), no root caller
-internal/activator/escrow.go:ExecBackend.bucketManifest durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller
+internal/activator/escrow.go:ExecBackend.bucketManifest durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller Fix round 4: a manifest it reads is kept as what this process knows the bucket holds (learnBucket, the one writer of escrowState.known) and as the preparation's read; a failed read wraps errEscrowUnreadable; the same reads.
internal/activator/escrow.go:ExecBackend.escrowConflict durability 3a Task 4 fix round 1: new: os.Lstat of <data>/.escrow/<host>.conflict, the agent's own directory; present, every launch, mint and publish of the host is refused with an alert naming the file for an operator to remove; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 2: the alert text names the divergence generally (local secrets differ from the escrow); the same Lstat.
internal/activator/hasecrets.go:ExecBackend.mintGuardWith durability 3a Task 4 fix round 1: new: classifies the host (haHostNow; an error refuses) and returns mintGuardAs with fresh; only refuses
internal/activator/escrow.go:ExecBackend.escrowConflictFound durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 3: the alert names the env file too, since a platform-minted env variable can diverge; the same marker write.
internal/activator/escrow.go:ExecBackend.envDivergence durability 3a Task 4 fix round 3: new: opens the manifest's sealed env (escrowEnvOf, ReadSealed: one GET) and names each variable the activator mints into the env (CARLOS_ADMIN_TOKEN, CARLOS_INSTANCE_KEY) whose escrowed value the local bytes do not carry; reads nothing local itself; only refuses (through its callers); the agent as carlos (carlos-edge.service), no root caller
-internal/activator/escrow.go:ExecBackend.escrowDivergence durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller
+internal/activator/escrow.go:ExecBackend.escrowDivergence durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller Fix round 4: the trio is decided first, by digest, and a divergent trio file is the verdict before the sealed env is read; the same reads.
diff --git a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
index 00b4f2f51..184033836 100644
--- a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
+++ b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
@@ -66,7 +66,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/activator/escrow.go:ExecBackend.EscrowSweep`: reads +registry:Host ×12, +whole:Route ×17; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.SecretsEscrowed`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
-- new `internal/activator/escrow.go:ExecBackend.bucketManifest`: reads +file:Open, +registry:Host ×4, +whole:Route; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.bucketManifest`: reads +file:Open, +registry:Host ×3, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.envDivergence`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowChanged`: reads +registry:Host ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowConflict`: reads +file:Lstat; written legacy, accepted-legacy, frozen
@@ -80,7 +80,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/activator/escrow.go:ExecBackend.escrowOff`: reads +registry:Host ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowReady`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowReread`: reads +file:Open, +registry:Host ×4, +whole:Route ×3; written legacy, accepted-legacy, frozen
-- new `internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv`: reads +registry:Host ×20, +whole:Route ×14; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv`: reads +registry:Host ×21, +whole:Route ×14; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.haKnown`: reads +registry:HA, +registry:Host ×2, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.keylessEscrowed`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.openEscrowLocked`: reads +file:Open, +registry:Host ×2, +whole:Route; written legacy, accepted-legacy, frozen
@@ -108,6 +108,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/layout/inventory.go:Inventory`: reads +file:ReadDir; written legacy, accepted-legacy, frozen
- quiet `internal/layout/plan.go:NestedPlatformNames`: reads nothing now; retired while it reads nothing (or its row keeps no sites)
-Seal: `eaeb153ab7a7a849edc9c6e92f2ac5c709c6e39044a647971cf1fa5ebcb660c8` → `627375c2b812a7a486dc049160a51fa093388d97ada6a85ae9c9b4ce2e7d4a1f`.
+Seal: `eaeb153ab7a7a849edc9c6e92f2ac5c709c6e39044a647971cf1fa5ebcb660c8` → `55614674708c911a18e3568ba72c298e95784e6237df9907f80de553b3f1551a`.
Overlay: `internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/activator/escrow.go b/internal/activator/escrow.go
index 48d7d5eea..93dedc7d0 100644
--- a/internal/activator/escrow.go
+++ b/internal/activator/escrow.go
@@ -45,12 +45,21 @@ import (
// acquired (Acquire records it). A box that does not serve the host
// never replaces its escrow with its own local bytes.
// - The ledger (<data>/.escrow/<host>.json, the last committed manifest)
-// is a publication baseline, never recovery or mint evidence. A trio
-// file absent here is looked for in the bucket unless this process has
-// itself seen the bucket's manifest for the host without it (the first
-// such decision after a start reads once; P2-6). A missing env file,
-// and a mint, always read the bucket; one launch's preparation shares
-// that one read (escrowPrep).
+// is a publication baseline, never recovery or mint evidence. What this
+// process knows the bucket holds for a host has one source,
+// escrowState.known, fed only by learnBucket: a manifest this process
+// read from the bucket, or one a commit of this process actually
+// wrote. A ledger opened as a baseline, a no-op commit on it, a stage
+// never feed it (escrow_known_guard_test.go holds every writer to
+// this; fix round 4). A trio file absent here is looked for in the
+// bucket unless that source holds the host's manifest without it (the
+// first such decision after a start reads once; P2-6). A missing env
+// file, and a mint, always read the bucket; one launch's preparation
+// shares that one read (escrowPrep).
+// - A read of an escrowed host's manifest or sealed env that fails
+// refuses the launch (errEscrowUnreadable, fix round 4); the launch
+// never goes on as if the bucket had answered. The trio is held to the
+// escrow before any such read, by digest alone.
// - An escrowed instance.key or report.token, and each escrowed variable
// the activator mints into the env (CARLOS_ADMIN_TOKEN,
// CARLOS_INSTANCE_KEY), is write-once: a local copy that differs from
@@ -71,6 +80,13 @@ import (
// one whose escrow does not open with this box's key.
var ErrEscrowNotReady = errors.New("activator: this box cannot read or write the instance's sealed copy (no files store or no CARLOS_SECRETS_KEY)")
+// errEscrowUnreadable is a failure to read an escrowed host's manifest or
+// sealed env from the bucket (a fetch, an envelope that does not open, a
+// manifest that does not parse). For an escrowed host it refuses the
+// launch (fix round 4): the launch never goes on as if the read had
+// answered.
+var errEscrowUnreadable = errors.New("activator: the host's escrow in the bucket could not be read")
+
// errEscrowNoLease refuses an escrow publication or a mint on a box that
// does not hold the host's instance lease.
var errEscrowNoLease = errors.New("activator: this box does not hold the host's lease, so it neither escrows nor mints the host's secrets")
@@ -159,10 +175,11 @@ type escrowState struct {
// ledger could not be written after a commit).
fromBucket bool
// known is the host's manifest as this process last saw it in the
- // bucket: its own read, or its own commit. Nil until then. Only it, never
- // the ledger, decides that an escrowed trio file absent here need not be
- // looked for: ledger absence is never trusted across a process boundary
- // (fix round 3).
+ // bucket: its own read, or a commit of its own that wrote. Nil until
+ // then. Only learnBucket sets it (escrow_known_guard_test.go), and only
+ // it, never the ledger, decides that an escrowed trio file absent here
+ // need not be looked for: ledger absence is never trusted across a
+ // process boundary (fix rounds 3 and 4).
known *hostfiles.Manifest
// prep is the preparation in progress, nil between launches.
prep *escrowPrep
@@ -269,24 +286,34 @@ func (b *ExecBackend) prepRead(host string) (m hostfiles.Manifest, found, ok boo
return m, found, ok
}
-// notePrepRead keeps m as the preparation's read, and as what this process
-// knows the bucket holds.
-func (b *ExecBackend) notePrepRead(host string, m hostfiles.Manifest, found bool) {
- st := b.escrow.state(host)
+// notePrepRead keeps m, a manifest just read from the bucket, as the
+// preparation's read.
+func (b *ExecBackend) notePrepRead(st *escrowState, m hostfiles.Manifest, found bool) {
b.escrow.with(func() {
- known := m
- st.known = &known
if st.prep != nil {
st.prep.read, st.prep.m, st.prep.found = true, m, found
}
})
}
+// learnBucket keeps m as what this process knows the bucket holds for
+// st's host (escrowState.known). It is the one writer of that knowledge,
+// and it is called from exactly two kinds of place: after a read of the
+// host's manifest from the bucket in this process (bucketManifest,
+// openEscrowLocked's open from the bucket, escrowReread), and after a
+// commit of this process that actually wrote (publishEscrowLocked). A
+// ledger opened as a baseline, a commit that wrote nothing and a stage
+// never reach it: escrow_known_guard_test.go holds the package to that.
+func (b *ExecBackend) learnBucket(st *escrowState, m hostfiles.Manifest) {
+ b.escrow.with(func() { st.known = &m })
+}
+
// bucketManifest is rt's files manifest as the bucket holds it: the
// preparation's read when there is one and fresh is false, else one GET.
// With a sealing key the read opens the host's publisher on it
// (hostfiles.Open), so the launch's publish continues from it with no
-// second read; without one it is a plain load.
+// second read; without one it is a plain load. A read that fails is
+// errEscrowUnreadable.
func (b *ExecBackend) bucketManifest(ctx context.Context, rt registry.Route, fresh bool) (hostfiles.Manifest, bool, error) {
if !fresh {
if m, found, ok := b.prepRead(rt.Host); ok {
@@ -294,32 +321,33 @@ func (b *ExecBackend) bucketManifest(ctx context.Context, rt registry.Route, fre
}
}
prefix := b.filesPrefix(rt.Host)
+ st := b.escrow.state(rt.Host)
var (
m hostfiles.Manifest
found bool
)
if seal, err := b.sealerFor(rt); err == nil {
- st := b.escrow.state(rt.Host)
st.op.Lock()
pub, err := hostfiles.Open(ctx, b.FilesStore, prefix)
if err != nil {
st.op.Unlock()
- return m, false, fmt.Errorf("read the bucket for the host's escrow: %w", err)
+ return m, false, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
}
b.escrow.install(st, pub, seal)
st.op.Unlock()
base := pub.Baseline()
if m, err = baselineManifest(base); err != nil {
- return m, false, err
+ return m, false, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
}
found = base.Found
} else {
var err error
if m, found, err = hostfiles.Load(ctx, b.FilesStore, prefix); err != nil {
- return m, false, fmt.Errorf("read the bucket for the host's escrow: %w", err)
+ return m, false, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
}
}
- b.notePrepRead(rt.Host, m, found)
+ b.learnBucket(st, m)
+ b.notePrepRead(st, m, found)
return m, found, nil
}
@@ -617,24 +645,18 @@ func (b *ExecBackend) openEscrowLocked(ctx context.Context, rt registry.Route, s
}
if pub == nil {
if pub, err = hostfiles.Open(ctx, b.FilesStore, prefix); err != nil {
- return nil, nil, fmt.Errorf("read the escrow: %w", err)
+ return nil, nil, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
+ }
+ m, err := baselineManifest(pub.Baseline())
+ if err != nil {
+ return nil, nil, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
}
- b.noteKnown(st, pub.Baseline())
+ b.learnBucket(st, m)
}
b.escrow.install(st, pub, seal)
return pub, seal, nil
}
-// noteKnown keeps base, a manifest this process read from the bucket or
-// committed itself, as what it knows the bucket holds.
-func (b *ExecBackend) noteKnown(st *escrowState, base hostfiles.Baseline) {
- m, err := baselineManifest(base)
- if err != nil {
- return
- }
- b.escrow.with(func() { st.known = &m })
-}
-
// escrowPublish is one publish's outcome: the manifest the publisher holds
// after it (committed, or as it was), whether this publish committed
// anything, and whether the host has a committed escrow.
@@ -771,7 +793,7 @@ func (b *ExecBackend) publishEscrowLocked(ctx context.Context, rt registry.Route
// whether or not the marker could be written.
m, err := baselineManifest(before)
if err != nil {
- return out, err
+ return out, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
}
if diverged, err := b.escrowDivergence(ctx, rt, m, reads, seal); err != nil {
return out, err
@@ -817,10 +839,20 @@ func (b *ExecBackend) publishEscrowLocked(ctx context.Context, rt registry.Route
out.base, out.exists = after, escrowedIn(after)
out.committed = before.ETag != after.ETag || before.Found != after.Found
keep()
- b.noteKnown(st, after)
- if out.committed {
- b.keepLedger(rt.Host, st, after)
+ if !out.committed {
+ // Nothing was written (the staged bytes were already escrowed), so
+ // nothing was learned about the bucket: a publisher opened from the
+ // ledger has only the ledger's word, which is never knowledge.
+ return out, errors.Join(refused...)
}
+ // A commit that wrote: the compare-and-swap held, so the bucket was at
+ // this publisher's baseline and now holds what it committed.
+ wrote, err := baselineManifest(after)
+ if err != nil {
+ return out, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
+ }
+ b.learnBucket(st, wrote)
+ b.keepLedger(rt.Host, st, after)
return out, errors.Join(refused...)
}
@@ -832,24 +864,32 @@ var escrowMintedVars = []string{"CARLOS_ADMIN_TOKEN", InstanceKeyVar}
// escrowDivergence names what this publish would replace in the escrow m
// holds with other bytes. An escrowed instance.key or report.token is
-// write-once (fix round 2), decided by its keyed digest with no request.
-// So is each escrowed minted variable of the env (escrowMintedVars): when
-// the env itself changed (its digest differs) the sealed env is read (one
-// GET) and a minted variable whose local value is not the escrowed one,
-// missing included, diverges.
+// write-once (fix round 2), decided by its keyed digest with no request,
+// and decided first: a divergent trio file is the verdict before any read
+// of the bucket is attempted (fix round 4). So is each escrowed minted
+// variable of the env (escrowMintedVars): when the env itself changed (its
+// digest differs) the sealed env is read (one GET) and a minted variable
+// whose local value is not the escrowed one, missing included, diverges.
func (b *ExecBackend) escrowDivergence(ctx context.Context, rt registry.Route, m hostfiles.Manifest, reads []escrowRead, seal *hostfiles.ItemSealer) ([]string, error) {
- var diverged []string
- for _, r := range reads {
+ changed := func(r escrowRead) bool {
if !r.stage {
- continue
+ return false
}
item := r.rel.Item()
e, ok := m.Platform[item]
- if !ok || e.Sealed == "" || e.PlainMAC == seal.MAC(item, r.plain) {
- continue
- }
- if item != hostfiles.SealedEnvItem {
+ return ok && e.Sealed != "" && e.PlainMAC != seal.MAC(item, r.plain)
+ }
+ var diverged []string
+ for _, r := range reads {
+ if r.rel.Item() != hostfiles.SealedEnvItem && changed(r) {
diverged = append(diverged, r.rel.Rel())
+ }
+ }
+ if len(diverged) > 0 {
+ return diverged, nil
+ }
+ for _, r := range reads {
+ if r.rel.Item() != hostfiles.SealedEnvItem || !changed(r) {
continue
}
d, err := b.envDivergence(ctx, rt, m, r.plain)
@@ -1118,7 +1158,9 @@ func (b *ExecBackend) escrowMintGuard(ctx context.Context, rt registry.Route, fr
}
}
-// escrowEnvOf opens m's sealed env item, found false when m holds none.
+// escrowEnvOf opens m's sealed env item, found false when m holds none. A
+// fetch that fails, or an envelope that does not open here, is
+// errEscrowUnreadable: the caller never goes on as if it had read it.
func (b *ExecBackend) escrowEnvOf(ctx context.Context, rt registry.Route, m hostfiles.Manifest) ([]byte, bool, error) {
if _, ok := m.Platform[hostfiles.SealedEnvItem]; !ok {
return nil, false, nil
@@ -1129,7 +1171,7 @@ func (b *ExecBackend) escrowEnvOf(ctx context.Context, rt registry.Route, m host
}
plain, err := hostfiles.ReadSealed(ctx, b.FilesStore, b.filesPrefix(rt.Host), m, hostfiles.SealedEnvItem, nil, seal)
if err != nil {
- return nil, false, fmt.Errorf("%w: the escrow in the bucket does not open here: %v", ErrEscrowNotReady, err)
+ return nil, false, fmt.Errorf("%w: the sealed env: %w", errEscrowUnreadable, err)
}
return plain, true, nil
}
@@ -1154,19 +1196,19 @@ func (b *ExecBackend) escrowReread(ctx context.Context, rt registry.Route, p ins
}
pub, err := hostfiles.Open(ctx, b.FilesStore, b.filesPrefix(rt.Host))
if err != nil {
- return fmt.Errorf("escrow: read the bucket again: %w", err)
+ return fmt.Errorf("%w: read again: %w", errEscrowUnreadable, err)
+ }
+ m, err := baselineManifest(pub.Baseline())
+ if err != nil {
+ return fmt.Errorf("%w: %w", errEscrowUnreadable, err)
}
b.escrow.install(st, pub, seal)
- b.noteKnown(st, pub.Baseline())
+ b.learnBucket(st, m)
if escrowHooks.afterReread != nil {
escrowHooks.afterReread(rt.Host)
}
// Before the preparation runs again: a minted variable the bucket now
// escrows with another value is a conflict (fix round 3).
- m, err := baselineManifest(pub.Baseline())
- if err != nil {
- return err
- }
local, absent, err := instancefs.ReadBeneathLimitOrAbsent(p.dataDir, rt.Host+".env", haEnvReadLimit)
if err != nil {
return fmt.Errorf("escrow: read the env file: %w", err)
@@ -1195,8 +1237,11 @@ func (b *ExecBackend) escrowReread(ctx context.Context, rt registry.Route, p ins
// commit lands, acknowledged (SealedAcknowledged), and the env parsed from
// them handed back. A publish that meets another writer reads the bucket
// again and starts the preparation over from the restore, once; a second
-// one fails the launch with an alert. A failed write holds only a first
-// launch (a host never escrowed).
+// one fails the launch with an alert. A publish that could not read the
+// host's manifest or sealed env from the bucket, or whose escrow does not
+// open here, refuses the launch (fix round 4): an escrowed host is never
+// launched on the local files alone because the bucket did not answer. A
+// failed write holds only a first launch (a host never escrowed).
func (b *ExecBackend) escrowedLaunchEnv(ctx context.Context, rt registry.Route) (map[string]string, instancekey.Layer, error) {
defer b.endPrep(rt.Host)
for attempt := 0; ; attempt++ {
@@ -1259,6 +1304,11 @@ func (b *ExecBackend) escrowedLaunchEnv(ctx context.Context, rt registry.Route)
// The lease was lost on the way to the commit, and nothing was
// committed: this box no longer serves the host.
return nil, instancekey.LayerNone, fmt.Errorf("secrets for %s: the host's lease was lost before its escrow was committed, so it is not launched here: %w", rt.Host, err)
+ case errors.Is(err, errEscrowUnreadable), errors.Is(err, ErrEscrowNotReady):
+ // The bucket did not answer, or its escrow does not open here:
+ // fail closed. The local files are not launched on the strength
+ // of a read that never happened.
+ return nil, instancekey.LayerNone, fmt.Errorf("secrets for %s: the launch is refused rather than go on without the host's escrow: %w", rt.Host, err)
case err != nil && !r.exists:
return nil, instancekey.LayerNone, fmt.Errorf("secrets for %s: escrow the host's secrets before its first launch: %w", rt.Host, err)
case err != nil:
diff --git a/internal/activator/escrow_known_guard_test.go b/internal/activator/escrow_known_guard_test.go
new file mode 100644
index 000000000..49fa237bb
--- /dev/null
+++ b/internal/activator/escrow_known_guard_test.go
@@ -0,0 +1,253 @@
+package activator
+
+// Durability 3a, Task 4, fix round 4: what this process knows the bucket
+// holds for an escrowed host has one source, escrowState.known, and that
+// source is fed by exactly one function, learnBucket, which is called only
+// after a read of the host's manifest from the bucket in this process or
+// after a commit of this process that actually wrote. The stale-ledger
+// family recurred twice because other paths (a ledger opened as a
+// baseline, a no-op commit on it) came to feed it. This guard is
+// structural, in the style of the package's other invariant guards: over
+// every non-test source of the package,
+//
+// - the field named known is assigned, incremented or address-taken only
+// inside ExecBackend.learnBucket, and never set in a composite literal;
+// - learnBucket is only ever called, never taken as a method value, and
+// only from the functions in learnBucketCallers;
+// - each of those callers exists and does call it, so the table cannot
+// rot.
+//
+// An inline fixture proves the check reports each kind of violation.
+
+import (
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "os"
+ "path/filepath"
+ "slices"
+ "sort"
+ "strings"
+ "testing"
+)
+
+// knownField is the field, and knownWriter the only function that writes
+// it.
+const (
+ knownField = "known"
+ knownWriter = "ExecBackend.learnBucket"
+)
+
+// learnBucketCallers are the only functions that may call learnBucket:
+// each does so after a bucket read of its own (the first three) or after a
+// commit that wrote (publishEscrowLocked). Rows are only added, each with
+// its read or its write before the call.
+var learnBucketCallers = []string{
+ "ExecBackend.bucketManifest",
+ "ExecBackend.openEscrowLocked",
+ "ExecBackend.escrowReread",
+ "ExecBackend.publishEscrowLocked",
+}
+
+// knownGuardOwner names d: Type.Method for a method, the function's name
+// otherwise.
+func knownGuardOwner(fn *ast.FuncDecl) string {
+ if fn.Recv == nil || len(fn.Recv.List) != 1 {
+ return fn.Name.Name
+ }
+ t := fn.Recv.List[0].Type
+ if s, ok := t.(*ast.StarExpr); ok {
+ t = s.X
+ }
+ if id, ok := t.(*ast.Ident); ok {
+ return id.Name + "." + fn.Name.Name
+ }
+ return fn.Name.Name
+}
+
+// knownViolations lists every departure from the invariant in files, each
+// as "<owner>: <what>", sorted. callers is learnBucketCallers in
+// production.
+func knownViolations(files []*ast.File, callers []string) []string {
+ allowed := map[string]bool{}
+ for _, c := range callers {
+ allowed[c] = true
+ }
+ var bad []string
+ calledFrom := map[string]bool{}
+ writerSeen := false
+ isKnown := func(e ast.Expr) bool {
+ s, ok := e.(*ast.SelectorExpr)
+ return ok && s.Sel.Name == knownField
+ }
+ inspect := func(owner string, n ast.Node) {
+ ast.Inspect(n, func(n ast.Node) bool {
+ switch x := n.(type) {
+ case *ast.AssignStmt:
+ for _, l := range x.Lhs {
+ if isKnown(l) && owner != knownWriter {
+ bad = append(bad, owner+": assigns "+knownField+" outside "+knownWriter)
+ }
+ }
+ case *ast.IncDecStmt:
+ if isKnown(x.X) && owner != knownWriter {
+ bad = append(bad, owner+": changes "+knownField+" outside "+knownWriter)
+ }
+ case *ast.UnaryExpr:
+ if x.Op == token.AND && isKnown(x.X) && owner != knownWriter {
+ bad = append(bad, owner+": takes the address of "+knownField+" outside "+knownWriter)
+ }
+ case *ast.CompositeLit:
+ for _, el := range x.Elts {
+ if kv, ok := el.(*ast.KeyValueExpr); ok {
+ if id, ok := kv.Key.(*ast.Ident); ok && id.Name == knownField {
+ bad = append(bad, owner+": sets "+knownField+" in a composite literal")
+ }
+ }
+ }
+ case *ast.CallExpr:
+ if s, ok := x.Fun.(*ast.SelectorExpr); ok && s.Sel.Name == "learnBucket" {
+ calledFrom[owner] = true
+ if !allowed[owner] {
+ bad = append(bad, owner+": calls learnBucket, which only "+strings.Join(callers, ", ")+" may")
+ }
+ }
+ }
+ return true
+ })
+ }
+ // A method value (b.learnBucket not called) could hand the writer to
+ // anyone: every selector naming it must be a call's function.
+ methodValues := func(owner string, n ast.Node) {
+ calls := map[*ast.SelectorExpr]bool{}
+ ast.Inspect(n, func(n ast.Node) bool {
+ if c, ok := n.(*ast.CallExpr); ok {
+ if s, ok := c.Fun.(*ast.SelectorExpr); ok {
+ calls[s] = true
+ }
+ }
+ return true
+ })
+ ast.Inspect(n, func(n ast.Node) bool {
+ if s, ok := n.(*ast.SelectorExpr); ok && s.Sel.Name == "learnBucket" && !calls[s] {
+ bad = append(bad, owner+": takes learnBucket as a method value")
+ }
+ return true
+ })
+ }
+ for _, f := range files {
+ for _, d := range f.Decls {
+ owner := "<package level>"
+ if fn, ok := d.(*ast.FuncDecl); ok {
+ owner = knownGuardOwner(fn)
+ if owner == knownWriter {
+ writerSeen = true
+ }
+ }
+ inspect(owner, d)
+ methodValues(owner, d)
+ }
+ }
+ if !writerSeen {
+ bad = append(bad, knownWriter+": not found")
+ }
+ for _, c := range callers {
+ if !calledFrom[c] {
+ bad = append(bad, c+": listed in learnBucketCallers but never calls learnBucket")
+ }
+ }
+ sort.Strings(bad)
+ return bad
+}
+
+// TestEscrowKnownHasOneWriter holds the package to the invariant.
+func TestEscrowKnownHasOneWriter(t *testing.T) {
+ fset := token.NewFileSet()
+ names, err := filepath.Glob("*.go")
+ if err != nil {
+ t.Fatal(err)
+ }
+ var files []*ast.File
+ for _, name := range names {
+ if strings.HasSuffix(name, "_test.go") {
+ continue
+ }
+ src, err := os.ReadFile(name)
+ if err != nil {
+ t.Fatal(err)
+ }
+ f, err := parser.ParseFile(fset, name, src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ files = append(files, f)
+ }
+ if len(files) == 0 {
+ t.Fatal("no sources")
+ }
+ if bad := knownViolations(files, learnBucketCallers); len(bad) != 0 {
+ t.Fatalf("escrowState.known has more than one source:\n %s", strings.Join(bad, "\n "))
+ }
+}
+
+// TestEscrowKnownGuardReportsEachViolation proves the check on a fixture:
+// every way of feeding known or of reaching learnBucket from elsewhere is
+// reported, and a clean source is not.
+func TestEscrowKnownGuardReportsEachViolation(t *testing.T) {
+ const fixture = `package activator
+
+type manifest struct{}
+
+type escrowState struct{ known *manifest }
+
+type ExecBackend struct{}
+
+func (b *ExecBackend) learnBucket(st *escrowState, m manifest) { st.known = &m }
+
+func (b *ExecBackend) bucketManifest(st *escrowState) { b.learnBucket(st, manifest{}) }
+
+func (b *ExecBackend) openEscrowLocked(st *escrowState) { b.learnBucket(st, manifest{}) }
+
+func (b *ExecBackend) escrowReread(st *escrowState) { b.learnBucket(st, manifest{}) }
+
+func (b *ExecBackend) publishEscrowLocked(st *escrowState) { b.learnBucket(st, manifest{}) }
+
+func (b *ExecBackend) sweepPublish(st *escrowState) { b.learnBucket(st, manifest{}) }
+
+func (b *ExecBackend) fromLedger(st *escrowState, m manifest) { st.known = &m }
+
+func (b *ExecBackend) viaClosure(st *escrowState, m manifest) { f := func() { st.known = &m }; f() }
+
+func (b *ExecBackend) viaPointer(st *escrowState) **manifest { return &st.known }
+
+func fresh() *escrowState { return &escrowState{known: nil} }
+
+func (b *ExecBackend) handOut() func(*escrowState, manifest) { return b.learnBucket }
+
+var zz = func(st *escrowState, m manifest) { st.known = &m }
+`
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, "fixture.go", fixture, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ want := []string{
+ "<package level>: assigns known outside ExecBackend.learnBucket",
+ "ExecBackend.fromLedger: assigns known outside ExecBackend.learnBucket",
+ "ExecBackend.handOut: takes learnBucket as a method value",
+ "ExecBackend.sweepPublish: calls learnBucket, which only " + strings.Join(learnBucketCallers, ", ") + " may",
+ "ExecBackend.viaClosure: assigns known outside ExecBackend.learnBucket",
+ "ExecBackend.viaPointer: takes the address of known outside ExecBackend.learnBucket",
+ "fresh: sets known in a composite literal",
+ }
+ sort.Strings(want)
+ got := knownViolations([]*ast.File{f}, learnBucketCallers)
+ if strings.Join(got, "\n") != strings.Join(want, "\n") {
+ t.Fatalf("fixture reports:\n %s\nwant:\n %s", strings.Join(got, "\n "), strings.Join(want, "\n "))
+ }
+ // A caller listed but silent is reported too.
+ got = knownViolations([]*ast.File{f}, append(append([]string(nil), learnBucketCallers...), "ExecBackend.silent"))
+ if !slices.Contains(got, "ExecBackend.silent: listed in learnBucketCallers but never calls learnBucket") {
+ t.Fatalf("a silent caller was not reported:\n %s", strings.Join(got, "\n "))
+ }
+}
diff --git a/internal/activator/escrow_test.go b/internal/activator/escrow_test.go
index 6d8ff954e..e6a63d704 100644
--- a/internal/activator/escrow_test.go
+++ b/internal/activator/escrow_test.go
@@ -1394,3 +1394,127 @@ func TestDivergentEnvMintRefusedWithoutAMarker(t *testing.T) {
t.Fatalf("escrowed env %q", got)
}
}
+
+// Stale ledger, Astra's reproduction (round 3): both ledger operations
+// fail, the agent restarts, and a sweep runs while the wake holds the
+// host's lease and before its preparation restores (the sweep loop runs
+// beside every wake). The sweep opens from the stale ledger, which lacks
+// the key, and commits nothing: a no-op that must never become evidence
+// about what the bucket holds. The preparation that follows, with the key
+// missing, restores it from the bucket.
+func TestStaleLedgerAndANoOpSweepNeverSuppressARestore(t *testing.T) {
+ ctx := context.Background()
+ b, rt := escrowBackend(t, escrowHost)
+ writeEnv(t, b, rt, envA)
+ mustPublish(t, b, rt)
+ writeFiles(t, b, rt, map[string]string{"instance.key": "ik-1"})
+ oldW, oldR := writeEscrowLedger, removeEscrowLedger
+ writeEscrowLedger = func(string, string, hostfiles.Baseline) error { return errors.New("disk full") }
+ removeEscrowLedger = func(string, string) error { return errors.New("read-only") }
+ mustPublish(t, b, rt)
+ writeEscrowLedger, removeEscrowLedger = oldW, oldR
+ if got := sealedItem(t, b, rt, "instance.key.sealed"); got != "ik-1" {
+ t.Fatalf("fixture: escrowed key %q", got)
+ }
+ base, ok := readEscrowLedger(b.DataDir, rt.Host)
+ if !ok {
+ t.Fatal("fixture: the stale ledger is gone")
+ }
+ if m, err := baselineManifest(base); err != nil || m.Platform["instance.key.sealed"].Sealed != "" {
+ t.Fatalf("fixture: the ledger holds the key (%v)", err)
+ }
+ nb := restartEscrow(t, b)
+ holdLease(t, nb, rt)
+ if err := os.Remove(filepath.Join(filesDirOf(nb, rt), "instance.key")); err != nil {
+ t.Fatal(err)
+ }
+ store := &countingStore{Store: nb.FilesStore}
+ nb.FilesStore = store
+ if rep := nb.EscrowSweep(ctx, []registry.Route{rt}); rep.Published != 0 || len(rep.Failing) != 0 {
+ t.Fatalf("the sweep: %+v", rep)
+ }
+ if store.gets.Load() != 0 {
+ t.Fatalf("fixture: the sweep read the bucket (%d gets); it must open from the stale ledger", store.gets.Load())
+ }
+ if _, err := nb.launchEnvForTest(rt); err != nil {
+ t.Fatalf("launch: %v", err)
+ }
+ if got := readFile(t, nb, rt, "instance.key"); got != "ik-1" {
+ t.Fatalf("instance.key %q, want the escrowed one", got)
+ }
+}
+
+// objectGetsFail is a files store whose object fetches fail while failing
+// is set; the manifest still reads.
+type objectGetsFail struct {
+ release.Store
+ failing atomic.Bool
+}
+
+func (s *objectGetsFail) Get(ctx context.Context, key string) ([]byte, string, error) {
+ if s.failing.Load() && strings.Contains(key, "objects/") {
+ return nil, "", errors.New("store unavailable")
+ }
+ return s.Store.Get(ctx, key)
+}
+
+// Round 4: an edited env beside a divergent instance.key, with the sealed
+// env unreadable. The trio is held to the escrow first, with no env read,
+// so the launch is refused as a conflict, marker and all, and the escrow
+// keeps its key.
+func TestDivergentTrioRefusedWhenTheSealedEnvCannotBeRead(t *testing.T) {
+ b, rt := escrowBackend(t, escrowHost)
+ writeEnv(t, b, rt, envA)
+ writeFiles(t, b, rt, map[string]string{"instance.key": "ik-1"})
+ mustPublish(t, b, rt)
+ store := &objectGetsFail{Store: b.FilesStore}
+ b.FilesStore = store
+ store.failing.Store(true)
+ writeEnv(t, b, rt, envA+"SHOP_MODE=x\n")
+ writeFiles(t, b, rt, map[string]string{"instance.key": "ik-2"})
+ marker := escrowConflictPath(b.DataDir, rt.Host)
+ _, err := b.launchEnvForTest(rt)
+ if err == nil || !strings.Contains(err.Error(), "ALERT: ") || !strings.Contains(err.Error(), "instance.key") || !exists(marker) {
+ t.Fatalf("the launch with a divergent key and an unreadable sealed env: %v (marker %v)", err, exists(marker))
+ }
+ store.failing.Store(false)
+ if got := sealedItem(t, b, rt, "instance.key.sealed"); got != "ik-1" {
+ t.Fatalf("escrowed key %q, want the first", got)
+ }
+ if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != envA {
+ t.Fatalf("escrowed env %q, want A", got)
+ }
+}
+
+// Round 4, fail closed: an escrowed host whose sealed env cannot be read
+// when its publish needs it (an edited env) is refused, never launched on
+// the later-launch fallback, and no conflict is recorded. Once the store
+// answers again the launch goes ahead and the edit is escrowed.
+func TestUnreadableEscrowRefusesTheLaunch(t *testing.T) {
+ ctx := context.Background()
+ b, rt := escrowBackend(t, escrowHost)
+ writeEnv(t, b, rt, envA)
+ mustPublish(t, b, rt)
+ store := &objectGetsFail{Store: b.FilesStore}
+ b.FilesStore = store
+ store.failing.Store(true)
+ writeEnv(t, b, rt, envA+"SHOP_MODE=x\n")
+ marker := escrowConflictPath(b.DataDir, rt.Host)
+ if _, err := b.launchEnvForTest(rt); !errors.Is(err, errEscrowUnreadable) || exists(marker) {
+ t.Fatalf("the launch with an unreadable sealed env: %v (marker %v)", err, exists(marker))
+ }
+ if rep := b.EscrowSweep(ctx, []registry.Route{rt}); rep.Published != 0 || len(rep.Failing) != 1 {
+ t.Fatalf("the sweep: %+v", rep)
+ }
+ store.failing.Store(false)
+ if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != envA {
+ t.Fatalf("escrowed env %q, want A untouched", got)
+ }
+ env, err := b.launchEnvForTest(rt)
+ if err != nil || env["SHOP_MODE"] != "x" {
+ t.Fatalf("the launch with the store back: %v, SHOP_MODE %q", err, env["SHOP_MODE"])
+ }
+ if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != envA+"SHOP_MODE=x\n" {
+ t.Fatalf("escrowed env %q", got)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index e740d81e9..d1f8f0dd5 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -45,4 +45,4 @@ plan14-root-reads-fleet-public-routes.tsv bca6ef741a96b72767b1747789cd01b3111d61
plan14-root-reads-fleet-routes-followups.tsv 1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7
plan14-root-reads-tunnel-websockets.tsv 949bc734a293366e6b2700244af5110dd6e84b5432023e991c09e806afd62483
plan14-root-reads-console-protection-tab.tsv eaeb153ab7a7a849edc9c6e92f2ac5c709c6e39044a647971cf1fa5ebcb660c8
-plan14-root-reads-durability-3a-escrow.tsv 627375c2b812a7a486dc049160a51fa093388d97ada6a85ae9c9b4ce2e7d4a1f
+plan14-root-reads-durability-3a-escrow.tsv 55614674708c911a18e3568ba72c298e95784e6237df9907f80de553b3f1551a
diff --git a/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv b/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
index 598738b74..c5e4d5534 100644
--- a/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
+++ b/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
@@ -11,27 +11,27 @@
@legacy 2106e0d304d6aa9b8426ae43bd49dd44a18c101e7bed4a8d496dc3cdeb94ef3a internal/hostfiles/restore.go Restore legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Restore delegates to shared descriptor-root implementation; generic payload restoration remains legacy.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: passes nil for restore's new baseline argument; the one site unchanged, nothing else changed;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3 fix round 1: passes nil for restore's new shadowed argument, so it fetches, writes and removes exactly what it did; the same reads. restore gains that argument (a caller's Shadowed func over the manifest it has already read and validated): a live entry it names, after the overlap rule, is skipped before any fetch and reported in RestoreStats.Shadowed. It only leaves things out; nothing new is opened, read or followed. RestoreRootBaselineShadowed is new, RestoreRootBaseline is it with nil. file:OpenRoot@219 6a3b0e25de6d9ff6e644810d70a7056840e6cca7fa72db98542f990d4598fd30
@legacy 64a0a282f5729c49a65c572b8af2c81c58ae0edff176220c0ddf892be8b27204 internal/activator/escrow.go ExecBackend.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the agent as carlos (carlos-edge.service), no root caller, from escrowLoop: classifies each row against the rows handed in (Classify), keeps eligible rows known not HA from memory (haKnown, no read), and in host order from a round-robin cursor stats each escrowed file (stampAt) and publishes the changed ones, 8 at a time, at most 256 a sweep (sweepPublish); a box without a files store or key does nothing; opens nothing outside the rows' own data directories; writes only the hibernate bucket's files/0 prefix and the ledger Fix round 1: a host whose instance lease this box does not hold (holdsLease) is skipped, and one with a conflict marker counts as failing and is not published; the report is tallied through one lock (P1-4). registry:Host@1079,registry:Host@1098,registry:Host@1249,registry:Host@1782,registry:Host@2128,registry:Host@2385,registry:Host@2459,registry:Host@536,registry:Host@761,registry:Host@795,registry:Host@833,registry:Host@923,whole:Route@1001,whole:Route@1088,whole:Route@1107,whole:Route@1258,whole:Route@1576,whole:Route@1784,whole:Route@2014,whole:Route@2130,whole:Route@2387,whole:Route@2461,whole:Route@356,whole:Route@519,whole:Route@587,whole:Route@653,whole:Route@706,whole:Route@980,whole:Route@984 c3067eb671bdbba75100a0398840a1c293fb55b777e155703169d3ae2e71ccd2
@legacy 90f2d51840159dd44037a8eb60115e037f27c635d74652028b368bda6fcd35b8 internal/activator/escrow.go ExecBackend.SecretsEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: haHostNow or escrowEligible; reads only what the HA classification already reads whole:Route@123,whole:Route@198 c22d35df72f67d7222efd0b0f09d51c42275ad4a10d637598fdc8b822f6333bd
-@legacy c7e39531f926452a19521b0399f157fa65ea04f015d2c185cee19cb585f07bab internal/activator/escrow.go ExecBackend.bucketManifest legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller file:Open@408,registry:Host@170,registry:Host@241,registry:Host@370,registry:Host@954,whole:Route@329 a993cc65cd23b5568160c431ee28184109ad4375e9099a31cde921dd0e3fa379
+@legacy 970a6723774a046c49c0ccf43f56363f6bd1c422721b668a3598fa29a973bdba internal/activator/escrow.go ExecBackend.bucketManifest legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller Fix round 4: a manifest it reads is kept as what this process knows the bucket holds (learnBucket, the one writer of escrowState.known) and as the preparation's read; a failed read wraps errEscrowUnreadable; the same reads. file:Open@407,registry:Host@170,registry:Host@241,registry:Host@272,whole:Route@360 1442be94eb93bb9c65a32a8f2f338573bf0797e048109386d7c227262cf2cdb9
@legacy e09ff3985fbdf89d3d133238891b9b20a32ed82155e249c81218579816b4fd5a internal/activator/escrow.go ExecBackend.envDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 3: new: opens the manifest's sealed env (escrowEnvOf, ReadSealed: one GET) and names each variable the activator mints into the env (CARLOS_ADMIN_TOKEN, CARLOS_INSTANCE_KEY) whose escrowed value the local bytes do not carry; reads nothing local itself; only refuses (through its callers); the agent as carlos (carlos-edge.service), no root caller whole:Route@176 b57510f2dc862d4c5b2e0e594d77bae6bb84bdee12b77c742e152468bed406c0
@legacy 97fc560e1b1b84ecc13660f4bc1d364e45dfffac3607637f02db89ad52eef2b1 internal/activator/escrow.go ExecBackend.escrowChanged legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: compares each escrowed file's stamp (stampAt, beneath the row's data directory) with the last kept one; reads no bytes Fix round 1 (P1-4): the stamps are copied under the escrow mutex, entry by entry, before they are compared; the same opens, no read added. registry:Host@122,registry:Host@444 12b8759b8473bb17eca3ad8b9912ba23f522dca54f2fe1c309b619fd72a3a879
@legacy 573f35211cf44372a958e8c843433a88bcaedbf5df7e0e007ba3ce427f3eb5cf internal/activator/escrow.go ExecBackend.escrowConflict legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: os.Lstat of <data>/.escrow/<host>.conflict, the agent's own directory; present, every launch, mint and publish of the host is refused with an alert naming the file for an operator to remove; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 2: the alert text names the divergence generally (local secrets differ from the escrow); the same Lstat. file:Lstat@117 c3b7c49a46a5c2c9159ced89438b91dc935fd8fb7d05b71293b31082019917b8
@legacy 6afc54fc8c764b2bc4cc78a200ef13ea4f3a5bf540abe1b0e4a81dd524ba53b2 internal/activator/escrow.go ExecBackend.escrowConflictFound legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 3: the alert names the env file too, since a platform-minted env variable can diverge; the same marker write. registry:Host@144,registry:Host@186,registry:Host@355,registry:Host@815 4ba873a1921b08b719df7439460635663bd9197d7326e55411ac7648e55387b0
-@legacy 75fc854a11bddecec1e2694b3c3dde3e6756e2a819d3b10f088a11d0c48d19d5 internal/activator/escrow.go ExecBackend.escrowDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller whole:Route@520 4b3979ccd01db815060a64f784cf0f4f8a2799220d1ae538a8eb36213578c0a1
+@legacy c821367ef21efd68fe9898672fb919e7a8bd4350c4b19f3e034f15997d18dd8e internal/activator/escrow.go ExecBackend.escrowDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller Fix round 4: the trio is decided first, by digest, and a divergent trio file is the verdict before the sealed env is read; the same reads. whole:Route@718 4173cffbe82a9a9f1daefbbe282d4d9af6b2d8231496ddbc113187c50237f841
@legacy 254a354a40269aaae37fee1c09f3fa5a46763943c83ba128748dc51e3f1a46fe internal/activator/escrow.go ExecBackend.escrowEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowEligibleAt on pathsFor's classification whole:Route@105,whole:Route@90 038966cd4221f6cbafe0eb80bdbf7ec69b54d36a34c0ea22a53746d2acac63fe
@legacy ea8e33b8cda7a3bf9671cfec5fbb8f90ad01be56378d7558af9520f6c25519c8 internal/activator/escrow.go ExecBackend.escrowEligibleAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: a pure predicate over the row and a classification: ActivatorManaged, not unit, sidecar, HA, replica, held, a valid host shape and app, flat or nested, on a box with a hibernate bucket; reads only row fields registry:App@295,registry:HA@163,registry:HoldOp@186,registry:Host@265,registry:Replica@172,registry:Status@221,registry:Unit@126,whole:Route@119 5df0c11ddde0ec351b062b87863396108d2fe48b7b4e390ca69daf377e0cac58
-@legacy a7d3afeb8f7275c5636a65cace92ecf2e4a2d4f2fa5f3fa2278494f27ec2d2bb internal/activator/escrow.go ExecBackend.escrowEnvOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady registry:Host@389,whole:Route@230 dd6e1f3a3e8299303a3f9c2f89d2ec2f952dbdcb45264ac39484abc925b2e415
+@legacy 673688307eb21478f1e87181bb426f5d89e1718b4b3a6dfd74f6ec28095c332b internal/activator/escrow.go ExecBackend.escrowEnvOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady Fix round 4: a fetch that fails or an envelope that does not open wraps errEscrowUnreadable (no longer ErrEscrowNotReady); the same reads. registry:Host@389,whole:Route@230 9404ba8cc9fd1946e4f0b3b8f610c4eaf66686898a1e4c48304e1d2da06e4e1d
@legacy a1acc9186a4b1f7cb650320e76c3d65ed536a9b4b5b3b5c8ec04779032d8631e internal/activator/escrow.go ExecBackend.escrowMintGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: on a box that is not ready refuses every mint (ErrEscrowNotReady); otherwise, once and only when a producer would mint, bucketEscrowEnv, and refuses (ErrInstanceKeyDeferred) when the escrowed env holds the variable; a mint it allows is noted in memory; only refuses Fix round 0 (controller readiness ruling): with no files store it is nil, and the producer mints as before 3a; with a files store and no sealing key it reads the bucket manifest at the mint (keylessEscrowed, fresh) and refuses (ErrEscrowNotReady) when the bucket holds any sealed item or the cutover marker for the host, and otherwise lets the mint go ahead (logged once); only refuses. Fix round 1: with a key it refuses while the conflict marker exists or while this box does not hold the host's lease (ErrInstanceKeyDeferred); its bucket read is bucketManifest, the preparation's shared read unless fresh (the backfill); without a key its keyless read is the same, with no cache across launches (P1-3); only refuses. Fix round 2: no longer notes the mints it allows in memory; only refuses. registry:Host@683,registry:Host@756,whole:Route@1064,whole:Route@125,whole:Route@209,whole:Route@291,whole:Route@527,whole:Route@898 5ba26a63e4d4f3944484f2a2257c1b43336f1ec9ed02cf56510558ccb685a310
@legacy 4936d243b2f0dfe0070b2ed97ea46ff79d868bedc54deefec132baadba1410ee internal/activator/escrow.go ExecBackend.escrowModeOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0 (controller readiness ruling): new: escrowNoStore when FilesStore is nil, escrowNoKey when escrowReady fails, else escrowOn; reads nothing whole:Route@147 6bfaddec7936f24f6756c8c68547d6a7fa54dd0523db9024e2f71924a2e7ecee
@legacy 2483746d1c63202a3c641199ea442261483853bea1b112ec3f2afc4772011d26 internal/activator/escrow.go ExecBackend.escrowOff legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0: new: one log line per host per process saying escrow is off and why; reads nothing registry:Host@309,registry:Host@87 6f3a552d5af240733241ea7befefa194706a70770e8bdc4f3c444ac48cf8f8c3
@legacy 73fa77e711e182b4777ae6346795af7d5a36c4f1c231714ff2415806bffeafff internal/activator/escrow.go ExecBackend.escrowReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: FilesStore and EscrowKey set and sealerFor succeeds; reads nothing whole:Route@165 fb7390d8f2ce1653619c3b365a3f804e5e1a0bb6f77210972a83453ebda42316
-@legacy e4a1412c2d6cdafc02b37db74f74bab2b9f17c5d61d4291b955cad79519b7ce2 internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@553,registry:Host@844,whole:Route@1022,whole:Route@1124,whole:Route@193 38d3251f07d0b938c52eca3311b890af7e34b7fac62fac8a99904b20ee4f7f30
-@legacy eaccb20d9481b5280d36080ab17bafec188f42218aee6f23cb9c3f4066114552 internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2671,registry:Host@2839,registry:Host@2960,registry:Host@3134,registry:Host@3350,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 e89777bda97cc3c2b2aa6a2ae9c61d01833fc41805180dd06777911570d585de
+@legacy 3cdf2f267286555d7a790e8b36246e522f6dee0c833b4288a6bac4e0b4990712 internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses. Fix round 4: the re-read manifest feeds what this process knows (learnBucket) once it parses; a failed open wraps errEscrowUnreadable; the same reads. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@668,registry:Host@882,whole:Route@1060,whole:Route@1162,whole:Route@193 f70b1d13550a8edbb7898dfb2ed851635525b67e564f8b1dcc782cc3a6692081
+@legacy ae753ddac8a3ccc3109288a243cbda434abbe148d09b7ec9854f376bf1d76e0f internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback. Fix round 4: a publish that answers errEscrowUnreadable or ErrEscrowNotReady (the manifest or sealed env could not be read, or does not open here) refuses the launch, never the later-launch fallback; only refuses. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2671,registry:Host@3074,registry:Host@3242,registry:Host@3363,registry:Host@3537,registry:Host@3753,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 1a0e785327a5266385e14f925bdcc4b010ecc0479d17a9ba9f10b887eeeed642
@legacy aa6c1694a6bfba03769ad089b3715610848596875e636952cf981c59a1761de3 internal/activator/escrow.go ExecBackend.haKnown legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the HA classification from memory only (haWakes, haLegacyRoute, the row's mark, the lifetime index); reads nothing registry:HA@185,registry:Host@274,registry:Host@95,whole:Route@151 4ecae90469fb6eda421464ca4509db7ddf4e5180180377867d3804b95bfd0c23
@legacy 69525c0419368661b947b49ab6f3af889f98804e603f9e5fdf1fd71aa534e030 internal/activator/escrow.go ExecBackend.keylessEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 0-1: new, on a box with a files store and no sealing key: whether the bucket holds an escrow for the host (any sealed item or the cutover marker), from bucketManifest: the read of the launch preparation in progress, or one hostfiles.Load (one GET); nothing is cached across launches (fix round 1, P1-3); a failed read is an error and the caller refuses; the agent as carlos (carlos-edge.service), no root caller whole:Route@146 5a14a5881e81f9b401a1f8321659e75cc6165a5477db6cacc89b6c7f9e5bee08
-@legacy 03adcc3ddc576e39f355b774273543874e745e96269145e98fac6d8772ba0220 internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 a407fe03838dc525b8e587bb8137b90b131c1e4dd8e9382f5325260293f50220
+@legacy 34756b70c68c328711aa4a685703ff133d45795b4e295681ac2d4f6ed3a241d7 internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads. Fix round 4: only an open from the bucket feeds what this process knows (learnBucket); an open from the ledger feeds nothing; a failed open or an unparseable manifest wraps errEscrowUnreadable; the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 5669dd51f456b1ce38c1c7848b30ab0202e87aef8fa63f6d5517c2c734e51f83
@legacy c7f95f454a974537377434c9993beebc3b0761e814ae369a8e1e29a5c3fc5474 internal/activator/escrow.go ExecBackend.publishEscrow legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt on pathsFor whole:Route@149,whole:Route@164 e61757f12a116ef8bf819dcad7136f810c51dfa9f7104ceb7f810efece48cc29
@legacy f6e622ed3b9e219a616ce6bf2f951b3e50c7897bd6e8a7f59ddb335fcbf8e3db internal/activator/escrow.go ExecBackend.publishEscrowAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowReady and the layout checked, then publishEscrowLocked under the host's lock Fix round 1: refuses while the conflict marker exists or while this box does not hold the host's lease (P1-2), before anything is read. registry:Host@223,registry:Host@269,registry:Host@340,registry:Host@376,registry:Host@435,registry:Host@556,registry:Host@653,whole:Route@157,whole:Route@733 5e2b655605216fcaa50ddfd0511ca4ce913a8716582932a13debf22c4876f117
-@legacy 0bae26d2175d5d2555ea748c9dc069b8ecdd277c2571ff64bf33a8a7295da0d5 internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown). registry:Host@2078,registry:Host@2342,registry:Host@3914,registry:Host@3944,registry:Host@4480,registry:Host@574,whole:Route@2269,whole:Route@2871,whole:Route@2990 d7e1bab9bb4a873a19ff5d5a235042269f675b9e7b12d49aa5c3a82e2936b200
+@legacy 7ab242be81f362e47876b9fa723f57cb92e5dcf83aa77615e4e1eb7b3ead6bd0 internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. registry:Host@2078,registry:Host@2342,registry:Host@3957,registry:Host@3987,registry:Host@5029,registry:Host@574,whole:Route@2269,whole:Route@2914,whole:Route@3033 b42b036e80f7fcb398924d5def55bb0d1ff9af8f5e478c305080f002c7ead83d
@legacy b053870b57f516eddc82775c8a662b701c49173c2171cad2ef2d27cb7cde688a internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise. registry:Host@1027,registry:Host@1145,registry:Host@138,registry:Host@1853,registry:Host@2721,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1654,whole:Route@1750,whole:Route@200,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 335cb066c95f026fba5e99df8f86252ee6a50b48f799d7b1042460c2ec188642
@legacy 7d7ae676fe3d33d027489b397a804eaa184295667ad039688aed3757f662ab9d internal/activator/escrow.go ExecBackend.sweepPublish legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert registry:Host@404,whole:Route@142,whole:Route@232,whole:Route@312 71bfee868a2ca8e3371cfc3c628b6ab5d8730ca48fcd099e7932049fe1e12a69
@legacy c89cfff20022faa5af3e07251a620b1b63e0b42f350483a6efec4162efdd1cca internal/activator/escrow.go Service.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one whole:Route@184 8ed0ea62a9807b7c43b3576d01f096bfe366c21bcc3be040831a3f1b80d1b123
@@ -73,27 +73,27 @@ internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-
internal/hostfiles/restore.go Restore legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Restore delegates to shared descriptor-root implementation; generic payload restoration remains legacy.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: passes nil for restore's new baseline argument; the one site unchanged, nothing else changed;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3 fix round 1: passes nil for restore's new shadowed argument, so it fetches, writes and removes exactly what it did; the same reads. restore gains that argument (a caller's Shadowed func over the manifest it has already read and validated): a live entry it names, after the overlap rule, is skipped before any fetch and reported in RestoreStats.Shadowed. It only leaves things out; nothing new is opened, read or followed. RestoreRootBaselineShadowed is new, RestoreRootBaseline is it with nil. file:OpenRoot@219 6a3b0e25de6d9ff6e644810d70a7056840e6cca7fa72db98542f990d4598fd30
internal/activator/escrow.go ExecBackend.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the agent as carlos (carlos-edge.service), no root caller, from escrowLoop: classifies each row against the rows handed in (Classify), keeps eligible rows known not HA from memory (haKnown, no read), and in host order from a round-robin cursor stats each escrowed file (stampAt) and publishes the changed ones, 8 at a time, at most 256 a sweep (sweepPublish); a box without a files store or key does nothing; opens nothing outside the rows' own data directories; writes only the hibernate bucket's files/0 prefix and the ledger Fix round 1: a host whose instance lease this box does not hold (holdsLease) is skipped, and one with a conflict marker counts as failing and is not published; the report is tallied through one lock (P1-4). registry:Host@1079,registry:Host@1098,registry:Host@1249,registry:Host@1782,registry:Host@2128,registry:Host@2385,registry:Host@2459,registry:Host@536,registry:Host@761,registry:Host@795,registry:Host@833,registry:Host@923,whole:Route@1001,whole:Route@1088,whole:Route@1107,whole:Route@1258,whole:Route@1576,whole:Route@1784,whole:Route@2014,whole:Route@2130,whole:Route@2387,whole:Route@2461,whole:Route@356,whole:Route@519,whole:Route@587,whole:Route@653,whole:Route@706,whole:Route@980,whole:Route@984 c3067eb671bdbba75100a0398840a1c293fb55b777e155703169d3ae2e71ccd2
internal/activator/escrow.go ExecBackend.SecretsEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: haHostNow or escrowEligible; reads only what the HA classification already reads whole:Route@123,whole:Route@198 c22d35df72f67d7222efd0b0f09d51c42275ad4a10d637598fdc8b822f6333bd
-internal/activator/escrow.go ExecBackend.bucketManifest legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller file:Open@408,registry:Host@170,registry:Host@241,registry:Host@370,registry:Host@954,whole:Route@329 a993cc65cd23b5568160c431ee28184109ad4375e9099a31cde921dd0e3fa379
+internal/activator/escrow.go ExecBackend.bucketManifest legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller Fix round 4: a manifest it reads is kept as what this process knows the bucket holds (learnBucket, the one writer of escrowState.known) and as the preparation's read; a failed read wraps errEscrowUnreadable; the same reads. file:Open@407,registry:Host@170,registry:Host@241,registry:Host@272,whole:Route@360 1442be94eb93bb9c65a32a8f2f338573bf0797e048109386d7c227262cf2cdb9
internal/activator/escrow.go ExecBackend.envDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 3: new: opens the manifest's sealed env (escrowEnvOf, ReadSealed: one GET) and names each variable the activator mints into the env (CARLOS_ADMIN_TOKEN, CARLOS_INSTANCE_KEY) whose escrowed value the local bytes do not carry; reads nothing local itself; only refuses (through its callers); the agent as carlos (carlos-edge.service), no root caller whole:Route@176 b57510f2dc862d4c5b2e0e594d77bae6bb84bdee12b77c742e152468bed406c0
internal/activator/escrow.go ExecBackend.escrowChanged legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: compares each escrowed file's stamp (stampAt, beneath the row's data directory) with the last kept one; reads no bytes Fix round 1 (P1-4): the stamps are copied under the escrow mutex, entry by entry, before they are compared; the same opens, no read added. registry:Host@122,registry:Host@444 12b8759b8473bb17eca3ad8b9912ba23f522dca54f2fe1c309b619fd72a3a879
internal/activator/escrow.go ExecBackend.escrowConflict legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: os.Lstat of <data>/.escrow/<host>.conflict, the agent's own directory; present, every launch, mint and publish of the host is refused with an alert naming the file for an operator to remove; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 2: the alert text names the divergence generally (local secrets differ from the escrow); the same Lstat. file:Lstat@117 c3b7c49a46a5c2c9159ced89438b91dc935fd8fb7d05b71293b31082019917b8
internal/activator/escrow.go ExecBackend.escrowConflictFound legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 3: the alert names the env file too, since a platform-minted env variable can diverge; the same marker write. registry:Host@144,registry:Host@186,registry:Host@355,registry:Host@815 4ba873a1921b08b719df7439460635663bd9197d7326e55411ac7648e55387b0
-internal/activator/escrow.go ExecBackend.escrowDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller whole:Route@520 4b3979ccd01db815060a64f784cf0f4f8a2799220d1ae538a8eb36213578c0a1
+internal/activator/escrow.go ExecBackend.escrowDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller Fix round 4: the trio is decided first, by digest, and a divergent trio file is the verdict before the sealed env is read; the same reads. whole:Route@718 4173cffbe82a9a9f1daefbbe282d4d9af6b2d8231496ddbc113187c50237f841
internal/activator/escrow.go ExecBackend.escrowEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowEligibleAt on pathsFor's classification whole:Route@105,whole:Route@90 038966cd4221f6cbafe0eb80bdbf7ec69b54d36a34c0ea22a53746d2acac63fe
internal/activator/escrow.go ExecBackend.escrowEligibleAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: a pure predicate over the row and a classification: ActivatorManaged, not unit, sidecar, HA, replica, held, a valid host shape and app, flat or nested, on a box with a hibernate bucket; reads only row fields registry:App@295,registry:HA@163,registry:HoldOp@186,registry:Host@265,registry:Replica@172,registry:Status@221,registry:Unit@126,whole:Route@119 5df0c11ddde0ec351b062b87863396108d2fe48b7b4e390ca69daf377e0cac58
-internal/activator/escrow.go ExecBackend.escrowEnvOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady registry:Host@389,whole:Route@230 dd6e1f3a3e8299303a3f9c2f89d2ec2f952dbdcb45264ac39484abc925b2e415
+internal/activator/escrow.go ExecBackend.escrowEnvOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady Fix round 4: a fetch that fails or an envelope that does not open wraps errEscrowUnreadable (no longer ErrEscrowNotReady); the same reads. registry:Host@389,whole:Route@230 9404ba8cc9fd1946e4f0b3b8f610c4eaf66686898a1e4c48304e1d2da06e4e1d
internal/activator/escrow.go ExecBackend.escrowMintGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: on a box that is not ready refuses every mint (ErrEscrowNotReady); otherwise, once and only when a producer would mint, bucketEscrowEnv, and refuses (ErrInstanceKeyDeferred) when the escrowed env holds the variable; a mint it allows is noted in memory; only refuses Fix round 0 (controller readiness ruling): with no files store it is nil, and the producer mints as before 3a; with a files store and no sealing key it reads the bucket manifest at the mint (keylessEscrowed, fresh) and refuses (ErrEscrowNotReady) when the bucket holds any sealed item or the cutover marker for the host, and otherwise lets the mint go ahead (logged once); only refuses. Fix round 1: with a key it refuses while the conflict marker exists or while this box does not hold the host's lease (ErrInstanceKeyDeferred); its bucket read is bucketManifest, the preparation's shared read unless fresh (the backfill); without a key its keyless read is the same, with no cache across launches (P1-3); only refuses. Fix round 2: no longer notes the mints it allows in memory; only refuses. registry:Host@683,registry:Host@756,whole:Route@1064,whole:Route@125,whole:Route@209,whole:Route@291,whole:Route@527,whole:Route@898 5ba26a63e4d4f3944484f2a2257c1b43336f1ec9ed02cf56510558ccb685a310
internal/activator/escrow.go ExecBackend.escrowModeOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0 (controller readiness ruling): new: escrowNoStore when FilesStore is nil, escrowNoKey when escrowReady fails, else escrowOn; reads nothing whole:Route@147 6bfaddec7936f24f6756c8c68547d6a7fa54dd0523db9024e2f71924a2e7ecee
internal/activator/escrow.go ExecBackend.escrowOff legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0: new: one log line per host per process saying escrow is off and why; reads nothing registry:Host@309,registry:Host@87 6f3a552d5af240733241ea7befefa194706a70770e8bdc4f3c444ac48cf8f8c3
internal/activator/escrow.go ExecBackend.escrowReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: FilesStore and EscrowKey set and sealerFor succeeds; reads nothing whole:Route@165 fb7390d8f2ce1653619c3b365a3f804e5e1a0bb6f77210972a83453ebda42316
-internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@553,registry:Host@844,whole:Route@1022,whole:Route@1124,whole:Route@193 38d3251f07d0b938c52eca3311b890af7e34b7fac62fac8a99904b20ee4f7f30
-internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2671,registry:Host@2839,registry:Host@2960,registry:Host@3134,registry:Host@3350,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 e89777bda97cc3c2b2aa6a2ae9c61d01833fc41805180dd06777911570d585de
+internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses. Fix round 4: the re-read manifest feeds what this process knows (learnBucket) once it parses; a failed open wraps errEscrowUnreadable; the same reads. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@668,registry:Host@882,whole:Route@1060,whole:Route@1162,whole:Route@193 f70b1d13550a8edbb7898dfb2ed851635525b67e564f8b1dcc782cc3a6692081
+internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback. Fix round 4: a publish that answers errEscrowUnreadable or ErrEscrowNotReady (the manifest or sealed env could not be read, or does not open here) refuses the launch, never the later-launch fallback; only refuses. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2671,registry:Host@3074,registry:Host@3242,registry:Host@3363,registry:Host@3537,registry:Host@3753,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 1a0e785327a5266385e14f925bdcc4b010ecc0479d17a9ba9f10b887eeeed642
internal/activator/escrow.go ExecBackend.haKnown legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the HA classification from memory only (haWakes, haLegacyRoute, the row's mark, the lifetime index); reads nothing registry:HA@185,registry:Host@274,registry:Host@95,whole:Route@151 4ecae90469fb6eda421464ca4509db7ddf4e5180180377867d3804b95bfd0c23
internal/activator/escrow.go ExecBackend.keylessEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 0-1: new, on a box with a files store and no sealing key: whether the bucket holds an escrow for the host (any sealed item or the cutover marker), from bucketManifest: the read of the launch preparation in progress, or one hostfiles.Load (one GET); nothing is cached across launches (fix round 1, P1-3); a failed read is an error and the caller refuses; the agent as carlos (carlos-edge.service), no root caller whole:Route@146 5a14a5881e81f9b401a1f8321659e75cc6165a5477db6cacc89b6c7f9e5bee08
-internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 a407fe03838dc525b8e587bb8137b90b131c1e4dd8e9382f5325260293f50220
+internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads. Fix round 4: only an open from the bucket feeds what this process knows (learnBucket); an open from the ledger feeds nothing; a failed open or an unparseable manifest wraps errEscrowUnreadable; the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 5669dd51f456b1ce38c1c7848b30ab0202e87aef8fa63f6d5517c2c734e51f83
internal/activator/escrow.go ExecBackend.publishEscrow legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt on pathsFor whole:Route@149,whole:Route@164 e61757f12a116ef8bf819dcad7136f810c51dfa9f7104ceb7f810efece48cc29
internal/activator/escrow.go ExecBackend.publishEscrowAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowReady and the layout checked, then publishEscrowLocked under the host's lock Fix round 1: refuses while the conflict marker exists or while this box does not hold the host's lease (P1-2), before anything is read. registry:Host@223,registry:Host@269,registry:Host@340,registry:Host@376,registry:Host@435,registry:Host@556,registry:Host@653,whole:Route@157,whole:Route@733 5e2b655605216fcaa50ddfd0511ca4ce913a8716582932a13debf22c4876f117
-internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown). registry:Host@2078,registry:Host@2342,registry:Host@3914,registry:Host@3944,registry:Host@4480,registry:Host@574,whole:Route@2269,whole:Route@2871,whole:Route@2990 d7e1bab9bb4a873a19ff5d5a235042269f675b9e7b12d49aa5c3a82e2936b200
+internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. registry:Host@2078,registry:Host@2342,registry:Host@3957,registry:Host@3987,registry:Host@5029,registry:Host@574,whole:Route@2269,whole:Route@2914,whole:Route@3033 b42b036e80f7fcb398924d5def55bb0d1ff9af8f5e478c305080f002c7ead83d
internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise. registry:Host@1027,registry:Host@1145,registry:Host@138,registry:Host@1853,registry:Host@2721,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1654,whole:Route@1750,whole:Route@200,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 335cb066c95f026fba5e99df8f86252ee6a50b48f799d7b1042460c2ec188642
internal/activator/escrow.go ExecBackend.sweepPublish legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert registry:Host@404,whole:Route@142,whole:Route@232,whole:Route@312 71bfee868a2ca8e3371cfc3c628b6ab5d8730ca48fcd099e7932049fe1e12a69
internal/activator/escrow.go Service.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one whole:Route@184 8ed0ea62a9807b7c43b3576d01f096bfe366c21bcc3be040831a3f1b80d1b123
@@ -133,7 +133,7 @@ internal/activator/paths.go ExecBackend.pathsFor legacy accepted-legacy accepted
@removed internal/activator/hasecrets.go SplitBackend.haScheduledToken H3 census-ruling-durability-3a-escrow;absent;basis=durability 3a Task 4: renamed to SplitBackend.escrowedScheduledToken (on this card)
@remove internal/host/schedule_wiring.go scheduleHostHA
@removed internal/host/schedule_wiring.go scheduleHostHA H3 census-ruling-durability-3a-escrow;absent;basis=durability 3a Task 4: renamed to scheduleHostEscrowed (on this card), asking SecretsEscrowed instead of IsHA
-@coverage internal/activator 3b745c7c395b03f6a18d4957438a694c9fb08ea9820ab962311f96ddb7eecc3f
+@coverage internal/activator 5f2e58a9596531578ce8d51fcfc2de02ed1807dd714f50e02eb13fcfb1f9249e
@coverage internal/host c12e11dd2fbfb5936e5256007db85a88f96cb12f3d1c74c551ff7ec5f52f9355
@coverage internal/hostfiles a0b0deb2779b183ee3f3578d1112ac5f723d930e40690a55eaaaa2644a24a9ad
@coverage internal/layout f845fa728b0935279454d8b01023c5d6dae1c985061a41229cf0686e829f5c12