census: runAgent boot full pass card; fleet drain follow-ups plan
Census card for Task 3 (internal/host runAgent, body change, no read added) and the implementation plan for the #1008 T9 drill fixes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-proposal-fleet-drain-followups.md+19 −0docs/superpowers/plans/2026-11-15-fleet-drain-followups.md+360 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-fleet-drain-followups.tsv+4 −0
Intent
<task-notification> <task-id>a96aba0267bd9186c</task-id> <tool-use-id>toolu_01G3nLZQH23iA8UWzXXrafMn</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/24f2e8d0-8e47-4773-a96b-f7e9260c860f/tasks/a96aba0267bd9186c.output</output-file> <status>completed</status> <summary>Agent "Implement Task 3: boot full pass" 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. A restarted fleet box now runs its first reconcile on the fast loop's first tick (about 2 s after start) instead of a minute later. Commit: 93bf24bd "host: an unindexed box runs its boot full pass on the first fast tick" (70-char subject, parent ea0dff8f). The brief's sketch matched the real types, so nothing was adapted. Tests: the new `TestUnindexedBootRunsOneFullPass` failed first to compile, then with `passes=0`, then passed. The brief's run pattern passes (16 tests). gofmt and `go vet` are clean, and the darwin and windows builds of `./internal/host` succeed. No test is named `TestRecordViewBackstop*`, so that part of the pattern matches nothing. Concerns: - Nothing replays: the boot pass runs only the full pass, and the serial seed rule is unchanged. On armed boxes the new helper does nothing, so they do not run it twice. - No test covers the call inside `RunAgent` (it is untested by convention). - The pass may still wait up to about 5 s for the HA ingress startup pass to let go of the reconcile lock (that pass is out of scope). - Two slips, both on my own files only: I ran `git checkout -- .`, which wiped my uncommitted edits, and I re-applied them identically and re-tested. Cleanup also used a glob delete inside my own scratch directory, which the rules said not to do. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-drain-followups/.superpowers/sdd/2026-11-15-fleet-drain-followups/task-3-report.md</result> <usage><subagent_tokens>64457</subagent_tokens><tool_uses>14</tool_uses><duration_ms>178504</duration_ms></usage> </task-notification>
Attributed to this commit: 15.6 g CO₂e (1,570,911 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-drain-followups, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/notes/census-proposal-fleet-drain-followups.md b/docs/superpowers/notes/census-proposal-fleet-drain-followups.md| new file mode 100644 |
| index 000000000..f1cc25cd9 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-fleet-drain-followups.md |
| @@ -0,0 +1,19 @@ |
| +# Census approval: fleet-drain-followups |
| + |
| +Ruling `census-ruling-fleet-drain-followups`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/host/agent.go` `runAgent` | body | unchanged (8) | P3 (#1008 T9): one call after armChangeIndex, requestBootFullPass(v, &backstopFullDue), which stores true in the existing in-memory backstopFullDue flag only when no record view is armed, so the fast loop runs its existing full pass on its first tick instead of instancesLoop a minute later; armed boxes unchanged. No read added; read sites unchanged (8); agent, not root. | |
| + |
| +Envelopes re-pinned: `internal/host`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/host/agent.go` `runAgent`: authority, task B,C,D,F. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added;rev3=census-ruling-stateless-replicas-4-merge-main2;basis=Merge of main af871da0 (v0.34.49): both sides changed it. Main (178dcfe5, member-backups-2a) moves the inline duty-view closure into armDutyView/dutyView and starts verifyAssignLoop; its sites drop by registry:Host and whole:Route x2 as main recorded them. This branch keeps its replica coordinator, swap worker and drive wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-drill3;basis=drill 3 R24: makes one in-memory channel, closes it (once) inside the edge's existing shutdown-started callback after ingress.shutdownStarted, and passes it to tunnelLoop, which drains only a fleet channel name; no read added, same six sites; touches no admission, lease, ingress drain, listener or file; the agent process, no root decision;rev3=census-ruling-edge-ppv2;basis=Agent (uid carlos), not root. memwatchLoop now gets edgeProxyCounters(&demoEdge) (in-process counters, no read). The drain socket's driver is newAgentDrainSocket(ingress, e, os.Getenv), which attaches the edge trust handler only when CARLOS_INGRESS_PROXY_SOURCES in the agent's environment (from the root-owned host.env) parses to a non-empty list; the socket is served when drainSocketServed: a group member or a configured ingress drain (both as before), or a box armed for PROXY protocol (new). The socket's path and agent-user-only permissions are unchanged. Read sites unchanged (6).;rev3=census-ruling-same-box-edge-fence;basis=Agent (uid carlos), not root. One added line: armEdgeFenceStatus(ctl.EdgeFence), beside the existing armExecSandboxStatus, so the layout report can ask root's /ready for the edge fence state over the control socket client the agent already holds. No read added.;rev3=census-ruling-platform-mail-submission;basis=Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box, and eb.MailSwitch to a mailSwitchCache's On that opens the deploy store itself through openDeployStore, retried at most once a minute with an error line until it opens (review round 1, Task 4 P3), armed for the serial-move refresh (armedMailSwitch). Task 6: also sets the ExecBackend's ManifestOf, the same staged-manifest read as TierOf (rt.App and RouteAccount(rt), hence +registry:App and +whole:Route), for the spawn-time check of decision 10, which logs and emits an event and never refuses. Agent, not root. Fable final P2-2: eb.MailSwitch is the cache's State (three-valued: on, off, unknown) in place of On; an unreadable switch is unknown, never off. No read added. |
| + |
| +Seal: `c6655e82e81ccd2a7547655eb393ec3fd10bba396255a1edb30d59b7ad1e682e` → `c6655e82e81ccd2a7547655eb393ec3fd10bba396255a1edb30d59b7ad1e682e`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-fleet-drain-followups.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/plans/2026-11-15-fleet-drain-followups.md b/docs/superpowers/plans/2026-11-15-fleet-drain-followups.md| new file mode 100644 |
| index 000000000..57e72c6fd |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-15-fleet-drain-followups.md |
| @@ -0,0 +1,360 @@ |
| +# Fleet Drain Follow-ups Implementation Plan (#1008 T9 findings) |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** Fix the two P2s the T9 dev drill found (`.superpowers/sdd/2026-11-15-fleet-drain-followups/t9-drill-report.md`, "Product findings" 1 and 2): an app in the Trash blocks every drain of its fleet, and a box detached from a two-box fleet strands its labelled records. File the P3 (a restarted fleet agent cannot read records for 35 to 60 s) as a precise finding, because its cause cannot be settled from code alone. |
| + |
| +**Architecture:** Console-only. Task 1 teaches `drainBox` that an unlabelled record of an app the boxes have already retired (trash marker read, production flag positively clear) is not something the drain has to move. Task 2 lets the relabel worker read a one-box fleet whole when a box that is no longer active was ever named on a record, gates `relabelFleet` on `v.Complete` instead of `v.Active`, and has both detach doors run that fleet's relabel at once. No record field, wire shape, CLI string or root-binary file changes. |
| + |
| +**Tech Stack:** Go. `internal/console` only (plus its tests). |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-14-fleet-record-labels-design.md` (rev 3, final): R2 (restore-required, no empty start), R3 (stateless eligibility via `movableVerified`), D2 (no worker first labelling). Managed fleets 1b rules 4 and 5 (moves off lost, draining and detached boxes; detach only with `--terminated`). |
| + |
| +**Round history:** none yet. This plan is round 0. Stopping rule 1 applies from the first review. |
| + |
| +## Global Constraints |
| + |
| +- **R2 holds.** Every move goes through `provision.SetRecordFleetBox`, which sets `FleetBoxMoved = true` whenever the label changes from one box to another (`internal/provision/fleetbox.go:72-74`). The destination then refuses an empty start (`internal/activator/startrule.go:333-376`). Nothing in this plan writes a record any other way. |
| +- **R3 holds.** Every move decision still calls `s.movableVerified(ctx, rec)` and `v.chooseMoveDestination(rootfs, stateless, exclude)`, so an always-on stateless record moves only to a box at `release.StatelessRuntimeFloor`. |
| +- **D2 holds.** The worker never writes a first label. An unlabelled record stays unlabelled in both tasks. |
| +- **`v.Active` keeps its meaning** (`whole && len(v.Boxes) >= 2`, `internal/console/fleetbox.go:429`). The create door (`apiinstances.go:2214`), replica placement and the label door are untouched. Only the relabel worker's gate and its view load change. |
| +- **The trash judgement mirrors the box.** A box retires a trashed app's routes only when the marker is positively read and the production flag is positively clear (`internal/provision/reconcile.go:1766-1775`, `productionClear` at `:327-341`, `retiredWhy` at `:2472-2490`). The console excuses a record from the drain only under the same two reads. An unreadable marker or flag is "still served", which keeps today's refusal. |
| +- **No new user-facing strings.** Console log lines only (they are operator logs, as every existing `console: fleet relabel` / `console: fleet drain` line is, and are not copy-reviewed). If an implementer finds they need a new answer string, stop and add it to the Copy section for Paul's review first. |
| +- **No census card.** Every changed file is under `internal/console`, which is outside the root-binary census scope (AGENTS.md, "What is in scope"). Confirm with `make census-card` at the end of each task: it must report no changed unit. |
| +- **Tests:** targeted `-run` only, never the full suite (CI runs it). On docs-t1: |
| + ``` |
| + mkdir -p "$HOME/.cache/fleet-drain-followups/tmp" |
| + TMPDIR="$HOME/.cache/fleet-drain-followups/tmp" go test ./internal/console/ -run '<pattern>' -count=1 |
| + ``` |
| + Leave `GOCACHE` at its default. Remove `$HOME/.cache/fleet-drain-followups/` by that exact path when done. Run Bash with the sandbox disabled (the bwrap error on another worktree's metadata). |
| +- **Every witness is deterministic:** explicit `now` values and direct calls (`fx.srv.fleetRelabelPass(ctx, now)`, `fx.srv.drainBox`), never sleeps. |
| +- Never run `git worktree`, `git stash`, `git config` or glob deletes. Commit subjects under 80 characters. |
| + |
| +## Decisions (with reasons) |
| + |
| +### D-A. Trashed apps: excuse their unlabelled records from the drain (option 1) |
| + |
| +Rejected **"trash retires the fleet instance records"**: restore depends on the records. Trash keeps them, restore leaves them alone, and the box's reconcile mints the instance routes again from them once the marker is gone (`internal/console/restore.go:28-41`, `restoredTemporaryNote`; `apicli.go` restore door comment "removing the trash marker re-enables instance minting"). Retiring them would make a restored fleet app come back with no instances, and they could not be recreated with their data identity. |
| + |
| +Rejected **"an owner verb clears them"**: a new CLI verb, route, parity row, docs and copy, for a state the owner did nothing wrong to reach. The person draining may not be the app's owner, and the label door answers 404 for a trashed app (`instancelabel.go`, `HasAppIn`), so the verb would have to be a second door into trashed apps. |
| + |
| +Chosen: in `drainBox`, an **unlabelled** record whose app's trash marker is positively read and whose production flag is positively clear does not strand the drain. Why this is safe and keeps restore working: |
| + |
| +- **It is not live.** Every box retires that app's routes on its next pass (`reconcile.go:2472-2490`, "app in the trash"), and the hub's forward phase drops them too (`trashFor` in `forwardView`, `reconcile.go:1805-1820`). |
| +- **It is not stranded.** An unlabelled record is carried by every box of the fleet (`ownsRecord`, spec §1). After the drained box is detached, the remaining boxes still carry it. A restore makes them mint it again, exactly as for any other app. |
| +- **Nothing is written to it.** It stays unlabelled (D2). Its data is in the fleet bucket from the stop's final checkpoint (R2's proven checkpoint), so a remaining box restores it on its first wake. |
| +- **Labelled records of a trashed app are not excused.** They follow the normal rules: moved like any other (so a later restore finds them on a live box), or stranding the drain if they cannot move. Excusing a labelled record would leave it tied to the box being removed, and after detach the restore would answer 503. |
| + |
| +Accepted race: the app is restored between the drain's marker read and its draining write. The restored unlabelled record is then carried by every box including the draining one, which is the pre-1b multi-box state the label door exists for. Nothing is stranded: the other boxes carry it. The drain does not take the app lock (it holds the fleet lock, and no current code orders app-then-fleet, so adding fleet-then-app is a lock-order risk for no safety gain). |
| + |
| +### D-B. Detached box on a one-box fleet: a "move off gone boxes" view, not a looser `Active` |
| + |
| +The relabel worker skips any fleet with fewer than two active boxes twice over: `loadFleetViewAt` returns early without the inventory (`fleetbox.go:358`), and `relabelFleet` returns on `!v.Active` (`fleetrelabel.go:153`). |
| + |
| +Chosen: |
| + |
| +- **A view load for the worker** (`relabelView`) that asks `loadFleetViewRequiredAt(..., requireComplete)` with `requireComplete` true exactly when the fleet has one active registry box and some non-active box (status `detached`, the only other status, `registry/fleets.go:120-122`) has `LabelledAt != 0`. Only then is the one-box inventory read, so a one-box fleet that never lost a labelled box costs nothing new. |
| +- **`relabelFleet` gates on `v.Complete`.** For two or more active boxes `Complete == Active`, so nothing changes there. Below two it is true only for a view read whole: the new case, and the existing one-box fleet with replica apps (whose view is already read whole, `fleetbox.go:358`). In both, moving records off a draining, lost or detached box to a valid survivor is the behaviour the worker already has on larger fleets. |
| +- **Destination rules are unchanged.** `chooseMoveDestination` still needs a fresh, non-draining box at the label floor (rootfs-ready for rootfs, at the stateless runtime floor for stateless). With no valid survivor the record stays and is logged, as today. |
| +- **"Lost" is already covered.** A box still active in the registry but silent past `fleetBoxLostAfter` keeps the fleet at two active boxes, so the existing path moves its records (`TestLostBoxMovesToTheSurvivor`). Only "detached" drops the active count, so only detached needs the new view. |
| +- **Both detach doors run the fleet's relabel at once** after a successful detach, under the fleet lock they already hold, bounded, best effort, answer unchanged. That makes `detach-box --terminated` itself the command that moves the records, instead of up to five minutes of 503s. |
| + |
| +The `instances label` answer "already tied to box-2. nothing to do" (C07) and the `fleets drain` answer "is detached. there is nothing to drain" need **no change**: with the detach-time relabel they describe the state truthfully in the normal case. The residual case (no valid survivor, or an unmovable record) is a follow-up in Deferred. |
| + |
| +### D-C. P3 is deferred with a precise finding |
| + |
| +See Deferred. The reconcile path on a fleet box carries no deadline of its own, so "context deadline exceeded" comes from a caller whose log line the drill report does not quote. The cheapest next step is reading that line, not a code change. |
| + |
| +## Landing |
| + |
| +- One branch, `fleet-drain-followups`, two commits (Task 1, Task 2). They both touch `fleetrelabel.go` but different functions. |
| +- **Review:** both tasks write instance records (production storage), so each gets Astra's verdict. One Astra run over the branch with a verdict per task is enough (stopping rule 3), at most three rounds. Brief from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`. |
| +- No copy review, no census card, no parity or docs change. |
| +- Merge with `amadan branch merge carlos/platform fleet-drain-followups -expect <full sha> -squash -message "<subject under 80 chars>\n\n<body>"` (real newlines), after CI is green. Send the SHA to the release manager (8a3d302) and post on #1008. It rides v0.36.1. |
| + |
| +## File Structure |
| + |
| +| File | Change | Task | |
| +|---|---|---| |
| +| `internal/console/fleetrelabel.go` | `drainBox` excuses trashed apps' unlabelled records; `trashRetired` helper | T1 | |
| +| `internal/console/fleetrelabel.go` | `relabelView`, `goneLabelledBox`; `fleetRelabelPass` uses `relabelView`; `relabelFleet` gates on `v.Complete`; `relabelAfterDetach` | T2 | |
| +| `internal/console/fleets.go` | both detach doors call `relabelAfterDetach` | T2 | |
| +| `internal/console/fleetbox.go` | doc comment of `fleetView.Complete` / `Active` only | T2 | |
| +| `internal/console/fleetrelabel_test.go` | witnesses | T1, T2 | |
| +| `internal/console/fleetbox_test.go` | `countStore.listsOf` helper | T2 | |
| + |
| +--- |
| + |
| +### Task 1: A trashed app's unlabelled record no longer blocks a drain |
| + |
| +**Files:** |
| +- Modify: `internal/console/fleetrelabel.go`, `drainBox` (`:384-509`; the `rec.FleetBox == ""` case at `:457-460`) and its doc comment (`:372-383`); the file header comment (`:20-56`) gets one sentence. |
| +- Test: `internal/console/fleetrelabel_test.go` |
| + |
| +**Interfaces:** |
| +- Produces (unexported): |
| + ```go |
| + // trashRetired reports whether the boxes have retired app's routes because |
| + // it is in the Trash: its marker positively read (release.ReadAppTombstone) |
| + // and its production flag positively clear (release.GetProduction with |
| + // s.cfg.ReleasePub: absent, or present and not production). This is |
| + // reconcile's removable test (internal/provision/reconcile.go:1766-1775, |
| + // productionClear) asked of the same bucket. An unreadable marker or flag |
| + // is an error, which the caller treats as "still served". |
| + func (s *Server) trashRetired(ctx context.Context, sqid, app string) (bool, error) |
| + ``` |
| +- Consumes: `release.ReadAppTombstone`, `release.GetProduction`, `s.cfg.Releases`, `s.cfg.ReleasePub`. |
| + |
| +**Behaviour:** In `drainBox`'s record loop, replace |
| + |
| +```go |
| +if rec.FleetBox == "" { |
| + strand[rec.App] = true |
| + continue |
| +} |
| +``` |
| + |
| +with: look the app up in a per-call memo `retired map[AppRef]bool` (one marker read and at most one flag read per app per drain, and only for apps with an unlabelled record on this fleet). If `trashRetired` answers true, log once per app |
| + |
| +``` |
| +console: fleet drain %s/%s: %s/%s is in the trash and its routes are retired; its unlabelled records stay as they are and do not hold the drain |
| +``` |
| + |
| +and `continue` without stranding. On false, or on an error (log `console: fleet drain %s/%s: %s/%s: trash state unreadable: %v; treated as served`), strand as today. Labelled records of a trashed app go through the existing `movableVerified` / `chooseMoveDestination` path unchanged. `msgDrainStrandsApps` is unchanged. The one-box branch (`len(v.Boxes) < 2`, reading `fleetInventoryFor`) gets the same treatment because it shares the loop. |
| + |
| +Doc comment of `drainBox`: "A record cannot move when it is unlabelled (every box runs it), unless its app is in the Trash and the boxes have retired its routes (trashRetired): such a record is not served, every remaining box still carries it, and a restore mints it again from the record, so it does not hold the drain and is left unlabelled." |
| + |
| +- [ ] **Step 1: Write the failing witness** in `fleetrelabel_test.go`: |
| + |
| + ```go |
| + // #1008 T9 finding 1: an app in the Trash blocked every drain of its |
| + // fleet until it purged. An unlabelled record of an app whose marker is |
| + // read and whose production flag is clear is not served by any box, is |
| + // still carried by every other box, and comes back on restore, so it no |
| + // longer holds the drain. Its record is not written. |
| + func TestDrainSkipsATrashedAppsUnlabelledRecord(t *testing.T) { |
| + ctx := context.Background() |
| + fx, _, reg := fleetBoxWorld(t, "code-rl-drain-trash", "pi-1", "pi-2") |
| + placeBlog(t, fx) |
| + putFleetRecord(t, fx, "shop", "a.example.com", func(r *provision.Record) { r.FleetBox = "pi-1" }) |
| + putFleetRecord(t, fx, "blog", "x.example.com", nil) // unlabelled: every box carries it |
| + before := blogRecBytes(t, fx, "x.example.com") // raw object bytes, for "not written" |
| + |
| + // Baseline: live, it strands the drain (as TestDrainRefusesAnUnmanagedRecord/unlabelled). |
| + if stuck, err := fx.srv.drainBox(ctx, "pi", "pi-1"); err != nil || !slices.Equal(stuck, []string{"blog"}) { |
| + t.Fatalf("live: drainBox = %v, %v; want blog stranded", stuck, err) |
| + } |
| + if err := release.TrashApp(ctx, fx.rel, fx.sqid, "blog", "paul@keymail.dev", time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + stuck, err := fx.srv.drainBox(ctx, "pi", "pi-1") |
| + if err != nil || len(stuck) != 0 { |
| + t.Fatalf("trashed: drainBox = %v, %v; want nothing stranded", stuck, err) |
| + } |
| + if r := shopRec(t, fx, "a.example.com"); r.FleetBox != "pi-2" || !r.FleetBoxMoved { |
| + t.Fatalf("shop's record after the drain: %+v; want moved to pi-2", r) |
| + } |
| + if b := boxRow(t, reg, "pi-1"); b.DrainingSince == 0 { |
| + t.Fatal("the drain did not mark pi-1 draining") |
| + } |
| + if got := blogRecBytes(t, fx, "x.example.com"); !bytes.Equal(got, before) { |
| + t.Fatalf("the trashed app's record was written:\n%s\nwant\n%s", got, before) |
| + } |
| + // Restore keeps working: the marker goes and the record is there, |
| + // unlabelled, on the fleet, for the remaining boxes to mint. |
| + if err := release.RestoreApp(ctx, fx.rel, fx.sqid, "blog"); err != nil { |
| + t.Fatal(err) |
| + } |
| + r, err := provision.GetRecord(ctx, fx.rel, fx.sqid, "blog", "x.example.com") |
| + if err != nil || r.Retired || r.Region != "fleet/pi" { |
| + t.Fatalf("after restore: %+v, %v; want the record kept on fleet/pi", r, err) |
| + } |
| + wantNoLabel(t, r) |
| + } |
| + ``` |
| + |
| + `blogRecBytes` is a small helper: `fx.rel.Get(ctx, provision.RecordKey(fx.sqid, "blog", h))`. |
| + |
| +- [ ] **Step 2: Write the refusals that must keep holding**, as subtests of `TestDrainStillRefusesATrashedAppTheBoxesServe`, each in its own `fleetBoxWorld` with `placeBlog`, shop's `a` labelled `pi-1` and blog trashed with `release.TrashApp`, asserting `stuck == []string{"blog"}`, no record written (`newCountStore` installed before the drain, `recordPuts() == 0`) and `pi-1` not draining: |
| + - `"production"`: `release.SetProduction(ctx, fx.rel, fx.priv, fx.sqid, "blog", true, "paul@keymail.dev")` before the drain. The box keeps serving a production app's routes despite the marker (`productionClear`). (Confirm the fixture's `fx.srv.cfg.ReleasePub` is `fx.priv`'s public key; if it is nil, set it in the subtest.) |
| + - `"unreadable marker"`: overwrite `release.AppTombstoneKey(fx.sqid, "blog")` with `{"schema":2}` (`ReadAppTombstone` refuses an unknown schema). |
| + - `"unreadable flag"`: a production object that does not verify (write any non-JSON bytes at `release.ProductionKey(fx.sqid, "blog")`). |
| + - `"labelled and unmovable"`: blog's record is `r.FleetBox, r.Addr = "pi-1", "127.0.0.1:9000"`. Only unlabelled records are excused. |
| +- [ ] **Step 3: Write the cost pin** `TestDrainReadsTrashStateOnlyForUnlabelledApps`: shop has a labelled record on `pi-1` and an unlabelled record; blog (placed) has only a labelled record on `pi-1`. Install `newCountStore`, drain, and assert `cs.getsOf(release.AppTombstoneKey(fx.sqid, "blog")) == 0` and `cs.getsOf(release.AppTombstoneKey(fx.sqid, "shop")) == 1` (one read per app per drain, however many unlabelled records it has; give shop two unlabelled records to prove the memo). |
| +- [ ] **Step 4: Run and confirm the witness fails** (blog stranded after the trash): |
| + `go test ./internal/console/ -run 'TestDrainSkipsATrashedAppsUnlabelledRecord|TestDrainStillRefusesATrashedAppTheBoxesServe|TestDrainReadsTrashStateOnlyForUnlabelledApps' -count=1`. Expected: the first and third FAIL, the refusal subtests PASS. |
| +- [ ] **Step 5: Implement** `trashRetired` and the loop change. |
| +- [ ] **Step 6: Run the new tests and the existing drain, trash and restore tests:** |
| + `go test ./internal/console/ -run 'TestDrain|TestAPITrash|TestAPIRestore|TestRestore|TestLostBoxAndDrain|TestStatelessMove|TestLabelDoor' -count=1`. Expected: PASS. `TestDrainRefusesAnUnmanagedRecord/unlabelled` must still pass (blog is live there). |
| +- [ ] **Step 7:** `gofmt -l internal/console`, `go vet ./internal/console/`, `make census-card` (expect no changed unit). |
| +- [ ] **Step 8: Commit.** `console: a trashed app's unlabelled record no longer holds a drain` (body: #1008 T9 finding 1, the rule, why restore keeps working). |
| + |
| +**Review focus for Astra:** the trash judgement matches the box's `removable` exactly (marker and flag both positively read); no write to an excused record; labelled records of trashed apps are not excused; the restore race is benign. |
| + |
| +--- |
| + |
| +### Task 2: Records on a detached box move to the sole survivor |
| + |
| +**Files:** |
| +- Modify: `internal/console/fleetrelabel.go`: `fleetRelabelPass` (`:104-132`, the `loadFleetViewAt` call at `:115`), `relabelFleet` (`:147-188`, the gate at `:153`), the header comment (`:20-56`); add `relabelView`, `goneLabelledBox`, `relabelAfterDetach`, `fleetDetachRelabelTimeout`. |
| +- Modify: `internal/console/fleets.go`: `handleAPIFleetDetachBox` (after the audit at `:635`) and `handleFleetDetachBoxPage` (after the audit at `:1724`). |
| +- Modify: `internal/console/fleetbox.go`: the `fleetView` doc comment (`:37-48`) gains one sentence on `Complete` for one-box views read whole by the relabel worker. No code change there. |
| +- Modify: `internal/console/fleetbox_test.go`: add `func (c *countStore) listsOf(prefixes ...string) int` beside `getsOf`. |
| +- Test: `internal/console/fleetrelabel_test.go` |
| + |
| +**Interfaces (unexported):** |
| + |
| +```go |
| +// goneLabelledBox reports whether a relabel pass must read a one-box fleet |
| +// whole: exactly one of boxes is active, and some box that is not active |
| +// (detached) was named on a record (LabelledAt != 0), so records may still |
| +// name it (#1008 T9 finding 2). Lost and draining boxes stay active, so a |
| +// fleet that still has two active boxes is read whole anyway. |
| +func goneLabelledBox(boxes []registry.FleetBox) bool |
| + |
| +// relabelView is the view a relabel pass acts on, as of now: |
| +// loadFleetViewRequiredAt, read whole also when goneLabelledBox holds. |
| +func (s *Server) relabelView(ctx context.Context, fleet string, now time.Time) (fleetView, error) |
| + |
| +// fleetDetachRelabelTimeout bounds the relabel a detach door runs. |
| +const fleetDetachRelabelTimeout = 20 * time.Second |
| + |
| +// relabelAfterDetach runs fleet's relabel at once after a detach door |
| +// detached a box, under the fleet lock the door holds, so the detached |
| +// box's records move to a survivor now rather than at the next worker |
| +// pass. Best effort: an error is logged and the worker repeats it within |
| +// fleetRelabelInterval. Off on a host-claim console, as the worker is. |
| +func (s *Server) relabelAfterDetach(ctx context.Context, fleet string) |
| +``` |
| + |
| +**Behaviour:** |
| + |
| +- `goneLabelledBox`: count `Status == "active"`; set `gone` for any other status with `LabelledAt != 0`; answer `active == 1 && gone`. |
| +- `relabelView`: open the pass registry, `ListFleetBoxes(fleet)`, then `s.loadFleetViewRequiredAt(ctx, fleet, now, goneLabelledBox(boxes))`. A registry error is the view error, as today. |
| +- `fleetRelabelPass`: `v, err := s.relabelView(ctx, f.Name, now)` in place of `loadFleetViewAt`. `reconcileReplicaFleet` keeps receiving the same `v`; it returns early on `len(v.ReplicaApps) == 0`, so a newly whole one-box view changes nothing for it. |
| +- `relabelFleet`: after the pause check, `if !v.Complete { return 0, nil }` replacing `!v.Active`, with the comment: "Moving off a gone box needs the whole view and nothing more: on two or more active boxes Complete is Active, and a one-box view is whole only when relabelView or replica placement asked for it. chooseMoveDestination still refuses a stale, draining or below-floor survivor." |
| +- `relabelAfterDetach`: return at once on `s.cfg.HostClaim`, `s.cfg.Releases == nil` or `s.cfg.Registry == ""`. Otherwise `ctx, cancel := context.WithTimeout(ctx, fleetDetachRelabelTimeout)`, `now := time.Now()`, `v, err := s.relabelView(ctx, fleet, now)`; on error log `console: fleet detach %s: relabel: view: %v; the relabel worker moves its records` and return; else `moved, _ := s.relabelFleet(ctx, fleet, v, now)` and, when `moved > 0`, log `console: fleet detach %s: moved %d records off the detached box`. |
| +- Both detach doors: call `s.relabelAfterDetach(r.Context(), fleet.Name)` after the audit line and before writing the answer. The lock is already held (`defer unlock()`). The answer body and status are unchanged. The managed-fleet refusal (`msgManagedBYO`) comes earlier, so managed fleets are unaffected; their boxes are covered by the worker. |
| + |
| +- [ ] **Step 1: Write the failing witness** (the drill's teardown, deterministic): |
| + |
| + ```go |
| + // #1008 T9 finding 2: a two-box fleet loses a box. After detach-box |
| + // --terminated the records labelled to it stayed tied to it and answered |
| + // 503: the worker skipped fleets with fewer than two active boxes. The |
| + // worker now reads a one-box fleet whole when a detached box was ever |
| + // labelled, and moves those records to the survivor, restore-required |
| + // (R2). A record already on the survivor is not written. |
| + func TestDetachedBoxRecordsMoveToTheSoleSurvivor(t *testing.T) { |
| + ctx := context.Background() |
| + fx, _, reg := fleetBoxWorld(t, "code-rl-sole", "pi-1", "pi-2") |
| + for _, h := range []string{"a.example.com", "b.example.com", "c.example.com"} { |
| + putFleetRecord(t, fx, "shop", h, nil) |
| + } |
| + labelOn(t, fx, reg, "a.example.com", "pi-1") |
| + labelOn(t, fx, reg, "b.example.com", "pi-2") |
| + labelOn(t, fx, reg, "c.example.com", "pi-2") |
| + if err := reg.SetFleetBoxStatus("pi", "pi-2", "detached"); err != nil { // the machine is gone |
| + t.Fatal(err) |
| + } |
| + now := time.Now() |
| + // The old gate: one active box is never Active. |
| + if v, err := fx.srv.loadFleetViewAt(ctx, "pi", now); err != nil || v.Active || v.Complete { |
| + t.Fatalf("plain view %+v, %v; want neither Active nor Complete", v, err) |
| + } |
| + cs := newCountStore(fx.rel) |
| + fx.srv.cfg.Releases = cs |
| + if err := fx.srv.fleetRelabelPass(ctx, now); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, h := range []string{"b.example.com", "c.example.com"} { |
| + r := shopRec(t, fx, h) |
| + wantLabel(t, r, "pi-1") |
| + if !r.FleetBoxMoved { |
| + t.Fatalf("%s moved without FleetBoxMoved: it could start empty (R2)", h) |
| + } |
| + } |
| + if r := shopRec(t, fx, "a.example.com"); r.FleetBox != "pi-1" || r.FleetBoxMoved { |
| + t.Fatalf("a was already on the survivor and was rewritten: %+v", r) |
| + } |
| + if n := cs.recordPuts(); n != 2 { |
| + t.Fatalf("the pass wrote %d records; want 2", n) |
| + } |
| + // A second pass finds nothing to move. |
| + cs.reset() |
| + if err := fx.srv.fleetRelabelPass(ctx, now.Add(time.Minute)); err != nil { |
| + t.Fatal(err) |
| + } |
| + if n := cs.recordPuts(); n != 0 { |
| + t.Fatalf("a second pass wrote %d records", n) |
| + } |
| + } |
| + ``` |
| + |
| +- [ ] **Step 2: Write the edges**: |
| + - `TestDetachDoorMovesTheDetachedBoxesRecords`: as above but detach through the door, `detachAPI(t, fx, token, "pi-2", true)` must answer 200, and **with no worker pass** `b` and `c` are on `pi-1` with `FleetBoxMoved`. Same through `detachPage(t, fx, "pi-2", true)` as a subtest (`"page"`). |
| + - `TestSoleSurvivorMustBeAValidDestination`, subtests, each asserting `b` stays on `pi-2` and `recordPuts() == 0`: |
| + - `"stale"`: `piBeat(t, fx, "pi-1", true, now.Add(-21*time.Minute), release.FleetRecordLabelFloor)` before the pass; |
| + - `"draining"`: `if _, err := reg.SetFleetBoxDraining("pi", "pi-1", now.UnixNano()); err != nil { t.Fatal(err) }`; |
| + - `"rootfs not ready"`: `b` is `Runtime: provision.RuntimeRootfsV1` and `piBeat(..., "pi-1", false, now, ...)`; |
| + - `"below the label floor"`: survivor beats `v0.32.0`; the fleet is labelled, so the pass logs the pause and moves nothing (`labelsPausedBy`). |
| + - `TestDetachedStatelessRecordNeedsTheRuntimeFloor`: `statelessShopWorldOn(t, ..., map[string]string{"pi-1": release.StatelessRuntimeFloor, "pi-2": X})` puts the always-on stateless record on `pi-1`; mark `pi-1` labelled (`reg.MarkFleetBoxLabelled`) and detach it. Subtest `X = release.FleetBoxLabelFloor`: stays on `pi-1` (R3). Subtest `X = release.StatelessRuntimeFloor`: moves to `pi-2` with `FleetBoxMoved`. |
| + - `TestOneBoxFleetReadsNoInventoryWithoutAGoneLabelledBox`: `fleetBoxWorld(t, ..., "pi-1")` with a labelled record on `pi-1`; subtests `"never had a second box"` and `"detached box never labelled"` (`registerFleetBox(t, reg, "pi", "pi-2")` then detach it with `LabelledAt == 0`). Install `newCountStore`, run a pass, assert `cs.listsOf(provision.RecordsPrefix(fx.sqid, "shop")) == 0` and `recordPuts() == 0`. This pins the request budget. |
| + - `TestGoneLabelledBox`: table test over `[]registry.FleetBox`: one active plus one detached labelled is true; one active plus one detached unlabelled is false; two active plus one detached labelled is false (the ordinary view is already whole); zero active is false. |
| +- [ ] **Step 3: Run and confirm the failures:** |
| + `go test ./internal/console/ -run 'TestDetachedBoxRecordsMoveToTheSoleSurvivor|TestDetachDoorMovesTheDetachedBoxesRecords|TestSoleSurvivorMustBeAValidDestination|TestDetachedStatelessRecordNeedsTheRuntimeFloor|TestOneBoxFleetReadsNoInventoryWithoutAGoneLabelledBox|TestGoneLabelledBox' -count=1`. Expected: the first two and the moving stateless subtest FAIL (records stay on the detached box); `TestGoneLabelledBox` fails to compile until the helper exists (write the helper's signature with `return false` first so the rest compiles); the refusals PASS. |
| +- [ ] **Step 4: Implement** `goneLabelledBox`, `relabelView`, the pass and gate changes, `relabelAfterDetach` and the two door calls. |
| +- [ ] **Step 5: Run the new tests and the existing relabel, drain, detach and replica tests:** |
| + `go test ./internal/console/ -run 'TestDetached|TestDetachDoor|TestSoleSurvivor|TestOneBoxFleet|TestGoneLabelledBox|TestFirstLabellingIsOff|TestRelabel|TestLostBox|TestStatelessMove|TestDrain|TestBothDetachDoors|TestDetachRefusal|TestSilentBox|TestDetachSees|TestFleetDetachBox|TestLabelDoorDetachedBox|TestReplica|TestCopies|TestCreateSkipsStaleDrainingAndDetachedBoxes' -count=1`. Expected: PASS. If `TestDetachSeesARelabelThatLandsBeforeTheLock` or a replica test counts record writes across a detach, read why before changing it: the door now moves records, which is the intended change, and the test's assertion should be updated only if it pinned the old "nothing moves at detach" behaviour. |
| +- [ ] **Step 6:** `gofmt -l internal/console`, `go vet ./internal/console/`, `make census-card` (expect no changed unit). |
| +- [ ] **Step 7: Commit.** `console: move a detached box's records to the sole survivor` (body: #1008 T9 finding 2, the view rule, the detach-time relabel, R2/R3 unchanged). |
| + |
| +**Review focus for Astra:** `Complete` as the gate cannot admit a partial view; the one-box view is read only under `goneLabelledBox`; R2 (`FleetBoxMoved`) on every move; R3 on the survivor; the detach-time relabel runs under the lock the door holds and never changes the door's answer; host-claim consoles stay off. |
| + |
| +--- |
| + |
| +### Task 3: A restarted unindexed box reconciles on its first fast tick (P3) |
| + |
| +Findings: `.superpowers/sdd/2026-11-15-fleet-drain-followups/p3-findings.md` (read it; it carries the evidence and line numbers). |
| + |
| +**Cause.** After a restart a box with no record view (every fleet box; any box with the change index off) runs no reconcile until `instancesLoop`'s first pass, one minute after start (`internal/host/agent.go:4589`). The fast loop seeds the serial on its first read and does not run a pass for it (`agent.go:3380-3389`). Armed boxes get a boot full pass from `recordViewBackstop` setting `backstopFullDue` (`internal/host/changeindex.go:158-159`); unindexed boxes never do. |
| + |
| +**Files:** |
| +- Modify: `internal/host/agent.go` (or `changeindex.go`, beside the backstop): add `requestBootFullPass(v *provision.RecordView, due *atomic.Bool)` which stores true when `v == nil`; call it in `RunAgent` right after `v := armChangeIndex(...)` (`agent.go:~1076`), before `runHAIngressStartup` starts, with `&backstopFullDue`. Use the real types of `armChangeIndex`'s result and `backstopFullDue`; if they differ from the sketch, keep the behaviour. |
| +- Test: `internal/host` test file beside `TestFastTickActsOnSerialChangeNotBoot` (`agent_test.go:~1226`). |
| + |
| +**Behaviour.** `fastTick` takes the request on its first tick and `runFull` clears it (`agent.go:3460`, `:3587`). The serial seed rule is unchanged: this is a convergence pass, not a replay of the serial's restart/wake/schedule legs. Armed boxes are unchanged (the backstop owns the request). |
| + |
| +**Test `TestUnindexedBootRunsOneFullPass`** (deterministic, modelled on `TestDepartureInventoryNudgeWithoutIndex` in `hadepartures_inventory_test.go:~440`): |
| +1. `env := newFastFixture(t)`; bump the serial once (the label written while the agent was down). |
| +2. `var due atomic.Bool`; `passes := 0`; `d := env.deps(func(){ passes++ })`; `d.fullDue = &due` (use the fixture's actual field names). |
| +3. `requestBootFullPass(nil, &due)`; `fastTick(ctx, d, now)`: assert `passes == 1` and `!due.Load()`. |
| +4. `fastTick(ctx, d, now.Add(10*time.Second))`: assert `passes == 1`. |
| +5. Control: `requestBootFullPass(<non-nil view>, &due2)`: assert `!due2.Load()`. |
| +RED first: before the helper exists the test fails to compile; to show behavioural RED, temporarily assert step 3 without calling the helper and record that it fails with `passes == 0`. |
| + |
| +**Run:** `go test ./internal/host -run 'TestUnindexedBootRunsOneFullPass|TestFastTick|TestDepartureInventoryNudgeWithoutIndex|TestRecordViewBackstop' -count=1`. |
| + |
| +**Out of scope:** skipping `runHAIngressStartup` on fleet boxes (it times out in 5 s on a fleet box and logs "context deadline exceeded"); that needs the region HA owner's view and is filed on #1008. |
| + |
| +**Census:** this changes the root binary (`internal/host`): the controller runs `make census-card` / `census-propose` after the task. |
| + |
| +## Copy |
| + |
| +None. No CLI, console or email string is added or changed. `C07` ("%s is already tied to %s. nothing to do"), `C20`, `msgDrainStrandsApps` and `msgDrainBoxNotActive` stay as approved. New lines are console operator logs, in the style of the existing `console: fleet relabel` / `console: fleet drain` lines. |
| + |
| +## Census |
| + |
| +Tasks 1-2: none (`internal/console`, outside the root binary's scope; confirm with `make census-card`). Task 3 changes `internal/host`: census card needed (controller). |
| + |
| +## Deferred |
| + |
| +1. **P3** is now Task 3 (controller ruling 2026-11-15 after a read-only log investigation, p3-findings.md). Still deferred: skipping the startup HA ingress pass on fleet boxes (noise and wasted door GETs; needs the region HA owner), filed on #1008. |
| +2. **Label door answer for a record tied to a gone box** (P3 follow-up). When the detach-time relabel cannot move a record (no valid survivor, unmovable record, unverifiable manifest), `instances label` still says "already tied to box-2. nothing to do" for an instance that answers 503. A better answer names the gone box and the reason it has not moved. That is new copy for Paul's review, so it is not in this branch. |
| +3. **Replica assignments naming a detached box.** `relabelFleet` skips records with a `ReplicaAssignment`. Replica placement and `replicaDetachWarnings` own them; not re-checked here. |
| +4. **Drill note 4** (box-2's startup pass rewrote a binding with no lease). Spec §2 already treats bindings as evidence, not proof. No action. |
| +5. **Runbook.** `docs/fleet-runbook.md` could gain "Losing a box" (detach `--terminated` now moves the box's records to the survivors, restore-required) and "Trashed apps and drains". That is docs prose for Paul's copy review; propose it with the next copy batch. |
| + |
| +## Open questions |
| + |
| +None that need Paul. The rulings above (D-A option 1, D-B detach-time relabel, D-C defer) are the planner's. |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 9d511301e..c30c10e7f 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -224,3 +224,4 @@ plan14-root-reads-drain-quiesce-1062.tsv 66404a2fb26ea541e99d9c3d3bd87cb3f2a346e |
| plan14-root-reads-flat-plans.tsv 66404a2fb26ea541e99d9c3d3bd87cb3f2a346eda95cdb7d7838cab2fcd844f5 |
| plan14-root-reads-sr-followups.tsv da718fcd010b3c1db861196e0bbb9121723a9857ad16c2a15a329983688b8981 |
| plan14-root-reads-close-direct-s3-fleet-writes.tsv c6655e82e81ccd2a7547655eb393ec3fd10bba396255a1edb30d59b7ad1e682e |
| +plan14-root-reads-fleet-drain-followups.tsv c6655e82e81ccd2a7547655eb393ec3fd10bba396255a1edb30d59b7ad1e682e |
diff --git a/internal/provision/testdata/plan14-root-reads-fleet-drain-followups.tsv b/internal/provision/testdata/plan14-root-reads-fleet-drain-followups.tsv| new file mode 100644 |
| index 000000000..b7416db26 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-fleet-drain-followups.tsv |
| @@ -0,0 +1,4 @@ |
| +# Census overlay fleet-drain-followups, written by census-propose (#369). census-ruling-fleet-drain-followups, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-fleet-drain-followups.md. |
| +# 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added;rev3=census-ruling-stateless-replicas-4-merge-main2;basis=Merge of main af871da0 (v0.34.49): both sides changed it. Main (178dcfe5, member-backups-2a) moves the inline duty-view closure into armDutyView/dutyView and starts verifyAssignLoop; its sites drop by registry:Host and whole:Route x2 as main recorded them. This branch keeps its replica coordinator, swap worker and drive wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-drill3;basis=drill 3 R24: makes one in-memory channel, closes it (once) inside the edge's existing shutdown-started callback after ingress.shutdownStarted, and passes it to tunnelLoop, which drains only a fleet channel name; no read added, same six sites; touches no admission, lease, ingress drain, listener or file; the agent process, no root decision;rev3=census-ruling-edge-ppv2;basis=Agent (uid carlos), not root. memwatchLoop now gets edgeProxyCounters(&demoEdge) (in-process counters, no read). The drain socket's driver is newAgentDrainSocket(ingress, e, os.Getenv), which attaches the edge trust handler only when CARLOS_INGRESS_PROXY_SOURCES in the agent's environment (from the root-owned host.env) parses to a non-empty list; the socket is served when drainSocketServed: a group member or a configured ingress drain (both as before), or a box armed for PROXY protocol (new). The socket's path and agent-user-only permissions are unchanged. Read sites unchanged (6).;rev3=census-ruling-same-box-edge-fence;basis=Agent (uid carlos), not root. One added line: armEdgeFenceStatus(ctl.EdgeFence), beside the existing armExecSandboxStatus, so the layout report can ask root's /ready for the edge fence state over the control socket client the agent already holds. No read added.;rev3=census-ruling-platform-mail-submission;basis=Task 4: sets eb.Mail = mailsubmit.SocketForwarder{} on every box, and eb.MailSwitch to a mailSwitchCache's On that opens the deploy store itself through openDeployStore, retried at most once a minute with an error line until it opens (review round 1, Task 4 P3), armed for the serial-move refresh (armedMailSwitch). Task 6: also sets the ExecBackend's ManifestOf, the same staged-manifest read as TierOf (rt.App and RouteAccount(rt), hence +registry:App and +whole:Route), for the spawn-time check of decision 10, which logs and emits an event and never refuses. Agent, not root. Fable final P2-2: eb.MailSwitch is the cache's State (three-valued: on, off, unknown) in place of On; an unreadable switch is unknown, never off. No read added.;rev3=census-ruling-fleet-drain-followups;basis=P3 (#1008 T9): one call after armChangeIndex, requestBootFullPass(v, &backstopFullDue), which stores true in the existing in-memory backstopFullDue flag only when no record view is armed, so the fast loop runs its existing full pass on its first tick instead of instancesLoop a minute later; armed boxes unchanged. No read added; read sites unchanged (8); agent, not root. file:Exec@21625,file:Open@2191,file:Statfs@57331,registry:App@13287,registry:App@13665,whole:Route@13279,whole:Route@13657,whole:Route@50809 eaf6f3075d035d9736a67ec68758ffcca780d595855456fecc3662ce2c637b4f |
| +@coverage internal/host 7721c7076a9ecb2fbd9a6a5edfd089b6af3ddab84e2a45493383a81cf461dbce |