host: log each startup step's time up to the first full pass
A fleet box's first reconcile lands about 17 s after the agent starts (#964, #1008), and the journal did not say where the time goes. Log-only: one "agent: startup:" line per step, from agent start to the end of the first full pass: each duty before the fast converge loop (including the wait for the activator startup latch), each seed before the loop arms, the first fast tick, and every stage of the first full pass. Steps that read the deployment store add op counts and summed latency (fleet door and plain stores; S3 stores are timed only). Later passes keep today's slow-only logging. Lands alone so the next release's fleet box restarts give real numbers (8a3d302). Astra reviewed the task and approved the census (#280). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from fleet-first-reconcile-speed into main.
10 files changed,
+1,043
−14
docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed.md+29 −0docs/superpowers/plans/2026-11-15-fleet-first-reconcile.md+108 −0internal/host/agent.go+74 −6internal/host/changeindex.go+24 −7internal/host/startuptiming.go+433 −0internal/host/startuptiming_test.go+324 −0internal/provision/ffr_census_test.go+35 −0internal/provision/plan9_b8_census_test.go+1 −1internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed.tsv+14 −0
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed.md b/docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed.md| new file mode 100644 |
| index 000000000..850430bfa |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed.md |
| @@ -0,0 +1,29 @@ |
| +# Census approval: fleet-first-reconcile-speed |
| + |
| +Ruling `census-ruling-fleet-first-reconcile-speed`. The independent reviewer approves or rejects every change below, 3 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/host/agent.go` `fastConvergeLoop` | body | unchanged (1) | Startup timing log lines only (fleet first reconcile Task 1). Logs its entry offset and one line per arming step, then times the first tick. restartSeed, sidecarWakeSeed, refreshMovesHolds, refreshOfflineView and the one arming systemLeg.observe now read through countStore(store), a pass-through wrapper that counts and times each call and forwards it unchanged with the same key; for that observe, systemLeg.store is swapped to the wrapper and restored. For the first tick only, d.store is a fresh countStore(store) wrapper and d.startup a step logger; both are reset to the plain store and nil after the tick. passLegs gets startup. Same calls in the same order, no read added; read sites unchanged (1). Agent, not root. | |
| +| `internal/host/agent.go` `fastTick` | body | unchanged (1) | Startup timing log lines only: d.startup.done(<part>) calls between the existing parts and a deferred one after the sweep. d.startup is nil on every tick but the first after agent start, and its methods are then no-ops. No read added, no order change; read site unchanged (1). Agent, not root. | |
| +| `internal/host/agent.go` `runAgent` | body | unchanged (8) | Startup timing log lines only: runDuties builds a step logger (newStartupLog, which reads the in-memory agent start time) and logs one line after the wait on the activator startup latch and after each existing duty before go fastConvergeLoop. One newStartupLog().at line in the edge ready hook before go tunnelLoop. 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` `fastConvergeLoop`: authority, task B3. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): every pass context carries the box's lifetime judge (provision.WithLifetimes) and the reconcile config is boxProvisionConfig's; read sites unchanged, offsets moved; B3 authority retained;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 12: its pass config is now BoxProvisionConfig(reg, os.Getenv, judge, configure) (BoxProvisionConfig replaces boxProvisionConfig: the hub predicate hubArmed and, on the hub, ReconcileConfig.FleetOwners from hubFleetOwners); a call, no read site; read sites unchanged (2); B3 authority retained.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: wire the coordinator's nonblocking SignalTick to the existing fast tick. No new timer, polling read or authority.;rev3=census-ruling-region-ha-p3b;basis=Bind systemLeg to the existing cached reader fold and handle a nil leg on groups; names-2 rollback gate runs before artifact/request/marker work. Agent-memory evidence only, no new direct or cloud read and no autonomous group update.;rev3=census-ruling-restart-new-box-gap;basis=restart leg closure moved into armRestartLegs (same reg.List + restartRequestLeg); also wires restartGain; read moved, not added;rev3=census-ruling-agent-start-demo-3;basis=Attach the moved reader to the existing shared change watch and advertise that reader as armed. Census read-site delta: unchanged (2). |
| +- `internal/host/agent.go` `fastTick`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-stateless-replicas-4-task1;basis=Signals the owned replica swap worker (armedReplicaDeploy.tick) beside the placement worker on the existing tick; coalesced background pass, no timer, no bucket read. Its transitions go through the console's authenticated /deploy.;rev3=census-ruling-platform-mail-submission;basis=Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. Fable final P2-1: on a serial move, before the pass set and the restart leg, calls the armed cache's MarkStale (a counter bump under the cache's mutex; no I/O), so a spawn the move causes reads the switch again, bounded, instead of using an answer from before the move. No read added. |
| +- `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.;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. |
| + |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `internal/host/startuptiming.go:dirCountingStore.Open`: reads +file:Open; written legacy, accepted-legacy, frozen |
| +- new `internal/host/startuptiming.go:doorCountingStore.Open`: reads +file:Open; written legacy, accepted-legacy, frozen |
| +- new `internal/host/startuptiming.go:opCountingStore.open`: reads +file:Open; written legacy, accepted-legacy, frozen |
| + |
| +Seal: `f82b5e513d7434e1440c13aa4aa8bc06348745749a21593cf453f761ded0781b` → `9206205b2a3bf27b8b85310f4a44f94ef0c5886d85d6e55dbf2f22e073a8af11`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/plans/2026-11-15-fleet-first-reconcile.md b/docs/superpowers/plans/2026-11-15-fleet-first-reconcile.md| new file mode 100644 |
| index 000000000..890eccf66 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-15-fleet-first-reconcile.md |
| @@ -0,0 +1,108 @@ |
| +# Fleet box first reconcile: from ~17 s to a few seconds |
| + |
| +Source: `.superpowers/sdd/2026-11-15-fleet-first-reconcile/HANDOFF.md` (release |
| +manager 8a3d302, 2026-11-15) and the two witness reports beside it. No design |
| +spec: this is a latency fix under existing rules. Binding rules the fix must |
| +keep: the R1 stale-wake fence, R2 restore-required, lease and serving rules, |
| +region HA (spec §25 and §7.5 of the region HA design; CI must run the |
| +grouproll tests and the region_ha boundary test), moves spec §9.4 (an unbuilt |
| +moves hold view freezes every host), the offline keep view rule |
| +(movesoffline.go), and S3 cost (no new per-box polling). |
| + |
| +Review round limit: at most three cross-model rounds per task and for the |
| +branch. |
| + |
| +## Measured (dev r10r box-2, v0.36.2) |
| + |
| +Agent start → tunnel +0.2 s → "fast converge loop armed" +9.4 s → first fast |
| +tick ~2.3 s later → first pass reconcile stage ~9 s (the mint lands ~5 s into |
| +it, +17 s) → moves stage ~4 s. Nothing logged between tunnel and armed. |
| + |
| +## Global constraints |
| + |
| +- Fleet boxes read the deployment store through the store door |
| + (`internal/fleetapi` client, `internal/edge/storedoor.go` server): every |
| + Get/List/ListDirs is one HTTPS round trip over the tunnel. |
| +- Timing logs must stay quiet in steady state: first pass and startup only, |
| + no flag, no per-tick lines after the first full pass. |
| +- No new periodic store reads. Reordering or parallelizing existing reads is |
| + fine; adding reads is not, unless they replace more than they add. |
| +- Targeted tests only (`go test ./internal/host -run 'X|Y'`), never the full |
| + suite locally. Socket-binding packages need `TMPDIR=/tmp/g` with the |
| + sandbox off. |
| + |
| +## Phase 1: measure |
| + |
| +### Task 1: startup timing instrumentation |
| + |
| +Goal: one journal line per step from agent start to the end of the first |
| +full pass, each with its duration, its offset from agent start, and (where |
| +the step reads the deployment store) the store op counts and summed latency. |
| + |
| +1. A process-start instant for the agent (set at the top of `RunAgent`, or the |
| + earliest point the agent's own code runs) and a small helper, new file |
| + `internal/host/startuptiming.go`: |
| + - `countingStore`: a `release.Store` wrapper with atomic counters per op |
| + (Get, Put, List, ListDirs, Delete) and summed wall time per op, and a |
| + cheap snapshot/diff so a step can report only its own ops. It must pass |
| + through any optional interfaces the wrapped store implements that |
| + callers type-assert on (check `release` and `internal/host` for |
| + type assertions on a Store, e.g. ETag listing, indexed stores); if a |
| + pass-through is impractical, do not wrap that call site and log time |
| + only. |
| + - a step logger: `agent: startup: <step> took <d> at +<since start> |
| + (store: get N/<t>, list N/<t>, dirs N/<t>)`, op part omitted when zero |
| + or not counted. |
| +2. In `fastConvergeLoop` (internal/host/agent.go, around lines 3740-3855): |
| + log the loop's entry offset, then time each pre-arm step: `heldHolds` |
| + setup, `restartSeed`, `armRestartLegs`, `sidecarWakeSeed`, |
| + `refreshMovesHolds`, `refreshOfflineView`, `runRunsBootPass`, |
| + `sd.converge`, `systemLeg.observe`, and anything else between them that |
| + can block on I/O. Pass the counting wrapper as the store argument for the |
| + steps that take one. Also log what RunAgent does between "tunnel |
| + connected" and starting `fastConvergeLoop` if any of it is synchronous |
| + and could block (find out; report it). |
| +3. The first fast tick: log the sleep before it and time each part of the |
| + first `fastTick` that reads the store (observeIndex, moved reader, box |
| + role reader, restartGain, ReadSerial, the full pass). |
| +4. The first full pass (`passLegs.run`, internal/host/changeindex.go): log |
| + every stage unconditionally with store op counts for the first run only |
| + (later runs keep today's `logSlow` behaviour). Use a counting wrapper on |
| + the store for that run only. |
| +5. Inside reconcile, on the first pass only: an optional trace hook (nil by |
| + default, e.g. a `Trace func(stage string)` on `provision.ReconcileConfig` |
| + or on reconcileSerialized's path) that the first pass sets, so the journal |
| + shows reconcile's own sub-stages (record listing, record reads, policy |
| + reads, mint, whatever the code's real phases are) with offsets. Keep the |
| + hook's call sites few and coarse. |
| +6. Tests: the counting store counts and diffs correctly (unit test); the |
| + first-pass-only rule holds (a second `run` logs nothing when fast). Use a |
| + captured logger, no sleeps. |
| + |
| +### Task 2: local measurement with a slow door |
| + |
| +Goal: the per-step op counts and a latency model, without a dev box. |
| + |
| +1. A test in `internal/host`, skipped unless `CARLOS_MEASURE_STARTUP=1`, that |
| + builds a realistic fleet store using the two-box harness |
| + (`internal/host/fleettwobox_e2e_test.go`, `newFleetWorld`) or the lighter |
| + fixtures it uses: one fleet, two boxes, ~20 instances placed on the box |
| + under test, with policies, moves and the rest a drill fleet carries. |
| +2. Wrap the box's store in a fake door: each op sleeps a fixed latency |
| + (default 60 ms, env-overridable) then counts. Run the same startup steps |
| + Task 1 instruments, in production order, through the same helpers, then |
| + one full pass, and write a table (step, ops by kind, wall time) to the |
| + report file. |
| +3. Report which steps' op counts grow with the number of instances or |
| + records (run at 5 and 20 instances), and which reads are serial and |
| + independent (candidates to parallelize). |
| + |
| +## Phase 2: fix (tasks written after Phase 1's numbers) |
| + |
| +Levers named by the handoff, to be chosen from the numbers: arm the loop |
| +and run the first pass before seeds that do not gate it; run the first pass |
| +on arming rather than after a tick's sleep; parallelize or batch the store |
| +door reads inside reconcile and the moves pass, with S3 cost flat; mint |
| +already-owned records before the moves stage. Deterministic witnesses: |
| +barrier or fake-clock tests showing the first reconcile is not gated by the |
| +seeds or the moves pass. |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index 7d4920c78..c1e2d5ae6 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -243,6 +243,8 @@ func dataDirFrom(getenv func(string) string) string { |
| // account or region IMDS did not answer within 2 seconds is asked for |
| // again every minute. |
| func RunAgent(args []string) { |
| + // The instant every startup timing line is measured from (startuptiming.go). |
| + markAgentStart(time.Now()) |
| groupBoot, err := loadGroupConfiguration(os.Getenv) |
| if err != nil { |
| log.Fatal(err) |
| @@ -996,6 +998,9 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| dutiesDone := make(chan struct{}) |
| runDuties := func() { |
| defer close(dutiesDone) |
| + // Startup timing: each duty below runs in turn before the fast |
| + // converge loop starts, so each is timed. |
| + duties := newStartupLog().steps("duties: ", nil) |
| select { |
| case <-started: |
| case <-startupCtx.Done(): |
| @@ -1004,6 +1009,7 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| if startupCtx.Err() != nil { |
| return |
| } |
| + duties.done("wait for the activator startup") |
| // Fleet box binding publish, startup half (customer-fleets plan, Task 6): |
| // a one-shot pass over every route already resident in this box's local |
| @@ -1021,6 +1027,7 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| } |
| go publishResidentFleetBindings(fleetStore, identity.Fleet, identity.Label, reg) |
| } |
| + duties.done("fleet bindings") |
| // Scheduled work (schedule spec §6.2/§6.3), built ONCE here and shared by |
| // all three legs below: the seed and the fast leg in fastConvergeLoop, the |
| @@ -1059,6 +1066,7 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| if sd != nil { |
| sd.runner.Start(context.Background()) // runs until the process ends, like every loop below |
| } |
| + duties.done("schedule") |
| serialClaims := make(chan struct{}, 1) |
| regionalReport := func(err error) { log.Printf("agent: regional claims: %v", err) } |
| if hostwrite.Enabled(claimEntryEnv(claimCtx)) && moves.Enabled(os.Getenv) { |
| @@ -1067,13 +1075,16 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| if err := claims.startRegional(agentCtx, serialClaims, regionalReport); err != nil { |
| log.Fatalf("agent: regional claims: %v", err) |
| } |
| + duties.done("regional claims") |
| // The relocation pass (stage B Task 10): it says itself what it started. |
| startRelocationPass(agentCtx, claimCtx, claims, reg, svc) |
| + duties.done("relocation pass") |
| // The change index (S3 change-index design §4): armed before the |
| // loops that read through it, with its backstop running from here. |
| // Without an index the backstop loop handles early full-pass requests. |
| v := armChangeIndex(agentCtx, os.Getenv, openDeployStore) |
| + duties.done("change index") |
| // Requested here, not in the backstop loop: that loop starts only |
| // once the HA ingress startup pass returns, tens of seconds later. |
| requestBootFullPass(v, &backstopFullDue) |
| @@ -1088,6 +1099,7 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| // box), before any loop that reconciles. |
| admission.armRoles(agentCtx, os.Getenv, metricsBoxLabel(os.Getenv, readMachineID())) |
| armPolicyCache() |
| + duties.done("box roles and policy cache") |
| startDemoWorker(agentCtx, reg, demoData, cfg.Prefix, traffic, stopDemoTraffic, func(w *demoWorker) { |
| w.claimActivator = svc |
| w.wireDemoClaimSnapshot(instancectl.NewClient(controlsock.Path), dd) |
| @@ -1099,6 +1111,7 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| } |
| servingWorker.Store(w) |
| }) |
| + duties.done("demo worker") |
| go adoptLoop(reg, svc, sd, claims.Writes) |
| go fastConvergeLoop(reg, svc, sd, claims.Writes, serialClaims, bs, boxJudge, claims.Providers.Provision) |
| if logSink != nil { |
| @@ -1337,6 +1350,7 @@ func runAgent(args []string, buildClaims ClaimFactory) { |
| serveHADrainSocket(healthCtx, haDrainSocketPath, driver) |
| }() |
| } |
| + newStartupLog().at("edge ready, tunnel loop starting") |
| go tunnelLoop(e, tunnelDrain) |
| // The home side of a linked deployment (linked deployments spec |
| // §6.2): a second, registry-driven loop that dials the link's hub |
| @@ -2906,6 +2920,11 @@ type fastDeps struct { |
| // the agent armed (restartGainSeed), so the first restart request after |
| // a fresh box comes up is acted on. nil = not armed. |
| restartGain func(ctx context.Context, now time.Time) |
| + |
| + // startup times the parts of the first tick after the agent starts |
| + // (startuptiming.go); nil on every other tick, where its calls do |
| + // nothing. |
| + startup *startupSteps |
| } |
| // canaryRead is one canary group's last good pointer read: the head it |
| @@ -3357,13 +3376,17 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| if d.coordinator != nil { |
| d.coordinator.SignalTick() |
| } |
| + d.startup.done("replica workers") |
| // The index is observed BEFORE any pass this tick runs, so a pass covers |
| // at least what was observed and indexActed can take it afterwards. |
| obs, indexOK := d.observeIndex(ctx) |
| + d.startup.done("change index") |
| if err := d.movedReader.pass(ctx, d.store, d.reg, d.pub, now); err != nil { |
| log.Printf("agent: demo moved: %v", err) |
| } |
| + d.startup.done("moved reader") |
| armedBoxRoleReader.Load().pass(ctx, now) |
| + d.startup.done("box role reader") |
| // Before the serial read, on every tick: an app this box gained since the |
| // agent armed gets its restart baseline now, while nobody has asked for |
| // anything, rather than on the serial move that carries the first request |
| @@ -3372,8 +3395,10 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| if d.restartGain != nil { |
| d.restartGain(ctx, now) |
| } |
| + d.startup.done("restart gain") |
| fullRan := false |
| doc, _, err := release.ReadSerial(ctx, d.store) |
| + d.startup.done("serial read") |
| switch { |
| case err != nil: |
| if !d.serialBroken { |
| @@ -3406,6 +3431,7 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| } |
| d.runFull(ctx) |
| fullRan = true |
| + d.startup.done("full pass") |
| if d.restartLeg != nil { |
| d.restartLeg(ctx) |
| } |
| @@ -3455,6 +3481,7 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| } |
| d.lastSerial = doc.Serial |
| d.lastFull = now |
| + d.startup.done("serial move legs") |
| } |
| } |
| @@ -3464,9 +3491,11 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| d.runFull(ctx) |
| fullRan = true |
| d.lastFull = now |
| + d.startup.done("full pass") |
| } |
| // An index-only change runs the scoped pass (spec §4.5). |
| d.indexTick(ctx, now, obs, indexOK, fullRan) |
| + d.startup.done("index tick") |
| // The self-update tick, outside the serial switch and before the sweep's |
| // early return: it is what runs a spread deadline down and re-touches an |
| @@ -3482,11 +3511,13 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| if d.mintLeg != nil { |
| d.mintLeg(ctx) |
| } |
| + d.startup.done("system tick and mint asker") |
| members := d.fastMembers(now) |
| if len(members) == 0 { |
| return // zero store reads: no PassFilter, no bake-clock write |
| } |
| + defer d.startup.done(fmt.Sprintf("sweep of %d routes", len(members))) |
| defer logSlow("fast sweep", time.Now(), fmt.Sprintf("%d routes", len(members))) |
| member := map[string]bool{} |
| for _, h := range members { |
| @@ -3672,6 +3703,13 @@ func (d *fastDeps) indexTick(ctx context.Context, now time.Time, obs map[string] |
| // Thin and untested by convention, like adoptLoop/statusLoop — the tick's |
| // whole decision lives in fastTick/fastMembers, which are tested. |
| func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *scheduleDeps, writes hostwrite.Config, serialNotify chan<- struct{}, bs *buildStates, judge *provision.LifetimeJudge, configure ...func(*provision.ReconcileConfig)) { |
| + // Startup timing (startuptiming.go): every step before the loop arms, |
| + // the first tick and the first full pass each get a line. The seeds |
| + // read through a counting wrapper (seedStore); what is kept for the |
| + // loop's life holds the plain store. |
| + startup := newStartupLog() |
| + startup.at("fast converge loop entered") |
| + arming := startup.steps("arming: ", nil) |
| // Every pass this loop runs carries the box's judge (newBoxJudge). |
| ctx := provision.WithLifetimes(context.Background(), judge) |
| store, err := openDeployStore(ctx) |
| @@ -3679,6 +3717,9 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| declinedHoldsStay("no deploy store") |
| return // adoptLoop already logged this |
| } |
| + seedStore, seedOps := countStore(store) |
| + arming.done("deploy store") |
| + arming.count(seedOps) |
| pub, err := release.ParsePublicKey(os.Getenv("CARLOS_RELEASE_PUBKEY"), "CARLOS_RELEASE_PUBKEY") |
| if err != nil { |
| declinedHoldsStay("no release key") |
| @@ -3731,6 +3772,7 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| // (spec §11). |
| restartMem.pub = pub |
| restartMem.retryHost = rolloutRetryHost() |
| + arming.done("pass options") |
| // The declined box's pointer pass (Task 10, ruling 194): `carlos promote |
| // --retry` clears a record, a signed rollback a marker, read through |
| // the same verified pointer read the armed scheduler uses, at most |
| @@ -3740,7 +3782,9 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| return release.Channel(ctx, store, pub, acct, app, channel) |
| }) |
| } |
| - restartSeed(ctx, reg, store, dd, restartMem) |
| + arming.done("held holds") |
| + restartSeed(ctx, reg, seedStore, dd, restartMem) |
| + arming.done("restart seed") |
| // The seed alone is not enough on a fresh box: its agent arms before |
| // reconcile has minted a route, so the seed sees no apps, and the leg |
| // runs only on a serial move. The gain hook baselines each app as its |
| @@ -3748,24 +3792,29 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| // after a replacement box comes up is acted on, not taken as the |
| // baseline. |
| restartGain, restartLeg := armRestartLegs(reg, store, dd, restartMem, bounceFn(svc), wakeFn(svc)) |
| + arming.done("restart legs") |
| // The sidecar wake leg's own memory, seeded the same way and for the |
| // same reason: one silent read per served sidecar at arming so the |
| // FIRST wake request after a boot is acted on rather than swallowed as |
| // the baseline (sidecarWakeSeed's own doc comment). |
| sidecarWakeMem := newSidecarWakeMemory(writes.Enabled) |
| - sidecarWakeSeed(ctx, reg, store, sidecarWakeMem) |
| + sidecarWakeSeed(ctx, reg, seedStore, sidecarWakeMem) |
| sidecarWake := wakeFn(svc) |
| + arming.done("sidecar wake seed") |
| // The moves hold view, built before the converge below: that converge |
| // runs before the first moves pass, and an unbuilt view freezes every |
| // host (moves spec §9.4). Nothing with the Phase 1 switch off. |
| - refreshMovesHolds(ctx, store) |
| + refreshMovesHolds(ctx, seedStore) |
| + arming.done("moves holds") |
| // The offline keep view, likewise before any reconcile pass: once it is |
| // read, keep answers false for every host with no offline move, so the |
| // first pass removes what it always has (movesoffline.go). |
| - refreshOfflineView(ctx, store, armedOfflineView()) |
| + refreshOfflineView(ctx, seedStore, armedOfflineView()) |
| + arming.done("offline view") |
| // carlos run's boot pass (run spec §5.2, index item 2): reconcile's |
| // first pass is a minute away and the CLI expires a run at 60 s. |
| runRunsBootPass(ctx) |
| + arming.done("runs boot pass") |
| // The schedule converge's own seed, on restartSeed's precedent and for the |
| // same shape of reason: the leg below runs only on a serial MOVE, so |
| // without one pass here a box that booted after the bump would carry no |
| @@ -3776,6 +3825,7 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| if err := sd.converge(ctx); err != nil { |
| log.Printf("agent: schedule converge (start): %v", err) |
| } |
| + arming.done("schedule converge") |
| d.restart = restart |
| d.passOpts = opts |
| // The scheduler's pass with CARLOS_SWAP=overlap armed, nothing while |
| @@ -3791,7 +3841,7 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| // making it — and it is what lets a recovery promote through the console |
| // converge immediately even mid-hold. |
| legs := &passLegs{store: store, reg: reg, pub: pub, optDir: optDir, restart: restart, opts: opts, |
| - priv: priv, dd: dd, svc: svc, writes: writes, bs: bs, |
| + priv: priv, dd: dd, svc: svc, writes: writes, bs: bs, startup: startup, |
| cfg: func() provision.ReconcileConfig { |
| return BoxProvisionConfig(reg, os.Getenv, judge, configure) |
| }} |
| @@ -3840,6 +3890,7 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| // ever fetches into /data and writes a request. It lives here rather than |
| // in a loop of its own because the spread deadline needs a seconds |
| // cadence to run down on, and this is the loop that already has one. |
| + arming.done("loop wiring") |
| d.systemLeg = newSystemLeg(store, pub, os.Getenv, dd, optDir) |
| if d.systemLeg != nil { |
| d.systemLeg.readers = cachedGroupReaders |
| @@ -3848,13 +3899,30 @@ func fastConvergeLoop(reg *registry.Registry, svc *activator.Service, sd *schedu |
| // (re)starts under an already-promoted pointer would otherwise sit on the |
| // old build for up to an hour with nobody to bump the serial. observe |
| // handles "no pointer" itself, which is every deployment before its first |
| - // `carlos system update`. |
| + // `carlos system update`. Read through the counting wrapper for |
| + // this one observe only. |
| + d.systemLeg.store = seedStore |
| d.systemLeg.observe(ctx) |
| + d.systemLeg.store = store |
| } |
| + arming.done("system pointer") |
| + arming.total("total") |
| log.Printf("agent: fast converge loop armed (2s + jitter: serial poll + canary/* + unstaged routes + system pointer)") |
| + first := true |
| for { |
| time.Sleep(fastTickEvery + rand.N(time.Second)) |
| + if !first { |
| + fastTick(ctx, d, time.Now()) |
| + continue |
| + } |
| + // The first tick, timed part by part, its own reads counted. |
| + first = false |
| + arming.done("first tick wait") |
| + tickStore, tickOps := countStore(store) |
| + d.store, d.startup = tickStore, startup.steps("first tick: ", tickOps) |
| fastTick(ctx, d, time.Now()) |
| + d.startup.total("total") |
| + d.store, d.startup = store, nil |
| } |
| } |
diff --git a/internal/host/changeindex.go b/internal/host/changeindex.go| index 5cce83ff3..43883d9e3 100644 |
| --- a/internal/host/changeindex.go |
| +++ b/internal/host/changeindex.go |
| @@ -376,6 +376,12 @@ type passLegs struct { |
| writes hostwrite.Config |
| bs *buildStates |
| cfg func() provision.ReconcileConfig // read per pass, as provisionTickConfig always was |
| + |
| + // startup, when set, times the first run's stages, one line each with |
| + // the store ops each made |
| + // (startuptiming.go). Later runs log only when slow, as before. |
| + startup *startupLog |
| + firstRan atomic.Bool |
| } |
| // passAfterReconcileHook, when set, runs in every pass right after its |
| @@ -411,15 +417,26 @@ func (l *passLegs) run(ctx context.Context, what string, keep func(registry.Rout |
| // journal says WHICH stage held a promote back. |
| var took []string |
| t := time.Now() |
| + // The first run after start reads through a counting wrapper and logs |
| + // every stage; store is l.store on every other run. |
| + store := l.store |
| + var stages *startupSteps |
| + if l.startup != nil && l.firstRan.CompareAndSwap(false, true) { |
| + var ops *storeCounter |
| + store, ops = countStore(l.store) |
| + stages = l.startup.steps("first pass: ", ops) |
| + defer stages.total("total") |
| + } |
| mark := func(name string) { |
| took = append(took, fmt.Sprintf("%s %s", name, time.Since(t).Round(100*time.Millisecond))) |
| t = time.Now() |
| + stages.done(name) |
| } |
| defer func(start time.Time) { logSlow(what, start, strings.Join(took, ", ")) }(time.Now()) |
| cfg := l.cfg() |
| cfg.PolicyScope = policyScope |
| - if err := reconcileSerialized(ctx, l.store, l.reg, cfg); err != nil { |
| + if err := reconcileSerialized(ctx, store, l.reg, cfg); err != nil { |
| log.Printf("agent: fast converge reconcile: %v", err) |
| } |
| mark("reconcile") |
| @@ -434,19 +451,19 @@ func (l *passLegs) run(ctx context.Context, what string, keep func(registry.Rout |
| l.bs.refreshKept(ctx, keep) |
| mark("build states") |
| } |
| - telemetryPass(ctx, l.store, l.reg) |
| + telemetryPass(ctx, store, l.reg) |
| mark("telemetry") |
| // The plans pass is box-wide (the marker, then every served account's |
| // limits record, published as one whole snapshot), so a scoped pass |
| // leaves it out: the full pass, the instances floor and the backstop's |
| // full pass run it. |
| if keep == nil { |
| - plansPass(ctx, l.store, l.reg, os.Getenv) |
| + plansPass(ctx, store, l.reg, os.Getenv) |
| mark("plans") |
| } |
| // The moves pass takes its own snapshot inside w.pass (spec §4.3): it |
| // is handed the plain store, never this pass's reconcile snapshot. |
| - runMovesPass(ctx, l.store) |
| + runMovesPass(ctx, store) |
| mark("moves") |
| runRunsPass(ctx) |
| mark("runs") |
| @@ -471,17 +488,17 @@ func (l *passLegs) run(ctx context.Context, what string, keep func(registry.Rout |
| // the domain claims, not the record families, so they read the |
| // bucket. The pass's report feeds the box's domain confirmed time |
| // (edge asset cache design §4.2). |
| - if err := aliasPassReporting(ctx, l.store, l.reg, &aliasClaimCache, boxAssetAuthority, cfg.Region); err != nil { |
| + if err := aliasPassReporting(ctx, store, l.reg, &aliasClaimCache, boxAssetAuthority, cfg.Region); err != nil { |
| log.Printf("agent: fast converge alias pass: %v", err) |
| } |
| mark("aliases") |
| } |
| - if err := release.PassFilter(ctx, l.reg, l.store, l.pub, l.optDir, l.restart, keep, l.opts...); err != nil { |
| + if err := release.PassFilter(ctx, l.reg, store, l.pub, l.optDir, l.restart, keep, l.opts...); err != nil { |
| log.Printf("agent: fast converge adopt pass: %v", err) |
| } |
| mark("adopt") |
| if l.priv != nil { |
| - if err := syncExecSerializedFiltered(ctx, keep, l.reg, l.store, l.priv, l.dd, l.svc, l.writes); err != nil { |
| + if err := syncExecSerializedFiltered(ctx, keep, l.reg, store, l.priv, l.dd, l.svc, l.writes); err != nil { |
| log.Printf("agent: fast converge config sync: %v", err) |
| } |
| mark("config") |
diff --git a/internal/host/startuptiming.go b/internal/host/startuptiming.go| new file mode 100644 |
| index 000000000..5004ed6d6 |
| --- /dev/null |
| +++ b/internal/host/startuptiming.go |
| @@ -0,0 +1,433 @@ |
| +package host |
| + |
| +// Startup timing (fleet first reconcile, Task 1). A fleet box's first |
| +// reconcile landed about 17 s after its agent started, and nothing in the |
| +// journal said where the time went. These helpers print one line per step |
| +// from agent start to the end of the first full pass: |
| +// |
| +// agent: startup: <step> took <d> at +<since start> (store: get N/<t>, list N/<t>, dirs N/<t>) |
| +// |
| +// "at" is the step's END, as an offset from agent start, so the lines read |
| +// as a timeline in journal order. The store part counts only the deployment |
| +// store operations made through an opCountingStore during that step, and is |
| +// left off when there were none or the store could not be counted. |
| +// |
| +// Steady state prints nothing new: every caller below builds its lines for |
| +// the first pass after start only. |
| + |
| +import ( |
| + "context" |
| + "fmt" |
| + "io" |
| + "log" |
| + "strings" |
| + "sync/atomic" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// processStart is when this package was initialised, the fallback agent |
| +// start for a process that never ran RunAgent (tests, the CLI). |
| +var processStart = time.Now() |
| + |
| +// agentStartAt is the agent's start instant, set once at the top of |
| +// RunAgent. A pointer to a time.Time so the monotonic reading survives. |
| +var agentStartAt atomic.Pointer[time.Time] |
| + |
| +// markAgentStart records t as the agent's start. |
| +func markAgentStart(t time.Time) { agentStartAt.Store(&t) } |
| + |
| +// agentStart is the agent's start instant, or the process's when RunAgent |
| +// has not marked one. |
| +func agentStart() time.Time { |
| + if t := agentStartAt.Load(); t != nil { |
| + return *t |
| + } |
| + return processStart |
| +} |
| + |
| +// ---- store op counts -------------------------------------------------------- |
| + |
| +type storeOp int |
| + |
| +const ( |
| + opGet storeOp = iota |
| + opList |
| + opDirs |
| + opPut |
| + opDelete |
| + numStoreOps |
| +) |
| + |
| +var storeOpNames = [numStoreOps]string{"get", "list", "dirs", "put", "delete"} |
| + |
| +// storeOps is a snapshot of a storeCounter: per op, how many calls and their |
| +// summed wall time. |
| +type storeOps struct { |
| + n [numStoreOps]int64 |
| + t [numStoreOps]time.Duration |
| +} |
| + |
| +// minus is o less an earlier snapshot p: the ops made between the two. |
| +func (o storeOps) minus(p storeOps) storeOps { |
| + var d storeOps |
| + for i := range d.n { |
| + d.n[i] = o.n[i] - p.n[i] |
| + d.t[i] = o.t[i] - p.t[i] |
| + } |
| + return d |
| +} |
| + |
| +// String is "get N/<t>, list N/<t>, ..." over the ops with any calls, or "" |
| +// when there were none. |
| +func (o storeOps) String() string { |
| + var parts []string |
| + for i, name := range storeOpNames { |
| + if o.n[i] > 0 { |
| + parts = append(parts, fmt.Sprintf("%s %d/%s", name, o.n[i], o.t[i].Round(time.Millisecond))) |
| + } |
| + } |
| + return strings.Join(parts, ", ") |
| +} |
| + |
| +// storeCounter is the live counts an opCountingStore adds to. Safe for |
| +// concurrent use; a nil counter counts nothing and snapshots as zero. |
| +type storeCounter struct { |
| + n [numStoreOps]atomic.Int64 |
| + t [numStoreOps]atomic.Int64 // nanoseconds |
| +} |
| + |
| +func (c *storeCounter) record(op storeOp, start time.Time) { c.add(op, time.Since(start)) } |
| + |
| +// add counts one op of op that took d. |
| +func (c *storeCounter) add(op storeOp, d time.Duration) { |
| + c.n[op].Add(1) |
| + c.t[op].Add(int64(d)) |
| +} |
| + |
| +func (c *storeCounter) snapshot() storeOps { |
| + var o storeOps |
| + if c == nil { |
| + return o |
| + } |
| + for i := range o.n { |
| + o.n[i] = c.n[i].Load() |
| + o.t[i] = time.Duration(c.t[i].Load()) |
| + } |
| + return o |
| +} |
| + |
| +// ---- the counting wrapper --------------------------------------------------- |
| + |
| +// opCountingStore is a release.Store that counts and times every call it |
| +// passes to the store it wraps. Only the five Store methods: it is the |
| +// wrapper for a store with none of release's optional interfaces. |
| +// countStore picks the shape that matches the wrapped store exactly. |
| +type opCountingStore struct { |
| + inner release.Store |
| + c *storeCounter |
| +} |
| + |
| +func (s *opCountingStore) Get(ctx context.Context, key string) ([]byte, string, error) { |
| + defer s.c.record(opGet, time.Now()) |
| + return s.inner.Get(ctx, key) |
| +} |
| + |
| +func (s *opCountingStore) Put(ctx context.Context, key string, body []byte, ifMatch string) (string, error) { |
| + defer s.c.record(opPut, time.Now()) |
| + return s.inner.Put(ctx, key, body, ifMatch) |
| +} |
| + |
| +func (s *opCountingStore) List(ctx context.Context, prefix string) ([]string, error) { |
| + defer s.c.record(opList, time.Now()) |
| + return s.inner.List(ctx, prefix) |
| +} |
| + |
| +func (s *opCountingStore) ListDirs(ctx context.Context, prefix string) ([]string, error) { |
| + defer s.c.record(opDirs, time.Now()) |
| + return s.inner.ListDirs(ctx, prefix) |
| +} |
| + |
| +func (s *opCountingStore) Delete(ctx context.Context, key string) error { |
| + defer s.c.record(opDelete, time.Now()) |
| + return s.inner.Delete(ctx, key) |
| +} |
| + |
| +// open counts an Open as a get. The time is to the reader's return, not |
| +// to the end of the body. |
| +func (s *opCountingStore) open(ctx context.Context, key string) (io.ReadCloser, string, error) { |
| + defer s.c.record(opGet, time.Now()) |
| + return s.inner.(release.Opener).Open(ctx, key) |
| +} |
| + |
| +func (s *opCountingStore) listETags(ctx context.Context, prefix string) ([]release.KeyETag, error) { |
| + defer s.c.record(opList, time.Now()) |
| + return s.inner.(release.ETagLister).ListETags(ctx, prefix) |
| +} |
| + |
| +// doorCountingStore is the shape of the fleet store door (fleetapi): Store, |
| +// Opener and ETagLister. |
| +type doorCountingStore struct{ *opCountingStore } |
| + |
| +func (s doorCountingStore) Open(ctx context.Context, key string) (io.ReadCloser, string, error) { |
| + return s.open(ctx, key) |
| +} |
| + |
| +func (s doorCountingStore) ListETags(ctx context.Context, prefix string) ([]release.KeyETag, error) { |
| + return s.listETags(ctx, prefix) |
| +} |
| + |
| +// dirCountingStore is the shape of release.DirStore, the single-box and test |
| +// store: every optional interface DirStore implements, forwarded. |
| +type dirCountingStore struct{ *opCountingStore } |
| + |
| +func (s dirCountingStore) Open(ctx context.Context, key string) (io.ReadCloser, string, error) { |
| + return s.open(ctx, key) |
| +} |
| + |
| +func (s dirCountingStore) ListETags(ctx context.Context, prefix string) ([]release.KeyETag, error) { |
| + return s.listETags(ctx, prefix) |
| +} |
| + |
| +func (s dirCountingStore) PutFrom(ctx context.Context, key string, body io.ReadSeeker, size int64, ifMatch string) (string, error) { |
| + defer s.c.record(opPut, time.Now()) |
| + return s.inner.(release.PutStreamer).PutFrom(ctx, key, body, size, ifMatch) |
| +} |
| + |
| +func (s dirCountingStore) ListPage(ctx context.Context, prefix, startAfter string, limit int) ([]string, error) { |
| + defer s.c.record(opList, time.Now()) |
| + return s.inner.(release.PageLister).ListPage(ctx, prefix, startAfter, limit) |
| +} |
| + |
| +func (s dirCountingStore) ListMod(ctx context.Context, prefix string) ([]release.KeyMod, error) { |
| + defer s.c.record(opList, time.Now()) |
| + return s.inner.(release.ModLister).ListMod(ctx, prefix) |
| +} |
| + |
| +func (s dirCountingStore) ListSizes(ctx context.Context, prefix string) ([]release.KeySize, error) { |
| + defer s.c.record(opList, time.Now()) |
| + return s.inner.(release.SizeLister).ListSizes(ctx, prefix) |
| +} |
| + |
| +func (s dirCountingStore) GetIfChanged(ctx context.Context, key, etag string) ([]byte, string, bool, error) { |
| + defer s.c.record(opGet, time.Now()) |
| + return s.inner.(release.ConditionalGetter).GetIfChanged(ctx, key, etag) |
| +} |
| + |
| +func (s dirCountingStore) DeleteIfMatch(ctx context.Context, key, etag string) error { |
| + defer s.c.record(opDelete, time.Now()) |
| + return s.inner.(release.ConditionalDeleter).DeleteIfMatch(ctx, key, etag) |
| +} |
| + |
| +func (s dirCountingStore) DeleteRevision(ctx context.Context, key, etag string) error { |
| + defer s.c.record(opDelete, time.Now()) |
| + return s.inner.(release.IndexedDeleter).DeleteRevision(ctx, key, etag) |
| +} |
| + |
| +// IndexDeletion bumps the change index: a read and a write, counted as a put. |
| +func (s dirCountingStore) IndexDeletion(ctx context.Context, key string) error { |
| + defer s.c.record(opPut, time.Now()) |
| + return s.inner.(release.IndexedDeleter).IndexDeletion(ctx, key) |
| +} |
| + |
| +func (s dirCountingStore) DeleteKeys(ctx context.Context, keys []string) error { |
| + defer s.c.record(opDelete, time.Now()) |
| + return s.inner.(release.BatchDeleter).DeleteKeys(ctx, keys) |
| +} |
| + |
| +// The optional interfaces callers type-assert a Store on. A wrapper must |
| +// answer each assertion as the wrapped store would: a wrapper that has an |
| +// extension the store lacks, or lacks one it has, changes what its caller |
| +// does. So countStore wraps only a store whose set is exactly one of the |
| +// shapes above, and returns any other store as it is, uncounted. |
| +const ( |
| + extOpener storeExt = 1 << iota |
| + extPutStreamer |
| + extPageLister |
| + extModLister |
| + extSizeLister |
| + extConditionalGetter |
| + extETagLister |
| + extConditionalDeleter |
| + extIndexedDeleter |
| + extBatchDeleter |
| + extStampedGetter |
| + extCountedDirLister |
| + extVersionPager |
| + extVersionDeleter |
| + extVersionDirLister |
| + extBucketListDirs |
| + extAppMutationRunner |
| +) |
| + |
| +type storeExt uint32 |
| + |
| +const ( |
| + plainShape = storeExt(0) |
| + doorShape = extOpener | extETagLister |
| + dirShape = extOpener | extPutStreamer | extPageLister | extModLister | extSizeLister | |
| + extConditionalGetter | extETagLister | extConditionalDeleter | extIndexedDeleter | extBatchDeleter |
| +) |
| + |
| +func storeExts(s release.Store) storeExt { |
| + var e storeExt |
| + has := func(bit storeExt, ok bool) { |
| + if ok { |
| + e |= bit |
| + } |
| + } |
| + _, ok := s.(release.Opener) |
| + has(extOpener, ok) |
| + _, ok = s.(release.PutStreamer) |
| + has(extPutStreamer, ok) |
| + _, ok = s.(release.PageLister) |
| + has(extPageLister, ok) |
| + _, ok = s.(release.ModLister) |
| + has(extModLister, ok) |
| + _, ok = s.(release.SizeLister) |
| + has(extSizeLister, ok) |
| + _, ok = s.(release.ConditionalGetter) |
| + has(extConditionalGetter, ok) |
| + _, ok = s.(release.ETagLister) |
| + has(extETagLister, ok) |
| + _, ok = s.(release.ConditionalDeleter) |
| + has(extConditionalDeleter, ok) |
| + _, ok = s.(release.IndexedDeleter) |
| + has(extIndexedDeleter, ok) |
| + _, ok = s.(release.BatchDeleter) |
| + has(extBatchDeleter, ok) |
| + _, ok = s.(release.StampedGetter) |
| + has(extStampedGetter, ok) |
| + _, ok = s.(release.CountedDirLister) |
| + has(extCountedDirLister, ok) |
| + _, ok = s.(release.VersionPager) |
| + has(extVersionPager, ok) |
| + _, ok = s.(release.VersionDeleter) |
| + has(extVersionDeleter, ok) |
| + _, ok = s.(release.VersionDirLister) |
| + has(extVersionDirLister, ok) |
| + _, ok = s.(release.BucketListDirs) |
| + has(extBucketListDirs, ok) |
| + _, ok = s.(release.AppMutationRunner) |
| + has(extAppMutationRunner, ok) |
| + return e |
| +} |
| + |
| +// countStore wraps s so its operations are counted, returning the wrapper |
| +// and its counter. A store whose optional interfaces match no wrapper shape |
| +// (the S3 store, a prefix store) comes back unwrapped with a nil counter: |
| +// its steps are timed but not counted. A nil s is returned as it is. |
| +func countStore(s release.Store) (release.Store, *storeCounter) { |
| + if s == nil { |
| + return nil, nil |
| + } |
| + c := &storeCounter{} |
| + base := &opCountingStore{inner: s, c: c} |
| + switch storeExts(s) { |
| + case plainShape: |
| + return base, c |
| + case doorShape: |
| + return doorCountingStore{base}, c |
| + case dirShape: |
| + return dirCountingStore{base}, c |
| + } |
| + return s, nil |
| +} |
| + |
| +// ---- the step logger -------------------------------------------------------- |
| + |
| +// startupLog writes the startup timing lines, as offsets from start. |
| +type startupLog struct { |
| + start time.Time |
| + now func() time.Time |
| + logf func(format string, args ...any) |
| +} |
| + |
| +// newStartupLog is the agent's startup log: offsets from agent start, to |
| +// the journal. |
| +func newStartupLog() *startupLog { |
| + return &startupLog{start: agentStart(), now: time.Now, logf: log.Printf} |
| +} |
| + |
| +func (l *startupLog) offset(t time.Time) time.Duration { return t.Sub(l.start).Round(time.Millisecond) } |
| + |
| +// at logs that what happened now. Nil-safe. |
| +func (l *startupLog) at(what string) { |
| + if l == nil { |
| + return |
| + } |
| + l.logf("agent: startup: %s at +%s", what, l.offset(l.now())) |
| +} |
| + |
| +// steps starts a sequence of steps, each timed from the end of the one |
| +// before (the first from now), every name given prefix. ops is the counter |
| +// of the store the steps read through, or nil. Nil-safe: a nil log gives a |
| +// nil sequence, whose methods do nothing. |
| +func (l *startupLog) steps(prefix string, ops *storeCounter) *startupSteps { |
| + if l == nil { |
| + return nil |
| + } |
| + now := l.now() |
| + o := ops.snapshot() |
| + return &startupSteps{log: l, prefix: prefix, ops: ops, first: now, firstOps: o, last: now, lastOps: o} |
| +} |
| + |
| +// startupSteps is one sequence of timed steps. Not safe for concurrent use: |
| +// each sequence belongs to one goroutine. |
| +type startupSteps struct { |
| + log *startupLog |
| + prefix string |
| + ops *storeCounter |
| + first, last time.Time |
| + firstOps storeOps |
| + lastOps storeOps |
| +} |
| + |
| +// count switches the sequence to counting ops from now on. |
| +func (s *startupSteps) count(ops *storeCounter) { |
| + if s == nil { |
| + return |
| + } |
| + s.ops = ops |
| + s.lastOps = ops.snapshot() |
| + s.firstOps = s.lastOps |
| +} |
| + |
| +// done logs the step that just ended: its time since the previous step |
| +// ended and the store ops made in between. |
| +func (s *startupSteps) done(step string) { |
| + if s == nil { |
| + return |
| + } |
| + now := s.log.now() |
| + o := s.ops.snapshot() |
| + s.line(step, now.Sub(s.last), now, o.minus(s.lastOps)) |
| + s.last, s.lastOps = now, o |
| +} |
| + |
| +// total logs the whole sequence so far as one step. |
| +func (s *startupSteps) total(step string) { |
| + if s == nil { |
| + return |
| + } |
| + now := s.log.now() |
| + s.line(step, now.Sub(s.first), now, s.ops.snapshot().minus(s.firstOps)) |
| +} |
| + |
| +// nested starts a sub-sequence from now, on the same counter, its names |
| +// under this one's prefix. |
| +func (s *startupSteps) nested(prefix string) *startupSteps { |
| + if s == nil { |
| + return nil |
| + } |
| + return s.log.steps(s.prefix+prefix, s.ops) |
| +} |
| + |
| +func (s *startupSteps) line(step string, took time.Duration, now time.Time, ops storeOps) { |
| + msg := fmt.Sprintf("agent: startup: %s%s took %s at +%s", s.prefix, step, took.Round(time.Millisecond), s.log.offset(now)) |
| + if o := ops.String(); o != "" { |
| + msg += " (store: " + o + ")" |
| + } |
| + s.log.logf("%s", msg) |
| +} |
diff --git a/internal/host/startuptiming_test.go b/internal/host/startuptiming_test.go| new file mode 100644 |
| index 000000000..7d1c9ed03 |
| --- /dev/null |
| +++ b/internal/host/startuptiming_test.go |
| @@ -0,0 +1,324 @@ |
| +package host |
| + |
| +import ( |
| + "context" |
| + "fmt" |
| + "io" |
| + "regexp" |
| + "strings" |
| + "sync" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/fleetapi" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// plainShapedStore is a Store with none of release's optional interfaces. |
| +type plainShapedStore struct{ release.Store } |
| + |
| +// doorShapedStore has the fleet door's shape: Store, Opener and ETagLister. |
| +type doorShapedStore struct{ inner *release.DirStore } |
| + |
| +func (s doorShapedStore) Get(ctx context.Context, k string) ([]byte, string, error) { |
| + return s.inner.Get(ctx, k) |
| +} |
| +func (s doorShapedStore) Put(ctx context.Context, k string, b []byte, m string) (string, error) { |
| + return s.inner.Put(ctx, k, b, m) |
| +} |
| +func (s doorShapedStore) List(ctx context.Context, p string) ([]string, error) { |
| + return s.inner.List(ctx, p) |
| +} |
| +func (s doorShapedStore) ListDirs(ctx context.Context, p string) ([]string, error) { |
| + return s.inner.ListDirs(ctx, p) |
| +} |
| +func (s doorShapedStore) Delete(ctx context.Context, k string) error { return s.inner.Delete(ctx, k) } |
| +func (s doorShapedStore) Open(ctx context.Context, k string) (io.ReadCloser, string, error) { |
| + return s.inner.Open(ctx, k) |
| +} |
| +func (s doorShapedStore) ListETags(ctx context.Context, p string) ([]release.KeyETag, error) { |
| + return s.inner.ListETags(ctx, p) |
| +} |
| + |
| +// modShapedStore has an extension set no wrapper shape matches. |
| +type modShapedStore struct { |
| + release.Store |
| + ml release.ModLister |
| +} |
| + |
| +func (s modShapedStore) ListMod(ctx context.Context, p string) ([]release.KeyMod, error) { |
| + return s.ml.ListMod(ctx, p) |
| +} |
| + |
| +func TestCountingStoreCountsAndDiffs(t *testing.T) { |
| + t.Parallel() |
| + ctx := context.Background() |
| + s, c := countStore(plainShapedStore{release.NewDirStore(t.TempDir())}) |
| + if c == nil { |
| + t.Fatal("a plain store was not wrapped") |
| + } |
| + if _, err := s.Put(ctx, "apps/a/one.json", []byte("{}"), ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + before := c.snapshot() |
| + for i := 0; i < 3; i++ { |
| + if _, _, err := s.Get(ctx, "apps/a/one.json"); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + if _, _, err := s.Get(ctx, "apps/a/missing.json"); err == nil { |
| + t.Fatal("fixture: a missing key read") |
| + } |
| + if _, err := s.List(ctx, "apps/"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := s.ListDirs(ctx, "apps/"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := s.ListDirs(ctx, "apps/a/"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := s.Delete(ctx, "apps/a/one.json"); err != nil { |
| + t.Fatal(err) |
| + } |
| + all := c.snapshot() |
| + if got := all.n; got != [numStoreOps]int64{opGet: 4, opList: 1, opDirs: 2, opPut: 1, opDelete: 1} { |
| + t.Fatalf("totals %v", got) |
| + } |
| + d := all.minus(before) |
| + if got := d.n; got != [numStoreOps]int64{opGet: 4, opList: 1, opDirs: 2, opPut: 0, opDelete: 1} { |
| + t.Fatalf("diff %v: the put before the snapshot was counted", got) |
| + } |
| + if d.t[opPut] != 0 || d.t[opGet] < 0 { |
| + t.Fatalf("diff times %v", d.t) |
| + } |
| + if re := regexp.MustCompile(`^get 4/[0-9.]+[µnm]?s, list 1/[0-9.]+[µnm]?s, dirs 2/[0-9.]+[µnm]?s, delete 1/[0-9.]+[µnm]?s$`); !re.MatchString(d.String()) { |
| + t.Fatalf("diff renders %q", d.String()) |
| + } |
| + if got := all.minus(all).String(); got != "" { |
| + t.Fatalf("an empty diff renders %q", got) |
| + } |
| + var none *storeCounter |
| + if got := none.snapshot(); got != (storeOps{}) { |
| + t.Fatalf("a nil counter snapshots %v", got) |
| + } |
| +} |
| + |
| +// Durations accumulate per op, and a diff subtracts them: exact sums |
| +// through add, and record's own measurement from a start already past. |
| +func TestStoreCounterAccumulatesLatency(t *testing.T) { |
| + t.Parallel() |
| + c := &storeCounter{} |
| + c.add(opGet, 40*time.Millisecond) |
| + c.add(opList, 7*time.Millisecond) |
| + before := c.snapshot() |
| + c.add(opGet, 60*time.Millisecond) |
| + c.add(opGet, 100*time.Millisecond) |
| + c.add(opDirs, 5*time.Millisecond) |
| + all := c.snapshot() |
| + wantAll := [numStoreOps]time.Duration{opGet: 200 * time.Millisecond, opList: 7 * time.Millisecond, opDirs: 5 * time.Millisecond} |
| + if all.t != wantAll { |
| + t.Fatalf("totals %v, want %v", all.t, wantAll) |
| + } |
| + d := all.minus(before) |
| + wantDiff := [numStoreOps]time.Duration{opGet: 160 * time.Millisecond, opDirs: 5 * time.Millisecond} |
| + if d.t != wantDiff || d.n != [numStoreOps]int64{opGet: 2, opDirs: 1} { |
| + t.Fatalf("diff %v %v, want %v", d.n, d.t, wantDiff) |
| + } |
| + if got := d.String(); got != "get 2/160ms, dirs 1/5ms" { |
| + t.Fatalf("diff renders %q", got) |
| + } |
| + |
| + // record measures from start: a start two seconds past adds at least |
| + // two seconds, to the op it names only. |
| + r := &storeCounter{} |
| + r.record(opPut, time.Now().Add(-2*time.Second)) |
| + got := r.snapshot() |
| + if got.n[opPut] != 1 || got.t[opPut] < 2*time.Second || got.t[opPut] > time.Minute { |
| + t.Fatalf("record: put %d/%s", got.n[opPut], got.t[opPut]) |
| + } |
| + for op := range got.t { |
| + if storeOp(op) != opPut && (got.n[op] != 0 || got.t[op] != 0) { |
| + t.Fatalf("record touched %s: %d/%s", storeOpNames[op], got.n[op], got.t[op]) |
| + } |
| + } |
| +} |
| + |
| +// A wrapper answers every optional-interface assertion as the store it |
| +// wraps does, and a store no shape matches is left alone. |
| +func TestCountingStoreKeepsTheStoreShape(t *testing.T) { |
| + t.Parallel() |
| + door, err := fleetapi.New("https://door.example.com", "fleet/box-1", "token") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + dir := release.NewDirStore(t.TempDir()) |
| + for name, tc := range map[string]struct { |
| + s release.Store |
| + counted bool |
| + }{ |
| + "plain": {plainShapedStore{dir}, true}, |
| + "door": {doorShapedStore{dir}, true}, |
| + "fleet door": {door, true}, |
| + "dir": {dir, true}, |
| + "ci store": {newCICountingStore(t), true}, |
| + "mod only": {modShapedStore{plainShapedStore{dir}, dir}, false}, |
| + "prefix door": {release.NewPrefixStore(door, "fleets/f/"), false}, |
| + } { |
| + got, c := countStore(tc.s) |
| + if (c != nil) != tc.counted { |
| + t.Errorf("%s: counted %v, want %v", name, c != nil, tc.counted) |
| + } |
| + if !tc.counted && got != tc.s { |
| + t.Errorf("%s: an uncounted store was wrapped", name) |
| + } |
| + if storeExts(got) != storeExts(tc.s) { |
| + t.Errorf("%s: wrapper extensions %b, store's %b", name, storeExts(got), storeExts(tc.s)) |
| + } |
| + } |
| + if s, c := countStore(nil); s != nil || c != nil { |
| + t.Fatal("a nil store was wrapped") |
| + } |
| +} |
| + |
| +// The extensions a wrapper forwards are counted under their op. |
| +func TestCountingStoreCountsExtensions(t *testing.T) { |
| + t.Parallel() |
| + ctx := context.Background() |
| + s, c := countStore(release.NewDirStore(t.TempDir())) |
| + if _, err := s.Put(ctx, "apps/a/one.json", []byte("{}"), ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + rc, _, err := release.OpenObject(ctx, s, "apps/a/one.json") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + rc.Close() |
| + if _, _, _, err := s.(release.ConditionalGetter).GetIfChanged(ctx, "apps/a/one.json", ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := s.(release.ETagLister).ListETags(ctx, "apps/"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := s.(release.ModLister).ListMod(ctx, "apps/"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := c.snapshot().n; got != [numStoreOps]int64{opGet: 2, opList: 2, opPut: 1} { |
| + t.Fatalf("counts %v", got) |
| + } |
| +} |
| + |
| +// startupCapture is a startupLog on a fake clock that keeps its lines. |
| +type startupCapture struct { |
| + mu sync.Mutex |
| + lines []string |
| + now time.Time |
| +} |
| + |
| +func (c *startupCapture) log(start time.Time) *startupLog { |
| + return &startupLog{start: start, now: func() time.Time { |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + return c.now |
| + }, logf: func(format string, args ...any) { |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + c.lines = append(c.lines, fmt.Sprintf(format, args...)) |
| + }} |
| +} |
| + |
| +func (c *startupCapture) advance(d time.Duration) { c.mu.Lock(); c.now = c.now.Add(d); c.mu.Unlock() } |
| + |
| +func (c *startupCapture) got() []string { |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + return append([]string(nil), c.lines...) |
| +} |
| + |
| +func TestStartupStepsLines(t *testing.T) { |
| + t.Parallel() |
| + start := time.Date(2026, 11, 15, 20, 0, 0, 0, time.UTC) |
| + cl := &startupCapture{now: start.Add(200 * time.Millisecond)} |
| + l := cl.log(start) |
| + ctx := context.Background() |
| + s, c := countStore(plainShapedStore{release.NewDirStore(t.TempDir())}) |
| + |
| + l.at("fast converge loop entered") |
| + steps := l.steps("arming: ", nil) |
| + cl.advance(1500 * time.Millisecond) |
| + steps.done("deploy store") // no counter yet: time only |
| + steps.count(c) |
| + if _, _, err := s.Get(ctx, "control/serial.json"); err == nil { |
| + t.Fatal("fixture: the serial exists") |
| + } |
| + cl.advance(2 * time.Second) |
| + steps.done("restart seed") |
| + sub := steps.nested("reconcile: ") |
| + cl.advance(250 * time.Millisecond) |
| + sub.done("record scan") |
| + steps.total("total") |
| + var nilSteps *startupSteps |
| + nilSteps.done("nothing") // nil-safe |
| + var nilLog *startupLog |
| + nilLog.at("nothing") |
| + if nilLog.steps("x", c) != nil { |
| + t.Fatal("a nil log gave a sequence") |
| + } |
| + |
| + got := cl.got() |
| + want := []*regexp.Regexp{ |
| + regexp.MustCompile(`^agent: startup: fast converge loop entered at \+200ms$`), |
| + regexp.MustCompile(`^agent: startup: arming: deploy store took 1\.5s at \+1\.7s$`), |
| + regexp.MustCompile(`^agent: startup: arming: restart seed took 2s at \+3\.7s \(store: get 1/[0-9.]+[µnm]?s\)$`), |
| + regexp.MustCompile(`^agent: startup: arming: reconcile: record scan took 250ms at \+3\.95s$`), |
| + regexp.MustCompile(`^agent: startup: arming: total took 3\.75s at \+3\.95s \(store: get 1/[0-9.]+[µnm]?s\)$`), |
| + } |
| + if len(got) != len(want) { |
| + t.Fatalf("lines:\n%s", strings.Join(got, "\n")) |
| + } |
| + for i, re := range want { |
| + if !re.MatchString(got[i]) { |
| + t.Errorf("line %d: %q does not match %s", i, got[i], re) |
| + } |
| + } |
| +} |
| + |
| +// The first run of the pass set logs every stage with its store ops; a |
| +// later fast run logs nothing. |
| +func TestFirstPassOnlyLogsStages(t *testing.T) { |
| + w := newCIWorld(t) |
| + disarmView(t) |
| + t.Cleanup(func() { disarmView(t) }) |
| + reg := restartTestRegistry(t) |
| + rcfg := ciReconcileConfig(t) |
| + cl := &startupCapture{now: time.Now()} |
| + legs := &passLegs{store: w.live, reg: reg, optDir: t.TempDir(), dd: t.TempDir(), |
| + startup: cl.log(cl.now), |
| + cfg: func() provision.ReconcileConfig { return rcfg }} |
| + |
| + legs.full(context.Background()) |
| + first := cl.got() |
| + joined := strings.Join(first, "\n") |
| + for _, want := range []string{ |
| + "agent: startup: first pass: reconcile took ", |
| + "agent: startup: first pass: moves took ", |
| + "agent: startup: first pass: adopt took ", |
| + "agent: startup: first pass: total took ", |
| + } { |
| + if !strings.Contains(joined, want) { |
| + t.Errorf("first run: no line starting %q in:\n%s", want, joined) |
| + } |
| + } |
| + if !regexp.MustCompile(`first pass: reconcile took \S+ at \+\S+ \(store: [^)]*list \d+/`).MatchString(joined) { |
| + t.Errorf("first run: the reconcile stage carries no store listing:\n%s", joined) |
| + } |
| + if routes, err := reg.List(); err != nil || len(routes) == 0 { |
| + t.Fatalf("fixture: the first pass minted nothing (%v)", err) |
| + } |
| + |
| + legs.full(context.Background()) |
| + if again := cl.got(); len(again) != len(first) { |
| + t.Fatalf("a second run logged:\n%s", strings.Join(again[len(first):], "\n")) |
| + } |
| +} |
diff --git a/internal/provision/ffr_census_test.go b/internal/provision/ffr_census_test.go| new file mode 100644 |
| index 000000000..3fed324f2 |
| --- /dev/null |
| +++ b/internal/provision/ffr_census_test.go |
| @@ -0,0 +1,35 @@ |
| +package provision |
| + |
| +// ffrWriteCensusInventory is the fleet-first-reconcile-speed branch's review |
| +// of the record-write census (plan 2026-11-15-fleet-first-reconcile), layered |
| +// on omrRunWriteCensusInventory. Self-review; the independent #280 verdict is |
| +// the reviewer's. |
| +// |
| +// No record write is added and no class or kind changes elsewhere. Two new |
| +// units, both in the agent's startup timing wrapper (internal/host |
| +// startuptiming.go), which counts and times deployment store calls for the |
| +// first pass after an agent start: |
| +// - opCountingStore.Put and dirCountingStore.PutFrom: pure pass-through |
| +// forwarders to the store they wrap, with the caller's own key, body and |
| +// condition, unchanged. They write exactly what their caller writes and |
| +// nothing else, so they are record-transport, like prefixStore.Put and |
| +// snapStore.PutFrom. |
| +func ffrWriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), omrRunWriteCensusInventory()...) |
| + for _, r := range []censusEntry{ |
| + {"internal/host/startuptiming.go", "opCountingStore.Put", "record-transport", "def:Put,sel:Put", "3c40a2e5877b6d0bc189d8d5bf1229d7eafd08dd70655773f1ea9ff75c62ebc5"}, |
| + {"internal/host/startuptiming.go", "dirCountingStore.PutFrom", "record-transport", "def:PutFrom,sel:PutFrom", "90b82a86936f37c9dd53d3afd6c5d9ebbaab9df6e8d2b883a69dcf52a125b2fc"}, |
| + } { |
| + replaced := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + entries[i], replaced = r, true |
| + break |
| + } |
| + } |
| + if !replaced { |
| + entries = append(entries, r) |
| + } |
| + } |
| + return entries |
| +} |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index f9e4fe4f0..b9118aa32 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) { |
| if len(got) < 100 { |
| t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root) |
| } |
| - inventory := omrRunWriteCensusInventory() |
| + inventory := ffrWriteCensusInventory() |
| problems := append(censusDiff(inventory, got), censusPolicy(inventory)...) |
| if len(problems) > 0 { |
| t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n ")) |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 574c5b8e3..241ab02c2 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -229,3 +229,4 @@ plan14-root-reads-fleet-skip-ha-ingress-scan.tsv 30b6ee553f864b11c18481ce747ad98 |
| plan14-root-reads-fleet-unrouted-503.tsv 0f148cc5106065040691da81c9705da76b3663f7733a21e4babfa1d6a9611902 |
| plan14-root-reads-fleet-unrouted-503-fix1.tsv e8043922abe9911a69ed6f5a9f8ec1d8f1db1aaf0c250f369cadff8ed394b079 |
| plan14-root-reads-omr-run.tsv f82b5e513d7434e1440c13aa4aa8bc06348745749a21593cf453f761ded0781b |
| +plan14-root-reads-fleet-first-reconcile-speed.tsv 9206205b2a3bf27b8b85310f4a44f94ef0c5886d85d6e55dbf2f22e073a8af11 |
diff --git a/internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed.tsv b/internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed.tsv| new file mode 100644 |
| index 000000000..bbe9102b9 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed.tsv |
| @@ -0,0 +1,14 @@ |
| +# Census overlay fleet-first-reconcile-speed, written by census-propose (#369). census-ruling-fleet-first-reconcile-speed, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed.md. |
| +# 3 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 3 new dispositions: 0 reads re-frozen at their disposition with the claim, 3 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| +@legacy 7d4a7edd28ecb09fd14da3ee7d05b9ec2a886294d619020ede4c9a5922a7acd9 internal/host/agent.go fastTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-stateless-replicas-4-task1;basis=Signals the owned replica swap worker (armedReplicaDeploy.tick) beside the placement worker on the existing tick; coalesced background pass, no timer, no bucket read. Its transitions go through the console's authenticated /deploy.;rev3=census-ruling-platform-mail-submission;basis=Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. Fable final P2-1: on a serial move, before the pass set and the restart leg, calls the armed cache's MarkStale (a counter bump under the cache's mutex; no I/O), so a spawn the move causes reads the switch again, bounded, instead of using an answer from before the move. No read added.;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only: d.startup.done(<part>) calls between the existing parts and a deferred one after the sweep. d.startup is nil on every tick but the first after agent start, and its methods are then no-ops. No read added, no order change; read site unchanged (1). Agent, not root. registry:Host@6774 22c990df2b753ccfa496f582601e77ebb294dc4a9d17e11d11458338f2bebd14 |
| +@legacy 65fbd8934ac7a4776b0417f78396507cb8d43351da03308e6698dad8a53e185c internal/host/startuptiming.go dirCountingStore.Open legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed;basis=New. Exported Open of the DirStore shaped wrapper; calls opCountingStore.open, the same pass-through of the wrapped store Open with the caller key. No read beyond that forwarding; agent, not root. file:Open@26 d388e4e0be4483894b554f04e5bfeb8a5a4da220e385903139a810c2c5ed5196 |
| +@legacy be853880e3bc3b2ee90b37bfe2f5e3e1398d9fd8b587e05c65a921e58147e112 internal/host/startuptiming.go doorCountingStore.Open legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed;basis=New. Exported Open of the fleet door shaped wrapper; calls opCountingStore.open, the same pass-through of the wrapped store Open with the caller key. No read beyond that forwarding; agent, not root. file:Open@27 98dcd6e557c0a80a422dd237994f2d13b37f70dd1906e4806072107fcbc98de2 |
| +@legacy dfd6892e16e3d2a477a9075c06085093f348fe690399c68a0714f126df6d7d33 internal/host/startuptiming.go opCountingStore.open legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed;basis=New. The startup timing wrapper forwarding release.Opener.Open on the deployment store it wraps (fleet door or DirStore), same key, counted as a get. The read is a deployment store object, the same one the caller would open without the wrapper; the census names it file:Open by method name. No filesystem path is opened here. Pass-through only; agent, not root. file:Open@142 0b0526229007d42da68a76cb1049de032131bdb873c08d5c32f80aa3e39c1c4d |
| +internal/host/agent.go fastConvergeLoop authority B3 rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): every pass context carries the box's lifetime judge (provision.WithLifetimes) and the reconcile config is boxProvisionConfig's; read sites unchanged, offsets moved; B3 authority retained;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 12: its pass config is now BoxProvisionConfig(reg, os.Getenv, judge, configure) (BoxProvisionConfig replaces boxProvisionConfig: the hub predicate hubArmed and, on the hub, ReconcileConfig.FleetOwners from hubFleetOwners); a call, no read site; read sites unchanged (2); B3 authority retained.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: wire the coordinator's nonblocking SignalTick to the existing fast tick. No new timer, polling read or authority.;rev3=census-ruling-region-ha-p3b;basis=Bind systemLeg to the existing cached reader fold and handle a nil leg on groups; names-2 rollback gate runs before artifact/request/marker work. Agent-memory evidence only, no new direct or cloud read and no autonomous group update.;rev3=census-ruling-restart-new-box-gap;basis=restart leg closure moved into armRestartLegs (same reg.List + restartRequestLeg); also wires restartGain; read moved, not added;rev3=census-ruling-agent-start-demo-3;basis=Attach the moved reader to the existing shared change watch and advertise that reader as armed. Census read-site delta: unchanged (2).;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only (fleet first reconcile Task 1). Logs its entry offset and one line per arming step, then times the first tick. restartSeed, sidecarWakeSeed, refreshMovesHolds, refreshOfflineView and the one arming systemLeg.observe now read through countStore(store), a pass-through wrapper that counts and times each call and forwards it unchanged with the same key; for that observe, systemLeg.store is swapped to the wrapper and restored. For the first tick only, d.store is a fresh countStore(store) wrapper and d.startup a step logger; both are reset to the plain store and nil after the tick. passLegs gets startup. Same calls in the same order, no read added; read sites unchanged (1). Agent, not root. whole:Route@9448 758f96f1e3c01ecb3c26e5888797d60d8bc093a47c36953d5c64429710b853a4 |
| +internal/host/agent.go fastTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-stateless-replicas-4-task1;basis=Signals the owned replica swap worker (armedReplicaDeploy.tick) beside the placement worker on the existing tick; coalesced background pass, no timer, no bucket read. Its transitions go through the console's authenticated /deploy.;rev3=census-ruling-platform-mail-submission;basis=Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. Fable final P2-1: on a serial move, before the pass set and the restart leg, calls the armed cache's MarkStale (a counter bump under the cache's mutex; no I/O), so a spawn the move causes reads the switch again, bounded, instead of using an answer from before the move. No read added.;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only: d.startup.done(<part>) calls between the existing parts and a deferred one after the sweep. d.startup is nil on every tick but the first after agent start, and its methods are then no-ops. No read added, no order change; read site unchanged (1). Agent, not root. registry:Host@6774 22c990df2b753ccfa496f582601e77ebb294dc4a9d17e11d11458338f2bebd14 |
| +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.;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only: runDuties builds a step logger (newStartupLog, which reads the in-memory agent start time) and logs one line after the wait on the activator startup latch and after each existing duty before go fastConvergeLoop. One newStartupLog().at line in the edge ready hook before go tunnelLoop. No read added; read sites unchanged (8). Agent, not root. file:Exec@21625,file:Open@2191,file:Statfs@57825,registry:App@13287,registry:App@13665,whole:Route@13279,whole:Route@13657,whole:Route@51246 84c21f081ca717c04e3015514bd965a6b3d4de68c0143fe79190f58a7abd2dac |
| +internal/host/startuptiming.go dirCountingStore.Open legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed;basis=New. Exported Open of the DirStore shaped wrapper; calls opCountingStore.open, the same pass-through of the wrapped store Open with the caller key. No read beyond that forwarding; agent, not root. file:Open@26 d388e4e0be4483894b554f04e5bfeb8a5a4da220e385903139a810c2c5ed5196 |
| +internal/host/startuptiming.go doorCountingStore.Open legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed;basis=New. Exported Open of the fleet door shaped wrapper; calls opCountingStore.open, the same pass-through of the wrapped store Open with the caller key. No read beyond that forwarding; agent, not root. file:Open@27 98dcd6e557c0a80a422dd237994f2d13b37f70dd1906e4806072107fcbc98de2 |
| +internal/host/startuptiming.go opCountingStore.open legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed;basis=New. The startup timing wrapper forwarding release.Opener.Open on the deployment store it wraps (fleet door or DirStore), same key, counted as a get. The read is a deployment store object, the same one the caller would open without the wrapper; the census names it file:Open by method name. No filesystem path is opened here. Pass-through only; agent, not root. file:Open@142 0b0526229007d42da68a76cb1049de032131bdb873c08d5c32f80aa3e39c1c4d |
| +@coverage internal/host d2a3e2a85cc50cfccd3d38650fa50c6da22567f4cddb3533c03bdae63c701900 |