Merge remote-tracking branch 'origin/main' into feat/platform-mail-submission
# Conflicts: # internal/provision/testdata/plan14-root-reads-chain.tsv # internal/status/snapshot.go # internal/status/snapshot_test.go
26 files changed,
+826
−30
approved_moves_copy_test.go+4 −0docs/site/cli.md+2 −0docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md+27 −0docs/superpowers/notes/census-proposal-platform-mail-submission.md+4 −4docs/superpowers/plans/2026-10-06-moves-phase1-copy.md+13 −0docs/superpowers/plans/2026-10-21-offline-move-runbook.md+6 −4docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-FIXES.md+35 −0docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-R1.md+59 −0docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339-FIXES.md+13 −0docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339.md+22 −0internal/console/apiinstancemove_offline.go+12 −1internal/console/apiinstancemove_offline_facts.go+36 −0internal/console/apiinstancemove_offline_stage_test.go+73 −2internal/console/apiinstancemove_offline_test.go+6 −1internal/host/agent.go+6 −0internal/host/movesoffline_e2e_test.go+130 −8internal/host/movesoffline_facts.go+121 −0internal/host/movesoffline_facts_test.go+123 −0internal/provision/testdata/plan14-root-reads-chain.tsv+2 −1internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv+16 −0internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv+7 −7internal/status/contract_test.go+8 −1internal/status/snapshot.go+38 −1internal/status/snapshot_test.go+23 −0move.go+16 −0move_test.go+24 −0
CI failed — run details
diff --git a/approved_moves_copy_test.go b/approved_moves_copy_test.go| index af7993a5d..ce7f73f23 100644 |
| --- a/approved_moves_copy_test.go |
| +++ b/approved_moves_copy_test.go |
| @@ -110,6 +110,9 @@ var movesCopyIDs = []string{ |
| "MV-O179", "MV-O180", "MV-O181", "MV-O182", "MV-O183", "MV-O184", "MV-O185", "MV-O186", "MV-O187", "MV-O188", "MV-O189", |
| "MV-O190", "MV-O191", "MV-O192", |
| "MV-O193", |
| + // #339: refused while the instance still serves, and status after an |
| + // abort from staging. |
| + "MV-O200", "MV-O202", "MV-O203", "MV-O204", |
| } |
| // copyRow is one row of the record. The File cell is the file the sentence is |
| @@ -1213,6 +1216,7 @@ var movesScanFiles = []string{ |
| "internal/host/movesrefusals.go", |
| "internal/console/movesrecovery.go", |
| "internal/console/apiinstancemove_offline.go", |
| + "internal/console/apiinstancemove_offline_facts.go", |
| "internal/console/claim_runtime.go", |
| "internal/alerting/alerting.go", |
| "internal/hostops/move_log_writer.go", |
diff --git a/docs/site/cli.md b/docs/site/cli.md| index ed723146c..88a177802 100644 |
| --- a/docs/site/cli.md |
| +++ b/docs/site/cli.md |
| @@ -3402,6 +3402,8 @@ The instance is offline from `start` until `open`. Until `open`, `abort` puts it |
| `stage` is optional and comes before `start`. It copies the instance's data to the region it moves to while the instance keeps serving, and each time it runs it copies only what is new. The more it has copied, the less is left to copy while the instance is offline. Until `start`, `abort` removes the staged copy and the instance is never offline. |
| +`stage` and `start` refuse an offline move when a box in the target region still holds a live link for the instance from an earlier time it ran there, or has more live links than its report can carry. The refusal names the box and says what it found. |
| + |
| ## On the host |
| These are what systemd starts. You will rarely type them, but knowing what |
diff --git a/docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md b/docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md| new file mode 100644 |
| index 000000000..74b2b994c |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md |
| @@ -0,0 +1,27 @@ |
| +# Census approval: offline-move-stage-refusals-339 |
| + |
| +Ruling `census-ruling-offline-move-stage-refusals-339`. 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/status/snapshot.go` `CollectBox` | body | unchanged (28) | #339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. | |
| +| `internal/host/agent.go` `statusLoop` | sites | +whole:Route | #339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added. | |
| + |
| +Envelopes re-pinned: `.`, `internal/host`, `internal/status`. |
| + |
| +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/status/snapshot.go` `CollectBox`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added. |
| +- `internal/host/agent.go` `statusLoop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change. |
| + |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `internal/host/movesoffline_facts.go:movesWorker.offlineMoveFacts`: reads +registry:Host, +whole:Route; written legacy, accepted-legacy, frozen |
| +- new `internal/host/movesoffline_facts.go:offlineMoveFactsProbe`: reads +whole:Route; written legacy, accepted-legacy, frozen |
| +- new `internal/host/movesoffline_facts.go:readNamesBounded`: reads +file:Open, +file:Readdirnames ×2; written legacy, accepted-legacy, frozen |
| + |
| +Seal: `3f43afa4b0c18ad678a952b48b511e74e849992cd629b9aa1442bbe0055d5631` → `846d1f22e6eb6b2cd8b3086fa554f15deba70418c6542b46b2e2a6a138b6c332`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/notes/census-proposal-platform-mail-submission.md b/docs/superpowers/notes/census-proposal-platform-mail-submission.md| index c19b8ebda..b7ae69f38 100644 |
| --- a/docs/superpowers/notes/census-proposal-platform-mail-submission.md |
| +++ b/docs/superpowers/notes/census-proposal-platform-mail-submission.md |
| @@ -9,7 +9,7 @@ Ruling `census-ruling-platform-mail-submission`. The independent reviewer approv |
| | `infra/modules/region-host/variables.tf` `external` | body | unchanged (1) | Task 8: variable "mailer", an object {ses_region, ses_account_id, deployment_bucket_region, optional deployment_bucket_kms_key_arn} defaulting to null, which creates nothing; validated (AWS region shapes, 12-digit account, KMS ARN or empty). | |
| | `internal/host/agent.go` `fastTick` | body | unchanged (1) | 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. | |
| | `internal/host/agent.go` `provisionTickConfig` | body | unchanged (2) | Task 5: its region, pools and fleet label now come from BoxScopeFromEnv, which is the same three reads moved out unchanged (CARLOS_REGION trimmed, provision.ParseBoxPools(CARLOS_POOLS), and resolveFleetIdentity's label only when its fleet is the one the region places the box on), so the box-local mailer resolves "on this box" by the agent's rule. The ReconcileConfig it returns is field for field what it was. Agent, not root. | |
| -| `internal/host/agent.go` `statusLoop` | body | unchanged (6) | Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). | |
| +| `internal/host/agent.go` `statusLoop` | body | unchanged (7) | Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). | |
| | `internal/host/bootstrap.go` `bootstrapWithGroup` | body | unchanged (3) | Task 3: the sysusers.d/carlos.conf it writes is now the constant sysusersConf, which adds "u carlos-mailer - \"CARLOS mailer\" - /usr/sbin/nologin" ahead of the existing "g carlos-sockets -" line, so the tmpfiles line naming group carlos-mailer resolves on a box whose confs arrive by a staged-tree refresh. Constant text, no input; no read added. | |
| | `internal/host/bootstrap.go` `const tmpfilesConf` | body | unchanged (7) | Task 3: two constant lines, "d /run/carlos-mailer 0750 root carlos -" (the mailer's socket directory, beside /run/carlos-control and shaped like it) and "d /etc/carlos-mailer 0750 root carlos-mailer -" (the key directory, which uid carlos cannot traverse). Root creates two root-owned directories; no file inside either is created, owned or seeded (the key is the operator's, by hand). No input; no read added. | |
| | `internal/host/bootstrap.go` `privilegedPlan` | body | unchanged (1) | Task 3: one more constant argv, useradd --system --user-group --no-create-home --shell /usr/sbin/nologin carlos-mailer, right after carlos's, behind runPrivileged's existing guard (user.Lookup of the argv's own last word). No input; no read added. | |
| @@ -43,7 +43,7 @@ Recorded dispositions, which each change must still satisfy: |
| - `infra/modules/region-host/variables.tf` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's variables with console_mail_from (validated as one lowercase address) and console_mail_region, both empty by default; no read is added and nothing on a box reads the file;rev3=census-ruling-hunt-account-root-hardening;basis=adds deny_release_key_reads (bool, default true); no read is added and nothing on a box reads the file;rev3=census-ruling-region-ha-p3b;basis=Add default-fixed mode and validated group count, zones, pinned image/release/template, ingress, configuration key and transaction-open refusal. Operator-supplied Terraform values select root boot inputs; no direct box runtime read and no group activation by default.;rev3=census-ruling-region-ha-g2-fixes;basis=Add an empty-default set of additional alert topic ARNs, validating concrete SNS topic syntax and excluding wildcards/subscriptions; operator Terraform input, no box runtime read.;rev3=census-ruling-region-ha-g3-fixes;basis=Add optional alerts_topic_arn with concrete same-region SNS ARN validation and mutual exclusion with alerts_email. The caller owns the existing topic policy and subscriptions; no runtime sink is configured and no new root read is added.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: five variables, managed_fleets_enabled (bool, default false, refused unless mode is fixed), managed_fleets_deployment, managed_fleets_regions (concrete ami/subnet/sg IDs, arm64 types, no ID in two regions), managed_fleet_bucket_prefix (1-24 chars, no reserved prefix, must not cover the deployment, data or staging buckets, disjoint from store_bucket_prefix) and managed_fleet_user_path (literal IAM path, disjoint from store_user_path); store_bucket_prefix and store_user_path gain a validation refusing *, ? or ${ only when managed fleets and object storage are both on; operator Terraform input only; no box runtime read and nothing on a box reads the file;rev3=census-ruling-fixedbox-health-alarms;basis=Add optional health_alerts_topic_arn (concrete same-region SNS ARN validation, empty default); enable_auto_recovery description covers both status alarms. Operator Terraform input; no box runtime read.;rev3=census-ruling-w6-ingress-drain;basis=new variable ingress_target_group_arns (list(string), default [], non-nullable) validated as distinct ELB target group ARNs (arn:aws(-x)*:elasticloadbalancing:<region>:<12 digits>:targetgroup/<name>/<16 hex>); drives the IAM policy and output above. No read added.;rev3=census-ruling-stats-prune-400;basis=new variable enable_analytics_version_prune (bool, default false) driving the policy above; operator Terraform input; no box runtime read |
| - `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. |
| - `internal/host/agent.go` `provisionTickConfig`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-ha-p1a-433;basis=the agent (carlos-edge.service, user carlos) and the edges file loop's eligibility: the same CARLOS_POOLS read, now parsed by provision.ParseBoxPools (internal/provision, envelope re-pinned), the one parser boxPools also uses. "@shared" (provision.SharedPoolToken, never a valid pool name) is the shared "" pool; other tokens are literal as before; empty elements and repeats dropped. No read added.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 4, rule 2): sets ReconcileConfig.FleetBox to the box's own fleet label from resolveFleetIdentity(getenv), only when the identity resolves and region == PlacementTarget(identity.Fleet); otherwise it stays "" (the box admits only unlabelled records). The same environment the fleet loops already read; read sites unchanged (2). Agent config, not root. |
| -- `internal/host/agent.go` `statusLoop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change. |
| +- `internal/host/agent.go` `statusLoop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added. |
| - `internal/host/bootstrap.go` `bootstrapWithGroup`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-gvisor-demos;basis=Create the rootfs parent at 0700 and runtime root at 0755. Existing host.env/unit reads unchanged; workload templates remain unarmed. |
| - `internal/host/bootstrap.go` `const tmpfilesConf`: authority, task A,C,G,J4. Basis: root-input;kept=A,C,G;scope=protected-decision-only |
| - `internal/host/bootstrap.go` `privilegedPlan`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input |
| @@ -58,7 +58,7 @@ Recorded dispositions, which each change must still satisfy: |
| - `internal/host/units/carlos-instance-sidecar@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5: the same one namespace-block line, TemporaryFileSystem=/dev/pts:ro, as carlos-instance@.service; nothing else;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-instance-stop-execstop-528;basis=one line added after ExecStart=, ExecStop=-+/opt/carlos/carlos instance-stop $MAINPID (#528, Paul's option 2), plus TimeoutStopFailureMode=kill after TimeoutStopSec=20: PID 1 runs the platform binary's instance-stop as root (the + prefix) at a stop with $MAINPID, a value systemd supplies; instance-stop reads only that argument, /proc/self/cgroup and /proc/<MAINPID>/cgroup (kernel-written), and acts only through a pidfd on the unit's own main process (refused unless in the unit's own cgroup); no bind source, user, mount or tenant-writable path read added;rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added. |
| - `internal/host/units/carlos-instance-tty@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the binary tty template, carlos-instance-cmd@.service outside six named lines held by TestTTYTemplateEqualsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit tty %I (the same root binary as every template), StandardInput=file:/run/carlos/logs/%I.tty.sock replacing the cmd StandardOutput socket (PID 1 opens it as root on the nosymfollow logs mount, as the cmd streams), StandardOutput=journal, StandardError=journal, and BindReadOnlyPaths sources tty-app/tty-live under /run/carlos-control/exe/%I (root-only exe layout, as cmd-app/cmd-live). Same namespace block byte for byte, runs as carlos. Task 6: POST /tty (handleOneShot(RoleTTY), claimAwareLegacy) starts it, after the role lock, the loaded-state refusal and refuseStagedExe; the tty-app/tty-live sources are laid out by ensureCmdExeAt(RoleTTY) and removed by removeCmdExe(RoleTTY) at /stop role=tty and /sweep;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added. |
| - `internal/host/units/carlos-instance@.service` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5: one namespace-block line added after TemporaryFileSystem=/dev/mqueue:ro, TemporaryFileSystem=/dev/pts:ro (with its comment): PID 1 mounts an empty read-only tmpfs over the private /dev/pts, hiding the host devpts PrivateDevices= binds in; no bind source, Exec line, user or path read by root added; the block stays byte-identical across the binary templates (TestInstanceTemplatesShareOneNamespace);rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-instance-stop-execstop-528;basis=one line added after ExecStart=, ExecStop=-+/opt/carlos/carlos instance-stop $MAINPID (#528, Paul's option 2), plus TimeoutStopFailureMode=kill after TimeoutStopSec=20: PID 1 runs the platform binary's instance-stop as root (the + prefix) at a stop with $MAINPID, a value systemd supplies; instance-stop reads only that argument, /proc/self/cgroup and /proc/<MAINPID>/cgroup (kernel-written), and acts only through a pidfd on the unit's own main process (refused unless in the unit's own cgroup); no bind source, user, mount or tenant-writable path read added;rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added. |
| -- `internal/status/snapshot.go` `CollectBox`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added. |
| +- `internal/status/snapshot.go` `CollectBox`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. |
| - `internal/activator/backend_exec.go` `ExecBackend.agentOwnedVars`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only. |
| - `internal/activator/backend_exec.go` `ExecBackend.spawnChildFrom`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source.;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself. Inside the build closure (which the cgroup manager calls after writing the limits) it asks cgroup.Manager.Capped(host, child, tier), a read of memory.max in the agent's own delegated cgroup subtree, and only when that reads back as the tier adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env, unless the app's fileEnv names it. No delegation, a cgroup that could not be made, or a failed memory.max write gives no default (Astra R1 P2-1). Containment behaviour unchanged; no gate moved or weakened; no registry, /data, release or store read added. |
| - `internal/activator/backend_exec.go` `ExecBackend.spawnUnitFrom`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; it calls prepareKeyedAt and keeps the launch environment and its key layer on the generation's handle; read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-2;basis=times the launch's steps with time.Now() (build, prepare, launch file, gate, root start) and adds them to its existing "started" journal line; no read added or moved;rev3=census-ruling-rootfs-apps-2;basis=the unit names in its error and log lines go through runUnitName, and newUnitProcFor's new error (a role with no unit to observe) fails the start as markStartUncertain after root started the unit; the binary spawn is otherwise unchanged, a rootfs row never reaches it (nestedGate refuses one); no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=computes the page cache launch inputs once (launchInputs: sha256 over the staged or pinned exe's Version and the fileEnv this spawn already read; "" with no exe, since root binds the movable live link) and keeps them on the unit handle (up.inputs); no new file, registry or bucket read; read sites unchanged (29); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main launchInputs computed from the captured file environment and pinned/staged build and store them on the handle, alongside branch sandbox gate, validated root StartResponse Unit/Sandbox/InvocationID and all uncertain-start cleanup. No new direct read.;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: one log line before killFailedGen naming the host, the generation unit (runUnitName) and the error already in hand; the +registry:Host sites are those two arguments to log.Printf; no new read source, behaviour unchanged;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (nested start): resolves the zero tier once (b.tier(rt), the existing live-tier read), adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the launch file env unless the app's fileEnv already names it (withGoMemLimit; skipped under gVisor, where root supplies its own and drops any launch value), passes that same tier to startRole, and logs it. No new read source; root still validates memory_max against the size table; read sites unchanged. |
| @@ -86,6 +86,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the |
| - new `internal/mailsubmit/forward.go:SocketForwarder.Send`: reads +file:ReadAll; written legacy, accepted-legacy, frozen |
| - new `internal/mailsubmit/verb.go:Mount`: reads +registry:App, +registry:Host, +whole:Route; written legacy, accepted-legacy, frozen |
| -Seal: `3f43afa4b0c18ad678a952b48b511e74e849992cd629b9aa1442bbe0055d5631` → `7eacbf23d4e02e255481301f0caad19744cc9003f7278bd7691be044d665e38b`. |
| +Seal: `846d1f22e6eb6b2cd8b3086fa554f15deba70418c6542b46b2e2a6a138b6c332` → `72eca621463fbdb5c15b2f273b443bc9e931c67266329b124664dc4220240814`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md b/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md| index 28adb242c..cc00bfbd7 100644 |
| --- a/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md |
| +++ b/docs/superpowers/plans/2026-10-06-moves-phase1-copy.md |
| @@ -718,3 +718,16 @@ Three more console door refusals for a staged move (`internal/console/apiinstanc |
| | MV-O191 | internal/console/apiinstancemove_offline.go | <to> publishes the same data bucket as <from>. a staged copy there would replace the serving one | approved | |
| | MV-O192 | internal/console/apiinstancemove_offline.go | <to> now publishes a different data bucket or region from what was recorded when <host> was staged. abort the move and stage it again | approved | |
| | MV-O193 | internal/console/seedmove.go (haMoveSentence; RHA-P1a-C1 approved verbatim; emitted at apiinstancemove.go:450,631 and apiinstancemove_offline.go:538) | %s has high availability turned on. offline moves into or out of it are not available yet | approved | |
| + |
| +## Offline move: refused while the instance still serves (#339) |
| + |
| +MV-O200, MV-O203 and MV-O204 approved by Luna on 2026-11-13 (Paul's 2026-10-25 delegation), as Luna rewrote them; MV-O202 approved by Luna unchanged. |
| + |
| +A live link the target box still kept for the host from an earlier time it ran there failed an offline move only after `start` had taken the instance offline: the landing's `release` item fails at `flip` (MV-O177) over any link that does not name the sealed build (amadan #339, item 1). Each box now reports the hosts it keeps such a link for in its status report while the instance serves, and the `stage` and `start` doors refuse first (branch `offline-move-stage-refusals-339`). The report names the link and not its build, so the doors refuse any such link: MV-O200 states the fact and that policy, not a predicted failure (Astra round 1, P2-6). MV-O204 is the refusal when the box holds more links than its bounded report can carry (Astra round 1, P1-3), so it cannot say whether one is for the host. Both are console door refusals (`internal/console/apiinstancemove_offline_facts.go`), lower case like the other door sentences; `<box>` is the target box. Item 4 (app directories beside the files directory) was cut from this branch after round 1 and is a follow-up, so its row is gone. MV-O202 is what `carlos move offline status` says for a move aborted from staging (item 2), in place of MV-O8 and the manifest's items, until `finish` ends the move: nothing moved. It is followed by MV-O187 or MV-O188. MV-O203 is the CLI page's paragraph for the refusal, in Luna's wording with its directories clause dropped. The ids start at 200 so that another branch's rows from 194 do not collide. |
| + |
| +| id | file | text | status | |
| +|---|---|---|---| |
| +| MV-O200 | internal/console/apiinstancemove_offline_facts.go | <box> still holds a live link for <host> from when it last ran there. stage and start refuse until it is cleared, since a mismatched link fails the move only after <host> is offline. see the offline move runbook | approved | |
| +| MV-O202 | move.go | Nothing moved. The stage of <host> was abandoned, and <host> kept serving in <from>. | approved | |
| +| MV-O203 | docs/site/cli.md | `stage` and `start` refuse an offline move when a box in the target region still holds a live link for the instance from an earlier time it ran there, or has more live links than its report can carry. The refusal names the box and says what it found. | approved | |
| +| MV-O204 | internal/console/apiinstancemove_offline_facts.go | <box> holds more live links than it can report, so stage and start cannot tell whether one is for <host>. see the offline move runbook | approved | |
diff --git a/docs/superpowers/plans/2026-10-21-offline-move-runbook.md b/docs/superpowers/plans/2026-10-21-offline-move-runbook.md| index 8a8c7705d..7a1dbc704 100644 |
| --- a/docs/superpowers/plans/2026-10-21-offline-move-runbook.md |
| +++ b/docs/superpowers/plans/2026-10-21-offline-move-runbook.md |
| @@ -8,7 +8,7 @@ Sources: harness `RUNLOG.md` Runs 9 and 10 with corrections M2 to M15; the dev r |
| ## The short version |
| -1. Check the fleet once (section 2) and the instance and the target box before each move (section 3). The target check is the one that matters most: a stale `/opt/carlos/live/<host>` link on the target makes `flip` fail only after the instance is already offline. |
| +1. Check the fleet once (section 2) and the instance and the target box before each move (section 3). The target check is the one that matters most: a stale `/opt/carlos/live/<host>` link on the target makes `flip` fail only after the instance is already offline. From the release carrying the #339 fix, `stage` and `start` refuse such a link while the instance still serves; on an older release section 3 is the only check. |
| 2. Run `stage` while the instance serves, and run it again until a round copies almost nothing (section 4). |
| 3. Run `move.sh`. It stages once more, records a baseline, then runs `start`, `seal`, `flip`, a check of the target and `open` back to back, judging each step by its exit code. Before `open`, any surprise aborts the move. Expect about 2.5 to 3 minutes offline for an instance with a 1.6 to 3.7 GB replica (section 5). |
| 4. Measure the offline time yourself, from just before `start` to the first 2xx through the target. The console's figure read 40 to 75 seconds low on the flagship (section 6). |
| @@ -166,12 +166,14 @@ src "set -- $H; $(cat "$W/sizes.box.sh")" |
| aws --profile "$PROFILE" s3 ls --recursive --summarize "s3://$SRCDATA/instances/$H/" | tail -2 |
| ``` |
| -Pass: the files tree is under 268435456 bytes (256 MiB; over that the seal refuses safely); no sidecar file. Record the database size and the replica's object count and total size: staging time and the size of the target's copy scale with the replica, not the database. A legacy flat `/data/<host>/` directory holding old key copies needs nothing: the seal passes and the retire parks it with the instance. |
| +Pass: the files tree is under 268435456 bytes (256 MiB; over that the seal refuses safely); no sidecar file; nothing beside the files directory in `/data/.instances/<host>/` but the platform's own entries (an app's `data/`, `documents/` or `blobs/` there makes the seal refuse with exit 4, and the move cannot carry it). Nothing refuses such a directory before `start` yet (a #339 follow-up), so this check is the only one. Record the database size and the replica's object count and total size: staging time and the size of the target's copy scale with the replica, not the database. A legacy flat `/data/<host>/` directory holding old key copies needs nothing: the seal passes and the retire parks it with the instance. |
| ### 3.3 The target box |
| This check exists because of the first staged move on the flagship. An earlier attempt had left a root-owned link `/opt/carlos/live/<host>` on the UK box, naming a build from weeks before. Nothing reports it before `flip`, and `flip` fails the landing's `release` item only after `start` has taken the instance offline: `flip` exited 4 with "uk could not take shop.example.com: the target box still holds an older build of this instance", the move was aborted, and the instance was offline for about two minutes for nothing (amadan #339). |
| +From the release carrying the #339 fix, the target box reports every live link it keeps for a host it has no row for, and `stage` and `start` refuse such a host with "<box> still holds a live link for <host> from when it last ran there. stage and start refuse until it is cleared, since a mismatched link fails the move only after <host> is offline. see the offline move runbook" (exit 5), before anything goes offline. The report names the link and not its build, so the doors refuse any such link, even one that names the build the instance runs. A box that holds more live links than its report can carry (more than 128) makes them refuse every host with "<box> holds more live links than it can report, so stage and start cannot tell whether one is for <host>. see the offline move runbook". A box whose agent runs as root reports no links, and the doors then refuse nothing over it. A box reports again within about six minutes, so after clearing a link wait for its next report before staging. The landing's own check stays behind the doors. Run the checks below anyway: they also cover older releases. |
| + |
| ```bash |
| tgt "set -- $H; $(cat "$W/target.box.sh")" |
| src "readlink /opt/carlos/live/$H" |
| @@ -243,7 +245,7 @@ While a move is staged: |
| - the instance serves as normal; |
| - it refuses `carlos run` and deletion; |
| - no other instance in the deployment can stage or move offline; |
| -- `abort` removes the staged copy and ends the move with the instance never offline. `abort` and the `finish` after it both exit 3, the normal "aborted" code, with "The staged copy of shop.example.com is removed." and "shop.example.com is back in ie and serving. Nothing was lost." Afterwards `status` prints "Moving shop.example.com from ie to uk. Moving shop.example.com back to ie." and a list of items "waiting". Ignore that; the abort's own lines are the record (#339). |
| +- `abort` removes the staged copy and ends the move with the instance never offline. `abort` and the `finish` after it both exit 3, the normal "aborted" code, with "The staged copy of shop.example.com is removed." and "shop.example.com is back in ie and serving. Nothing was lost." Between the two, while the move is still reverting, `status` prints "Nothing moved. The stage of shop.example.com was abandoned, and shop.example.com kept serving in ie." and lists no items. After `finish` it says the move is aborted. A CLI older than the #339 fix prints, before `finish`, "Moving shop.example.com from ie to uk. Moving shop.example.com back to ie." and a list of items "waiting" instead; ignore that, the abort's own lines are the record. |
| --- |
| @@ -456,7 +458,7 @@ A retry is a new move, staged from scratch, after section 3 passes again. |
| ## 12. Known gaps |
| -- **amadan #339: nothing checks the target before the instance goes offline.** A stale root-owned `/opt/carlos/live/<host>` on the target fails `flip` (exit 4, the `release` item, MV-O177) only after `start`. Section 3.3 is the workaround. The same discussion covers two smaller things: after an abort from staging, `status` reads as if the instance moved and came back; and no output says how many objects the seal copied (section 6 has the count). |
| +- **amadan #339: stale live links and app directories.** Before the release carrying the fix, a stale root-owned `/opt/carlos/live/<host>` on the target fails `flip` (exit 4, the `release` item, MV-O177) only after `start`; section 3.3 is the workaround. With the fix, `stage` and `start` refuse it before anything goes offline, but there is still no supported way to clear a stale link (root by hand, section 3.3). App directories beside the files directory still fail `seal` (exit 4) only after `start`, and the move cannot carry them, empty ones included; section 3.2 is the only check. No output says how many objects the seal copied (section 6 has the count). |
| - **amadan #338: an alias row can keep the flat socket after nesting** and answer 502. Check an instance's aliases after the nesting stop (section 9). |
| - **The source keeps root-owned files.** `/data/programs/<host>.json` (root, 0644, in a root-owned directory) cannot be parked by the agent, which runs as `carlos`; `status` says "left /data/programs/<host>.json in place: cannot be renamed: ... permission denied". The root-owned `/opt/carlos/live/<host>` link stays too, by design. Both are listed for the claim census, and both are the kind of leftover that section 3.3 catches if that box is ever a move target. |
| - **The console's offline figure ends at `open`** and leaves out the first wake (section 6). |
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-FIXES.md b/docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-FIXES.md| new file mode 100644 |
| index 000000000..7fe740df6 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-FIXES.md |
| @@ -0,0 +1,35 @@ |
| +Reviewed `ccd35818..6b580cd6db9e7d4c2bc59e02a306d58332fee3fb`, within round 1’s fix-check budget. HEAD adds only the brief. |
| + |
| +**P2-6 remains partly unresolved.** [docs/site/cli.md:3388](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/docs/site/cli.md:3388) still says the refused move “would fail.” A leftover link naming the sealed build passes [liveNotSealed:1250](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/host/movesoffline_land.go:1250), but the name-only probe cannot distinguish it. MV-O200 now explains the conservative policy correctly; MV-O203 still predicts an unestablished failure. Update the CLI paragraph and its copy-table row to describe that policy. **Invariant:** refusal copy distinguishes observed facts from predicted failures. Fix without reopening review. |
| + |
| +Round 1 dispositions: |
| + |
| +- **P1-1 — resolved:** effective UID 0 returns before filesystem access. |
| +- **P1-3, remaining half — resolved:** enumeration and reported names/bytes are bounded; overflow is explicit. |
| +- **P2-4 — resolved:** staging status checks the same facts before offering start. |
| +- **P2-5 — resolved by removal:** app-directory paths no longer reach refusal output; reported link names are compared, not printed. |
| +- **P2-6 — partly resolved:** MV-O200 corrected; MV-O203 remains inaccurate. |
| +- **P2-7 — resolved:** the runbook now limits the headline to status before finish. |
| + |
| +The app-directory implementation is removed. `movesoffline_seal.go` has the identical Git blob on the reviewed commit and `origin/main`: `f98559c24d3d6e0231790e339fe798b1ceef0853`. P1-2 and the directory half of P1-3 are therefore removed, not fixed. |
| + |
| +The probe opens only the live directory and enumerates names; it never stats, opens or follows an entry. Its precise bound is **4,096 retained names plus one overflow lookahead**, rather than literally 4,096 names read. It reports at most 128 names and 8 KiB of hostname bytes, plus JSON overhead. The added round-trip test covers `WriteBox` and `LoadBoxesComplete`. |
| + |
| +Bootstrap creates the host live directory with mode 0755; root’s release paths create links through `PointLive`. Tenant units receive read-only executable mounts. I found no tenant filesystem path that can create entries there. Legitimate deployments can cause root to create hostname entries; the bounds cover their accumulation. |
| + |
| +MV-O204 does not strand a move: it gates stage/start and staging status. [Abort:1241](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/console/apiinstancemove_offline.go:1241) and reverting-to-finish checks do not consult these facts. |
| + |
| +| Census unit or envelope | Verdict | Evidence | |
| +|---|---|---| |
| +| `CollectBox` | APPROVED | `snapshot.go:1251–1258,1315–1316`: supplied metrics only; no new external read. | |
| +| `statusLoop` | APPROVED | `agent.go:5086`: calls the identity-gated probe. | |
| +| `offlineMoveFactsProbe` | APPROVED | `movesoffline_facts.go:38–39`: passes actual effective UID. | |
| +| `movesWorker.offlineMoveFacts` | APPROVED | `movesoffline_facts.go:56–91`: UID refusal first; bounded name-only collection. | |
| +| `readNamesBounded` | APPROVED | `movesoffline_facts.go:97–120`: directory open and bounded enumeration, including one lookahead; no entry access. | |
| +| Envelope `.` | APPROVED | `move.go:1501–1511,1614–1619`: display changes add no root authority. | |
| +| Envelope `internal/host` | APPROVED | Gated probe above; seal restored byte-for-byte. | |
| +| Envelope `internal/status` | APPROVED | `snapshot.go:243–263,814,1258,1316`: private schema and supplied-value projection. | |
| + |
| +Targeted tests, including census checks, could not start: with `GOCACHE` unset, Go failed creating its work directory in the read-only sandbox. These are source-review approvals, not a claim that the tests passed. No files were edited; no subagents were used. |
| + |
| +**READY AFTER FIXES** |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-R1.md| new file mode 100644 |
| index 000000000..815ff863b |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-R1.md |
| @@ -0,0 +1,59 @@ |
| +Reviewed `4c641678..b7aa5590792d1c05c12fa2af586b3badc91db327`, round 1 of 3. Found three P1s. |
| + |
| +1. **P1 — The new periodic probe bypasses the census’s non-root condition.** |
| + [agent.go:5086](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/host/agent.go:5086) invokes the probe without an offline move in progress. [movesoffline_facts.go:51](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/host/movesoffline_facts.go:51) checks capability but not effective UID; [agententry.go:61](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/host/agententry.go:61) explicitly permits a root-run agent to continue. Such an agent now lists and opens tenant-controlled paths automatically, before an operator could perform the runbook’s `User=carlos` precheck. The existing census approval expressly depended on that precheck. |
| + **Fix:** Refuse this probe under UID 0 before filesystem access; test that refusal. |
| + **Invariant:** Tenant filesystem inspection accepted as agent-only must never execute as root. |
| + |
| +2. **P1 — `emptyDir` can follow a replacement symlink or block on a FIFO.** |
| + At [movesoffline_facts.go:105](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/host/movesoffline_facts.go:105), `Lstat` and `Open` resolve the path separately. The running app can replace the checked directory between them. A symlink redirects the open; a FIFO with no writer blocks it indefinitely, stopping the box’s status publication. These paths use the raw `.instances` tree, bypassing the protected mount view. |
| + **Fix:** Open directories atomically with no-follow and directory-only guarantees, anchored to a trusted directory; add replacement-race and special-file tests. |
| + **Invariant:** A tenant-controlled entry must neither redirect nor block the status probe. |
| + |
| +3. **P1 — Unbounded app entries can invalidate fleet evidence.** |
| + [movesoffline_facts.go:83](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/host/movesoffline_facts.go:83) collects every stray entry and appends every full path. A tenant creating 5,000 siblings with long names readily pushes the snapshot above the reader’s 1 MiB limit. [fleet.go:298](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/status/fleet.go:298) then drops the whole box report and marks evidence incomplete. Consequently, unrelated moves cannot stage or start; a move already stopping cannot seal. Scanning and allocation are also unbounded. |
| + **Fix:** Bound enumeration, per-host detail and total report bytes, retaining an explicit overflow/refusal indication without losing the heartbeat. Test through `WriteBox` and `LoadBoxesComplete`. |
| + **Invariant:** One tenant’s directory contents cannot disable box reporting or deployment-wide move operations. |
| + |
| +4. **P2 — Status recommends starting a move that the start door refuses.** |
| + The staging branch of [apiinstancemove_offline.go:938](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/console/apiinstancemove_offline.go:938) omits `offlineBoxFacts`. When a blocking link or directory appears after staging, status still returns `next: start`, despite having the same report that makes POST start return 409. |
| + **Fix:** Apply the facts check when computing the staging view’s next action, and test both newly appearing blockers. |
| + **Invariant:** Status must not recommend an action that its current evidence already disqualifies. |
| + |
| +5. **P2 — Tenant filenames reach the operator’s terminal unescaped.** |
| + [apiinstancemove_offline_facts.go:35](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/console/apiinstancemove_offline_facts.go:35) inserts raw paths into the refusal. JSON escaping does not protect terminal output: the CLI decodes the string and [move.go:104](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/move.go:104) prints it verbatim. A filename containing newlines or terminal escape sequences can forge lines or obscure the refusal. |
| + **Fix:** Escape control characters when rendering individual paths, with a malicious-filename test. |
| + **Invariant:** Tenant-controlled names remain displayed data, never terminal instructions. |
| + |
| +6. **P2 — MV-O200 and MV-O203 claim a failure the report does not establish.** |
| + [apiinstancemove_offline_facts.go:26](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/console/apiinstancemove_offline_facts.go:26) says the move “would fail at flip.” The probe reports every unrouted live-link name without reading its target, while [movesoffline_land.go:1250](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/internal/host/movesoffline_land.go:1250) accepts a link naming the sealed build. The runbook explicitly acknowledges this conservative refusal. |
| + **Fix:** Describe the conservative policy accurately, or collect enough evidence to establish the claimed mismatch. |
| + **Invariant:** Refusal copy distinguishes observed facts from predicted failures. |
| + |
| +7. **P2 — The runbook promises the new headline after `finish`, when it is unavailable.** |
| + [runbook:248](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/docs/superpowers/plans/2026-10-21-offline-move-runbook.md:248) says subsequent status prints “Nothing moved…” after describing abort and finish. Once finish clears the move, [move.go:1595](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/offline-move-stage-refusals-339/move.go:1595) prints the generic recorded outcome. MV-O202 applies only while the staged abort remains in `offline-reverting`. |
| + **Fix:** Scope the documentation to status before finish, or preserve the necessary outcome information. |
| + **Invariant:** Documented output matches the completed workflow. |
| + |
| +The refusal checks precede record and lock writes, and start repeats them after staging. The extracted seal rule preserves its previous behavior. Missing facts from older boxes leave the existing seal and landing safeguards intact. |
| + |
| +The new tests assert refusals and unchanged records. The E2E fixture reproduces collection and publication, but injects the worker’s facts directly; removing the production status-loop assignment would not fail it. Root execution, replacement races and report limits lack coverage. |
| + |
| +Tests could not run: the targeted `go test -run` attempt, with `GOCACHE` unset, failed creating Go’s build directory in the read-only sandbox. Discussion #339 was inaccessible because networking was blocked. No files were edited. |
| + |
| +Census verdicts for the requested commit: |
| + |
| +| Changed unit or envelope | Verdict | Basis | |
| +|---|---|---| |
| +| `internal/status/snapshot.go:CollectBox` | APPROVED | Lines 1255–1256 and 1314 carry supplied private metrics; no new external read. | |
| +| `internal/host/agent.go:statusLoop` | REFUSED | Line 5086 introduces the ungated periodic reads; findings 1–3. | |
| +| `internal/host/movesoffline_seal.go:movesWorker.offlineFilesOf` | APPROVED | Lines 672–685 preserve registry enumeration and delegation semantics. | |
| +| `internal/host/movesoffline_facts.go:emptyDir` | REFUSED | Lines 105–114 violate the no-follow basis; finding 2. | |
| +| `internal/host/movesoffline_facts.go:movesWorker.offlineMoveFacts` | REFUSED | Lines 51–96 permit root execution, unsafe opens and unbounded reporting. | |
| +| `internal/host/movesoffline_facts.go:offlineMoveFactsProbe` | REFUSED | Lines 31–32 expose those reads without the required identity restriction. | |
| +| `internal/host/movesoffline_seal.go:offlineFilesAt` | APPROVED | Lines 692–716 preserve the former seal classification and refusal rule; the unsafe new calling path is refused above. | |
| +| Envelope `.` | APPROVED | CLI changes add no root filesystem authority. | |
| +| Envelope `internal/host` | REFUSED | Findings 1–3 invalidate the proposed read-safety basis. | |
| +| Envelope `internal/status` | APPROVED | Additive private schema and supplied-value projection only. | |
| + |
| +NOT READY |
| \ No newline at end of file |
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339-FIXES.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339-FIXES.md| new file mode 100644 |
| index 000000000..284ee7a7f |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339-FIXES.md |
| @@ -0,0 +1,13 @@ |
| +# Review brief: #339 round 1 fixes, census and root check (same round budget) |
| + |
| +Repo carlos/platform, branch `offline-move-stage-refusals-339`, commit 6b580cd6db9e7d4c2bc59e02a306d58332fee3fb. |
| +Under review: the diff from ccd35818 (round 1's brief commit) to 6b580cd6db9e7d4c2bc59e02a306d58332fee3fb, i.e. the fixes for `docs/superpowers/reviews/CODEX-FINDINGS-OFFLINE-MOVE-REFUSALS-339-R1.md`. |
| + |
| +The controller cut item 4 (app directories) from this branch (follow-up amadan #1003), so P1-2 and the directory half of P1-3 are removed, not fixed. Confirm the removal is complete (seal byte-for-byte back to main). |
| + |
| +This is not a new review round (AGENTS.md stopping rule 1). Check only: |
| +1. **Census:** the re-proposed overlay and card for this branch: APPROVED or REFUSED per changed unit (statusLoop, the live-link probe, its helpers, envelopes). |
| +2. **Root and security behaviour the fixes changed:** the effective-UID 0 refusal is first, before any filesystem access; the probe reads only names in /opt/carlos/live (no stat, follow or open), bounded (4096 names read, 128 reported, 8 KiB, overflow flag) with the heartbeat kept valid; is /opt/carlos/live truly root-written only (who creates entries; can a tenant create a name there through any path)? Overflow refusal (MV-O204) cannot strand a move. |
| +3. One line each: round 1's P1-1, P1-3 (remaining half), P2-4, P2-5, P2-6, P2-7 resolved, partly, or not. |
| + |
| +Severity as in round 1. End with READY, READY AFTER FIXES or NOT READY. Do not edit files; no subagents; targeted tests only (GOCACHE unset). |
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339.md| new file mode 100644 |
| index 000000000..967c1b5b2 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-OFFLINE-MOVE-REFUSALS-339.md |
| @@ -0,0 +1,22 @@ |
| +# Review brief: offline move stage/start refusals (#339 items 1, 2, 4), branch, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `offline-move-stage-refusals-339`, commit b7aa5590792d1c05c12fa2af586b3badc91db327. |
| +Under review: the diff `4c6416787a42ce5da5964588de721817d25fc15d..b7aa5590792d1c05c12fa2af586b3badc91db327`. |
| +Authorities, merged on main: the offline-move runbook `docs/superpowers/plans/2026-10-21-offline-move-runbook.md`; `docs/superpowers/plans/2026-10-20-offline-operator-move.md`; AGENTS.md (stopping rules, census). The report: `amadan discuss show carlos/platform 339`. Do not review against unmerged branches (offline-move-pool-target-413 is in flight separately). |
| + |
| +You are an independent reviewer. Read the diff, then the code it touches, and check every claim. |
| + |
| +## What to check |
| +1. The new private status-report block (`offline_move`: stale live links for hosts with no route row; app directories beside an instance's files directory, empty or not): can a tenant influence what the agent reports (symlinks, races, names), and does the agent read anything as root or follow tenant-controlled links? Is it attributed to the right box and host, and bounded in size? |
| +2. The stage and start door refusals: do they refuse before anything goes offline or changes on the record; does start refuse even after stage passed; is "older box sends nothing, door lets it through" safe (backstops at landing and seal unchanged)? Any way a refusal could strand a move mid-state? |
| +3. `offlineFilesAt` refactor: the seal's refusal rule is byte-for-byte the same as before. |
| +4. Status after an abort from staging: correct for every abort path; older consoles handled by the CLI. |
| +5. Tests: would each fail if its guard were removed? The E2E's status-report writing mirrors the real status loop? |
| +6. **Census:** `docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md` and its overlay: you are the census reviewer (AGENTS.md "The census: the reviewer decides"); give APPROVED or REFUSED per changed unit. |
| +7. Copy rows MV-O200..O203: accurate to the behaviour (wording is reviewed separately). |
| + |
| +## Severity |
| +P1 blocks; P2 fixed without another round; P3 follow-up. A P1 states its failure scenario and evidence (file:line). |
| + |
| +## Output |
| +Findings ranked with evidence, failure scenario, fix and invariant. Then a Census verdict table. End with exactly one verdict: READY, READY AFTER FIXES, or NOT READY. Do not edit files; no subagents; targeted `go test -run` only (GOCACHE unset). |
diff --git a/internal/console/apiinstancemove_offline.go b/internal/console/apiinstancemove_offline.go| index 862501c3b..46db68bfb 100644 |
| --- a/internal/console/apiinstancemove_offline.go |
| +++ b/internal/console/apiinstancemove_offline.go |
| @@ -572,6 +572,10 @@ func (s *Server) offlineBeginChecks(w http.ResponseWriter, r *http.Request, d of |
| writeRefusal(w, ref) |
| return "", offlineFleet{}, false |
| } |
| + if ref := offlineBoxFacts(fleet, host, to); ref != nil { |
| + writeRefusal(w, ref) |
| + return "", offlineFleet{}, false |
| + } |
| return to, fleet, true |
| } |
| @@ -941,6 +945,9 @@ func (s *Server) offlineStepFor(ctx context.Context, d offlineDoor, mv *provisio |
| if ref := s.offlineSelect(ctx, fleet, host, mv.From, mv.To); ref != nil { |
| return offlineStep{}, ref |
| } |
| + if ref := offlineBoxFacts(fleet, host, mv.To); ref != nil { |
| + return offlineStep{}, ref |
| + } |
| if ref := s.offlineStagerPresent(fleet, mv, host); ref != nil { |
| return offlineStep{}, ref |
| } |
| @@ -1397,7 +1404,11 @@ func (s *Server) offlineViewOf(ctx context.Context, rec *provision.Record) offli |
| for _, r := range ev.reports { |
| v.Reports = append(v.Reports, offlineReportView{OfflineReport: r.OfflineReport, Fresh: offlineFresh(r.OfflineReport, now)}) |
| } |
| - v.Items = offlineItems(ev, mv) |
| + // A move that never went offline (staging, or reverting from it) has |
| + // checked nothing of the manifest, so it lists no item as waiting. |
| + if !v.NeverOffline { |
| + v.Items = offlineItems(ev, mv) |
| + } |
| v.Stage = offlineStageOf(ev) |
| for _, r := range ev.byRole(moves.OfflineRoleSource) { |
| for _, p := range r.Retired { |
diff --git a/internal/console/apiinstancemove_offline_facts.go b/internal/console/apiinstancemove_offline_facts.go| new file mode 100644 |
| index 000000000..d4e2d908b |
| --- /dev/null |
| +++ b/internal/console/apiinstancemove_offline_facts.go |
| @@ -0,0 +1,36 @@ |
| +package console |
| + |
| +import ( |
| + "fmt" |
| + "net/http" |
| + "slices" |
| +) |
| + |
| +// offlineBoxFacts refuses a start or a stage over a live link the target |
| +// box still holds for the host (#339), read from the box's status report |
| +// (status.OfflineMoveFacts), which the box writes while the instance still |
| +// serves. The landing fails its release item over any such link that does |
| +// not name the sealed build, at flip, with the instance offline; the |
| +// report names the link and not its build, so the door refuses any link, |
| +// and a list the box could not report whole as well. A box whose report |
| +// carries no facts says nothing, and the landing keeps its own check |
| +// behind this one. offlineSelect has already required exactly one target |
| +// box. Neither name in the sentences is a tenant's: host is the record's |
| +// host, a validated hostname, and the box is named as every other door |
| +// sentence names it, from its edges file, which only a box writes. The |
| +// link names in the report are never printed, only compared with host. |
| +func offlineBoxFacts(f offlineFleet, host, to string) *offlineRefusal { |
| + for _, b := range f.boxesAt(to) { |
| + m := f.metrics[b.Box] |
| + if m == nil || m.OfflineMove == nil { |
| + continue |
| + } |
| + if slices.Contains(m.OfflineMove.StaleLiveLinks, host) { |
| + return &offlineRefusal{status: http.StatusConflict, msg: fmt.Sprintf("%s still holds a live link for %s from when it last ran there. stage and start refuse until it is cleared, since a mismatched link fails the move only after %s is offline. see the offline move runbook", b.Box, host, host)} |
| + } |
| + if m.OfflineMove.StaleLiveLinksOverflow { |
| + return &offlineRefusal{status: http.StatusConflict, msg: fmt.Sprintf("%s holds more live links than it can report, so stage and start cannot tell whether one is for %s. see the offline move runbook", b.Box, host)} |
| + } |
| + } |
| + return nil |
| +} |
diff --git a/internal/console/apiinstancemove_offline_stage_test.go b/internal/console/apiinstancemove_offline_stage_test.go| index a22255413..9f1445389 100644 |
| --- a/internal/console/apiinstancemove_offline_stage_test.go |
| +++ b/internal/console/apiinstancemove_offline_stage_test.go |
| @@ -161,8 +161,13 @@ func TestOfflineAbortFromStagingDoor(t *testing.T) { |
| w := newOfflineWorld(t, oneEach...) |
| w.stage() |
| w.staged("ie-box", nil) |
| - if v := w.ok("/abort", "", provision.OfflineReverting); !v.NeverOffline { |
| - t.Fatal("an abort from staging does not say the instance was never offline") |
| + if v := w.ok("/abort", "", provision.OfflineReverting); !v.NeverOffline || len(v.Items) != 0 { |
| + t.Fatalf("an abort from staging: never offline %v, items %v", v.NeverOffline, v.Items) |
| + } |
| + // Nothing of the manifest was ever checked, so the status lists no |
| + // item as waiting (#339, item 2). |
| + if st := w.status(); len(st.Items) != 0 { |
| + t.Fatalf("the status of an abort from staging lists %d items", len(st.Items)) |
| } |
| if rec := w.record(); rec.Region != "ie" || rec.Move.State != provision.OfflineReverting { |
| t.Fatalf("after abort: %q %+v", rec.Region, rec.Move) |
| @@ -323,3 +328,69 @@ func TestOfflineStagedMoveRefusesChangedCoordinates(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +// ---- #339: refused while the instance still serves ---- |
| + |
| +func msgO200(box string) string { |
| + return box + " still holds a live link for " + offlineHost + " from when it last ran there. stage and start refuse until it is cleared, since a mismatched link fails the move only after " + offlineHost + " is offline. see the offline move runbook" |
| +} |
| + |
| +func msgO204(box string) string { |
| + return box + " holds more live links than it can report, so stage and start cannot tell whether one is for " + offlineHost + ". see the offline move runbook" |
| +} |
| + |
| +// A target box that reports a live link for the host, left from an earlier |
| +// time the instance ran there, would fail the landing's release item at |
| +// flip, with the instance offline. Stage and start refuse it before |
| +// anything is written, and so does a box that could not report its links |
| +// whole. A link that appears after the stage refuses the start, the status |
| +// no longer offers start, and the move stays staging until it is gone. |
| +func TestOfflineStageAndStartRefuseAStaleLiveLinkOnTheTarget(t *testing.T) { |
| + stale := offlineBox{Box: "uk-box", Placement: "uk", Bucket: "data-uk", LiveLinks: []string{"other.shop.example.com", offlineHost}} |
| + w := newOfflineWorld(t, ieOff("ie-box"), stale) |
| + w.refused(http.MethodPost, "/stage", `{"region":"uk"}`, http.StatusConflict, msgO200("uk-box")) |
| + w.refused(http.MethodPost, "", `{"region":"uk"}`, http.StatusConflict, msgO200("uk-box")) |
| + if rec := w.record(); rec.Move != nil { |
| + t.Fatalf("a refused door wrote %+v", rec.Move) |
| + } |
| + if _, ok := w.lock(); ok { |
| + t.Fatal("a refused door took the lock") |
| + } |
| + |
| + // A list the box could not report whole refuses too, the host in it |
| + // or not. |
| + full := offlineBox{Box: "uk-box", Placement: "uk", Bucket: "data-uk", LiveLinks: []string{"other.shop.example.com"}, LinksOverflow: true} |
| + wo := newOfflineWorld(t, ieOff("ie-box"), full) |
| + wo.refused(http.MethodPost, "/stage", `{"region":"uk"}`, http.StatusConflict, msgO204("uk-box")) |
| + wo.refused(http.MethodPost, "", `{"region":"uk"}`, http.StatusConflict, msgO204("uk-box")) |
| + |
| + // A link for another host, or one on a source box, refuses nothing. |
| + w2 := newOfflineWorld(t, offlineBox{Box: "ie-box", Placement: "ie", Bucket: "data-ie", LiveLinks: []string{offlineHost}}, |
| + offlineBox{Box: "uk-box", Placement: "uk", Bucket: "data-uk", LiveLinks: []string{"other.shop.example.com"}}) |
| + w2.stage() |
| + |
| + // The link appears after the stage: start refuses, the staging status |
| + // says why instead of offering start, the move stays staging, and once |
| + // the box no longer reports it start goes ahead. |
| + for _, c := range []struct { |
| + box offlineBox |
| + want string |
| + }{{stale, msgO200("uk-box")}, {full, msgO204("uk-box")}} { |
| + w3 := newOfflineWorld(t, oneEach...) |
| + w3.stage() |
| + if st := w3.status(); st.Next != offlineVerbStart { |
| + t.Fatalf("a clean staged move: next %q, waiting %q", st.Next, st.Waiting) |
| + } |
| + w3.fleet(c.box) |
| + if st := w3.status(); st.Next != "" || st.Waiting != c.want { |
| + t.Fatalf("staged with a blocking report: next %q, waiting %q", st.Next, st.Waiting) |
| + } |
| + w3.refused(http.MethodPost, "", `{"region":"uk"}`, http.StatusConflict, c.want) |
| + w3.refused(http.MethodPost, "/stage", `{"region":"uk"}`, http.StatusConflict, c.want) |
| + if rec := w3.record(); rec.Move.State != provision.OfflineStaging { |
| + t.Fatalf("after a refused start the move is %s", rec.Move.State) |
| + } |
| + w3.fleet(ukOff("uk-box")) |
| + w3.ok("", `{"region":"uk"}`, provision.OfflineStopping) |
| + } |
| +} |
diff --git a/internal/console/apiinstancemove_offline_test.go b/internal/console/apiinstancemove_offline_test.go| index 7b6d0c144..c1fcfb622 100644 |
| --- a/internal/console/apiinstancemove_offline_test.go |
| +++ b/internal/console/apiinstancemove_offline_test.go |
| @@ -73,6 +73,10 @@ type offlineBox struct { |
| NoHibernation bool // hibernation_configured false |
| Hosts []string // hosts its edges file lists |
| FP string // secrets_key_fp; testKeyFP when empty |
| + // LiveLinks and LinksOverflow are the box's offline move facts (#339): |
| + // the hosts it keeps a stale live link for, and whether it holds more. |
| + LiveLinks []string |
| + LinksOverflow bool |
| } |
| func ieOff(box string) offlineBox { return offlineBox{Box: box, Placement: "ie", Bucket: "data-ie"} } |
| @@ -166,7 +170,8 @@ func (w *offlineWorld) fleet(boxes ...offlineBox) { |
| offlinePut(w.t, w.fx.rel, edgesFilePrefix+b.Box+".json", body) |
| sb := status.Box{Label: b.Box, GeneratedAt: time.Now()} |
| if !b.NoMetrics { |
| - sb.Metrics = &status.BoxMetrics{HostClaimEnabled: b.ClaimsOn} |
| + sb.Metrics = &status.BoxMetrics{HostClaimEnabled: b.ClaimsOn, |
| + OfflineMove: &status.OfflineMoveFacts{StaleLiveLinks: b.LiveLinks, StaleLiveLinksOverflow: b.LinksOverflow}} |
| } |
| if err := status.WriteBox(context.Background(), w.fx.rel, sb); err != nil { |
| w.t.Fatal(err) |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index 8ef441d44..4ac7378b6 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -5125,6 +5125,12 @@ func statusLoop(reg *registry.Registry, svc *activator.Service, buildStates func |
| // activator's memory: no store request, no root call. nil with no |
| // activator. Private Metrics only. |
| p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes) |
| + // What an offline move's stage and start doors read from this box |
| + // while its instances still serve (#339): stale live links and the |
| + // entries beside each instance's files directory. Directory |
| + // listings only; nil when the box cannot take part in an offline |
| + // move. Private Metrics only: hosts. |
| + p.OfflineMove = offlineMoveFactsProbe(routes) |
| // A fleet box (CARLOS_FLEET set) never gets here as a contender: it |
| // self-reports only, never attempting the election at all — no |
diff --git a/internal/host/movesoffline_e2e_test.go b/internal/host/movesoffline_e2e_test.go| index a663ec804..9c9a1a831 100644 |
| --- a/internal/host/movesoffline_e2e_test.go |
| +++ b/internal/host/movesoffline_e2e_test.go |
| @@ -9,6 +9,9 @@ import ( |
| "encoding/json" |
| "errors" |
| "fmt" |
| + "go/ast" |
| + "go/parser" |
| + "go/token" |
| "io" |
| "net/http" |
| "net/http/httptest" |
| @@ -62,9 +65,10 @@ import ( |
| // and the restore; |
| // - the operator page (sealWorld.arm's Page records instead of writing |
| // the outbox), so the test can say no page fired; |
| -// - the box status snapshots, written once before the move as each box's |
| -// status loop would (status.WriteBox), because the console's fleet read |
| -// joins them and no status loop runs in a test; |
| +// - the box status snapshots, written before the move as each box's |
| +// status loop would (CollectBox with the box's offline move facts, then |
| +// status.WriteBox), because the console's fleet read joins them and no |
| +// status loop runs in a test; |
| // - the reconcile Layout intent (offBox.reconcile names flat or nested) |
| // instead of mintLayoutIntentWith, as T3 to T5's worlds do; |
| // - the source's config.env is rendered once by RenderHeld before the |
| @@ -379,17 +383,81 @@ func newE2EWorld(t *testing.T, opts landOpts) *e2eWorld { |
| // Both boxes published as their loops publish them, and their status |
| // snapshots. |
| w.tickAll() |
| - for _, b := range []*offBox{ie, lw.uk} { |
| - if err := status.WriteBox(ctx, rs, status.Box{Label: b.name, GeneratedAt: time.Now(), Metrics: &status.BoxMetrics{}}); err != nil { |
| - t.Fatal(err) |
| - } |
| - } |
| + w.reportStatus() |
| if !ie.lists(offHost) || lw.uk.lists(offHost) { |
| t.Fatal("fixture: ie-box must serve the host and uk-box must not") |
| } |
| return w |
| } |
| +// reportStatus writes each box's status snapshot as its status loop does: |
| +// CollectBox over the box's rows with p.OfflineMove from the loop's own |
| +// probe (offlineMoveFactsProbe, #339), with the box's worker armed for the |
| +// call, under the box's name. The loop's assignment is checked first |
| +// (requireStatusLoopReportsOfflineFacts), so the snapshots are the loop's. |
| +func (w *e2eWorld) reportStatus() { |
| + w.t.Helper() |
| + requireStatusLoopReportsOfflineFacts(w.t) |
| + if os.Geteuid() == 0 { |
| + w.t.Skip("the offline move facts are never read as root") |
| + } |
| + prev := armedMovesWorker.Load() |
| + defer armedMovesWorker.Store(prev) |
| + for _, b := range []*offBox{w.ie, w.uk} { |
| + routes, err := b.reg.List() |
| + if err != nil { |
| + w.t.Fatal(err) |
| + } |
| + armedMovesWorker.Store(b.w) |
| + var p status.Probes |
| + p.OfflineMove = offlineMoveFactsProbe(routes) |
| + box := status.CollectBox(routes, p, time.Now()) |
| + box.Label = b.name |
| + if err := status.WriteBox(context.Background(), w.rs, box); err != nil { |
| + w.t.Fatal(err) |
| + } |
| + } |
| +} |
| + |
| +// requireStatusLoopReportsOfflineFacts: statusLoop sets p.OfflineMove from |
| +// offlineMoveFactsProbe over the tick's routes. No test can run the loop |
| +// itself, so the E2E reads it: without the assignment no box would report |
| +// a live link and the doors would refuse nothing. |
| +func requireStatusLoopReportsOfflineFacts(t *testing.T) { |
| + t.Helper() |
| + file, err := parser.ParseFile(token.NewFileSet(), "agent.go", nil, 0) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + found := false |
| + for _, decl := range file.Decls { |
| + fn, ok := decl.(*ast.FuncDecl) |
| + if !ok || fn.Name.Name != "statusLoop" { |
| + continue |
| + } |
| + ast.Inspect(fn.Body, func(n ast.Node) bool { |
| + as, ok := n.(*ast.AssignStmt) |
| + if !ok || len(as.Lhs) != 1 || len(as.Rhs) != 1 { |
| + return true |
| + } |
| + sel, ok := as.Lhs[0].(*ast.SelectorExpr) |
| + call, isCall := as.Rhs[0].(*ast.CallExpr) |
| + if !ok || !isCall || sel.Sel.Name != "OfflineMove" || len(call.Args) != 1 { |
| + return true |
| + } |
| + if id, ok := call.Fun.(*ast.Ident); ok && id.Name == "offlineMoveFactsProbe" { |
| + if arg, ok := call.Args[0].(*ast.Ident); ok && arg.Name == "routes" { |
| + found = true |
| + } |
| + } |
| + return true |
| + }) |
| + } |
| + if !found { |
| + t.Fatal("statusLoop does not set p.OfflineMove = offlineMoveFactsProbe(routes): no box reports its live links") |
| + } |
| +} |
| + |
| // publish is one pass of edgesFileLoop on b: the identity it builds at arm |
| // from the box's own environment, the capability from the box's armed |
| // worker, through the production writer, with the box's lifetimes switch |
| @@ -1104,6 +1172,60 @@ func TestOfflineMoveE2E(t *testing.T) { |
| // minutes of belief in a report. |
| t.Run("doors back to back", func(t *testing.T) { offlineMoveDoorsApart(t, 0) }) |
| t.Run("doors three minutes apart", func(t *testing.T) { offlineMoveDoorsApart(t, 3*time.Minute) }) |
| + // #339: a stale live link that failed a move only after the instance |
| + // was offline is refused by stage and start, from the target box's own |
| + // status report. |
| + t.Run("stage and start refuse a stale live link on the target", offlineRefusesAStaleLiveLink) |
| +} |
| + |
| +// requireRefused posts verb and wants a 409 with msg, no write to the |
| +// deployment store and the record byte for byte as it was. |
| +func (w *e2eWorld) requireRefused(verb, msg string) { |
| + w.t.Helper() |
| + mark, rec := w.rs.mark(), w.recordRaw() |
| + code, out := w.door(verb, `{"region":"uk"}`) |
| + var e struct { |
| + Error string `json:"error"` |
| + } |
| + _ = json.Unmarshal([]byte(out), &e) |
| + if code != http.StatusConflict || e.Error != msg { |
| + w.t.Fatalf("%s = %d %s\nwant 409 %q", verbName(verb), code, out, msg) |
| + } |
| + if writes := w.rs.since(mark); len(writes) != 0 { |
| + w.t.Fatalf("a refused %s wrote %v", verbName(verb), writes) |
| + } |
| + if !bytes.Equal(w.recordRaw(), rec) { |
| + w.t.Fatalf("a refused %s changed the record", verbName(verb)) |
| + } |
| +} |
| + |
| +// A return move to a box that still keeps the host's live link from the |
| +// last time it ran there (2026-10-21, #339 item 1): uk-box reports the link |
| +// in its status report, and stage and start refuse before anything is |
| +// written. Without the link stage goes ahead; a link that appears after the |
| +// stage refuses the start, with the instance still serving from ie-box. |
| +func offlineRefusesAStaleLiveLink(t *testing.T) { |
| + w := newE2EWorld(t, landOpts{}) |
| + old := w.stageLive("v0") |
| + w.reportStatus() |
| + msg := "uk-box still holds a live link for " + offHost + " from when it last ran there. stage and start refuse until it is cleared, since a mismatched link fails the move only after " + offHost + " is offline. see the offline move runbook" |
| + w.requireRefused("stage", msg) |
| + w.requireRefused("", msg) |
| + if got, err := os.Readlink(release.LiveLink(w.uk.opt, offHost)); err != nil || got != old { |
| + t.Fatalf("the live link is %q (%v), want it left at %q", got, err, old) |
| + } |
| + |
| + if err := os.Remove(release.LiveLink(w.uk.opt, offHost)); err != nil { |
| + t.Fatal(err) |
| + } |
| + w.reportStatus() |
| + w.accept("stage", `{"region":"uk"}`, provision.OfflineStaging) |
| + w.stageLive("v0") |
| + w.reportStatus() |
| + w.requireRefused("", msg) |
| + if !w.ie.lists(offHost) { |
| + t.Fatal("ie-box stopped serving the host over a refused start") |
| + } |
| } |
| // e2eLoops are what acts on the two boxes between door calls in production, |
diff --git a/internal/host/movesoffline_facts.go b/internal/host/movesoffline_facts.go| new file mode 100644 |
| index 000000000..4745494af |
| --- /dev/null |
| +++ b/internal/host/movesoffline_facts.go |
| @@ -0,0 +1,121 @@ |
| +package host |
| + |
| +import ( |
| + "errors" |
| + "io" |
| + "log" |
| + "os" |
| + "path/filepath" |
| + "sort" |
| + |
| + "github.com/carlosframework/platform/internal/controlname" |
| + "github.com/carlosframework/platform/internal/registry" |
| + "github.com/carlosframework/platform/internal/release" |
| + "github.com/carlosframework/platform/internal/status" |
| +) |
| + |
| +// What a box tells an offline move's stage and start doors about its own |
| +// disk while the instance still serves (#339): the hosts it keeps a live |
| +// link for with no row here. A box the instance once left keeps the link, |
| +// root-owned, naming the build it ran then (retirePaths leaves it), and the |
| +// landing fails its release item over any link that does not name the |
| +// sealed build (liveNotSealed), at flip, with the instance offline. The box |
| +// reports the names in its status report and the doors refuse first. The |
| +// landing keeps its own check. |
| +// |
| +// The probe reads one directory's names and nothing else: <opt>/live is |
| +// root's (bootstrap makes it 0755, root alone writes it, and every name in |
| +// it is one root gave PointLive for a host its registry held). It never |
| +// stats, follows or opens an entry, and changes nothing. |
| + |
| +// offlineLiveScanMax bounds how many names one probe reads from <opt>/live. |
| +// Past it the probe stops and says so (StaleLiveLinksOverflow). |
| +const offlineLiveScanMax = 4096 |
| + |
| +// offlineMoveFactsProbe is the armed worker's facts over routes, for the |
| +// status loop; nil when no worker is armed, the box cannot take part in an |
| +// offline move, or the agent runs as root. |
| +func offlineMoveFactsProbe(routes []registry.Route) *status.OfflineMoveFacts { |
| + return armedMovesWorker.Load().offlineMoveFacts(routes, os.Geteuid()) |
| +} |
| + |
| +// offlineMoveFacts is this box's report, from routes (every row on the |
| +// box, as the status loop lists them): every name in <opt>/live that is a |
| +// hostname with no row here, sorted. At most status.MaxStaleLiveLinks names |
| +// and status.MaxStaleLiveLinkBytes bytes of them are reported, and at most |
| +// offlineLiveScanMax names are read; past any of these the list is partial |
| +// and StaleLiveLinksOverflow says so, so the report stays small enough for |
| +// every reader whatever the box holds. |
| +// |
| +// nil, before any filesystem access, under euid 0: the census accepts this |
| +// read as the agent's (user carlos) and never root's, the rule the metrics |
| +// loop's root-run probes follow (engineBeatArmed, newRestartWatchFile). |
| +// nil too when the box cannot take part in an offline move, or when the |
| +// listing fails: a box that cannot say reports nothing, rather than a |
| +// partial answer a door would read as complete. |
| +func (w *movesWorker) offlineMoveFacts(routes []registry.Route, euid int) *status.OfflineMoveFacts { |
| + if euid == 0 || w == nil || !w.cfg.OfflineCapable || w.cfg.Offline == nil { |
| + return nil |
| + } |
| + routed := map[string]bool{} |
| + for _, rt := range routes { |
| + routed[rt.Host] = true |
| + } |
| + optDir := w.cfg.OptDir |
| + if optDir == "" { |
| + optDir = release.OptDir() |
| + } |
| + liveDir := filepath.Dir(release.LiveLink(optDir, "host")) |
| + names, more, err := readNamesBounded(liveDir, offlineLiveScanMax) |
| + if err != nil { |
| + log.Printf("moves: offline move facts: list %s: %v", liveDir, err) |
| + return nil |
| + } |
| + facts := &status.OfflineMoveFacts{StaleLiveLinksOverflow: more} |
| + var stale []string |
| + for _, name := range names { |
| + if controlname.ValidHostShape(name) && !routed[name] { |
| + stale = append(stale, name) |
| + } |
| + } |
| + sort.Strings(stale) |
| + size := 0 |
| + for _, name := range stale { |
| + if len(facts.StaleLiveLinks) == status.MaxStaleLiveLinks || size+len(name) > status.MaxStaleLiveLinkBytes { |
| + facts.StaleLiveLinksOverflow = true |
| + break |
| + } |
| + facts.StaleLiveLinks = append(facts.StaleLiveLinks, name) |
| + size += len(name) |
| + } |
| + return facts |
| +} |
| + |
| +// readNamesBounded reads at most max entry names of dir (getdents only: no |
| +// entry is stat'd or followed). more says the directory holds more. A |
| +// directory that does not exist has no names. |
| +func readNamesBounded(dir string, max int) (names []string, more bool, err error) { |
| + f, err := os.Open(dir) |
| + if errors.Is(err, os.ErrNotExist) { |
| + return nil, false, nil |
| + } else if err != nil { |
| + return nil, false, err |
| + } |
| + defer f.Close() |
| + for len(names) < max { |
| + batch, err := f.Readdirnames(min(256, max-len(names))) |
| + names = append(names, batch...) |
| + if errors.Is(err, io.EOF) { |
| + return names, false, nil |
| + } else if err != nil { |
| + return nil, false, err |
| + } |
| + } |
| + extra, err := f.Readdirnames(1) |
| + if errors.Is(err, io.EOF) { |
| + return names, false, nil |
| + } else if err != nil { |
| + return nil, false, err |
| + } |
| + return names, len(extra) > 0, nil |
| +} |
diff --git a/internal/host/movesoffline_facts_test.go b/internal/host/movesoffline_facts_test.go| new file mode 100644 |
| index 000000000..ee4271b17 |
| --- /dev/null |
| +++ b/internal/host/movesoffline_facts_test.go |
| @@ -0,0 +1,123 @@ |
| +package host |
| + |
| +import ( |
| + "context" |
| + "fmt" |
| + "os" |
| + "path/filepath" |
| + "slices" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/registry" |
| + "github.com/carlosframework/platform/internal/release" |
| + "github.com/carlosframework/platform/internal/status" |
| +) |
| + |
| +// factsWorker is a capable worker over its own <opt>, with names in |
| +// <opt>/live as dangling links (the probe reads names and follows nothing). |
| +func factsWorker(t *testing.T, names ...string) *movesWorker { |
| + t.Helper() |
| + opt := t.TempDir() |
| + for _, n := range names { |
| + link := release.LiveLink(opt, n) |
| + if err := os.MkdirAll(filepath.Dir(link), 0o755); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := os.Symlink(filepath.Join(opt, "versions", "gone", n), link); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + return newMovesWorker(moveCfg{OfflineCapable: true, Offline: &offlineView{}, OptDir: opt}) |
| +} |
| + |
| +// The facts are the unrouted hostnames in <opt>/live, sorted; a routed |
| +// host, a name that is not a hostname, a box that cannot take part and a |
| +// root-run agent report none (#339, Astra round 1, P1-1: never read as |
| +// root, before any filesystem access). |
| +func TestOfflineMoveFactsReportsStaleLiveLinks(t *testing.T) { |
| + w := factsWorker(t, "b.example.com", "a.example.com", "served.example.com", ".tmp-x") |
| + routes := []registry.Route{{Host: "served.example.com", Kind: "instance"}} |
| + f := w.offlineMoveFacts(routes, 1000) |
| + if f == nil || !slices.Equal(f.StaleLiveLinks, []string{"a.example.com", "b.example.com"}) || f.StaleLiveLinksOverflow { |
| + t.Fatalf("facts %+v", f) |
| + } |
| + // Under root the probe reports nothing, the links there or not: it |
| + // returns before it touches the disk. |
| + if f := w.offlineMoveFacts(routes, 0); f != nil { |
| + t.Fatalf("a root-run agent reported %+v", f) |
| + } |
| + notDir := filepath.Join(t.TempDir(), "file") |
| + writeFile(t, notDir, "x") |
| + w.cfg.OptDir = notDir |
| + if f := w.offlineMoveFacts(nil, 1000); f != nil { |
| + t.Fatalf("a failed listing reported %+v", f) |
| + } |
| + w.cfg.OptDir = filepath.Join(t.TempDir(), "absent") |
| + if f := w.offlineMoveFacts(nil, 1000); f == nil || len(f.StaleLiveLinks) != 0 { |
| + t.Fatalf("no live directory: %+v", f) |
| + } |
| + if f := newMovesWorker(moveCfg{OptDir: w.cfg.OptDir}).offlineMoveFacts(nil, 1000); f != nil { |
| + t.Fatalf("a box that cannot take part reported %+v", f) |
| + } |
| + var nilWorker *movesWorker |
| + if f := nilWorker.offlineMoveFacts(nil, 1000); f != nil { |
| + t.Fatalf("no worker reported %+v", f) |
| + } |
| +} |
| + |
| +// Astra round 1, P1-3: whatever a box holds, the report stays bounded in |
| +// names, bytes and the names read, says it is partial, and the heartbeat |
| +// still reads back whole through WriteBox and LoadBoxesComplete. |
| +func TestOfflineMoveFactsAreBounded(t *testing.T) { |
| + long := strings.Repeat("a", 60) |
| + for _, c := range []struct { |
| + name string |
| + names []string |
| + max int // the most names the report may carry |
| + }{ |
| + {"names", hostNames(300, "h%03d.example.com"), status.MaxStaleLiveLinks}, |
| + {"bytes", hostNames(150, long+"%03d.example.com"), status.MaxStaleLiveLinkBytes / (len(long) + 15)}, |
| + // Every name but two is routed, so only the scan bound can say |
| + // the box holds more than it read. |
| + {"scan", hostNames(offlineLiveScanMax+1, "s%05d.example.com"), 2}, |
| + } { |
| + t.Run(c.name, func(t *testing.T) { |
| + w := factsWorker(t, c.names...) |
| + var routes []registry.Route |
| + if c.name == "scan" { |
| + for _, h := range c.names[2:] { |
| + routes = append(routes, registry.Route{Host: h, Kind: "instance"}) |
| + } |
| + } |
| + f := w.offlineMoveFacts(routes, 1000) |
| + size := 0 |
| + for _, n := range f.StaleLiveLinks { |
| + size += len(n) |
| + } |
| + if !f.StaleLiveLinksOverflow || len(f.StaleLiveLinks) > c.max || len(f.StaleLiveLinks) == 0 || size > status.MaxStaleLiveLinkBytes || !slices.IsSorted(f.StaleLiveLinks) { |
| + t.Fatalf("%d names (%d bytes), overflow %v", len(f.StaleLiveLinks), size, f.StaleLiveLinksOverflow) |
| + } |
| + s := release.NewDirStore(t.TempDir()) |
| + box := status.CollectBox(nil, status.Probes{OfflineMove: f}, time.Now()) |
| + box.Label = "uk-box" |
| + if err := status.WriteBox(context.Background(), s, box); err != nil { |
| + t.Fatal(err) |
| + } |
| + boxes, complete, err := status.LoadBoxesComplete(context.Background(), s) |
| + if err != nil || !complete || len(boxes) != 1 || boxes[0].Metrics == nil || boxes[0].Metrics.OfflineMove == nil || |
| + !boxes[0].Metrics.OfflineMove.StaleLiveLinksOverflow || len(boxes[0].Metrics.OfflineMove.StaleLiveLinks) != len(f.StaleLiveLinks) { |
| + t.Fatalf("read back: complete %v, err %v, boxes %d", complete, err, len(boxes)) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func hostNames(n int, format string) []string { |
| + out := make([]string, n) |
| + for i := range out { |
| + out[i] = fmt.Sprintf(format, i) |
| + } |
| + return out |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index e6dab858f..109e84eb3 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -208,4 +208,5 @@ plan14-root-reads-instance-gomemlimit-991.tsv 19c9f395547d998f4b5e87e89c0dfa3b5f |
| plan14-root-reads-ppv2-operator-copy.tsv 19c9f395547d998f4b5e87e89c0dfa3b5f012d177a87eb5010a8c4defac305dc |
| plan14-root-reads-same-box-edge-fence.tsv 76c986ad534d23071100a9a573ffb38afc60b26c8942baf218436bf6a3ff03b3 |
| plan14-root-reads-g6-fence.tsv 3f43afa4b0c18ad678a952b48b511e74e849992cd629b9aa1442bbe0055d5631 |
| -plan14-root-reads-platform-mail-submission.tsv 7eacbf23d4e02e255481301f0caad19744cc9003f7278bd7691be044d665e38b |
| +plan14-root-reads-offline-move-stage-refusals-339.tsv 846d1f22e6eb6b2cd8b3086fa554f15deba70418c6542b46b2e2a6a138b6c332 |
| +plan14-root-reads-platform-mail-submission.tsv 72eca621463fbdb5c15b2f273b443bc9e931c67266329b124664dc4220240814 |
diff --git a/internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv b/internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv| new file mode 100644 |
| index 000000000..19fc9e5b4 |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-offline-move-stage-refusals-339.tsv |
| @@ -0,0 +1,16 @@ |
| +# Census overlay offline-move-stage-refusals-339, written by census-propose (#369). census-ruling-offline-move-stage-refusals-339, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-offline-move-stage-refusals-339.md. |
| +# 1 body, 1 sites, 3 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 3 new dispositions: 0 reads re-frozen at their disposition with the claim, 3 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| +@legacy 82364189d85f53dceebfa94131a75303ea4f8423ff2b8c8d19efccfe7cc9a329 internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 32791b85240b09b4c70694b6cc07cddf1f657838f35072544ffe08e25c93be09 |
| +@legacy 5e6134d8233749331c52d44ced78938f076ec696732e1c1113ea32554ed699f7 internal/host/movesoffline_facts.go movesWorker.offlineMoveFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339 (round 1: item 4 cut, P1-1, P1-3): returns nil under euid 0 before touching the disk. Otherwise lists only the names of <opt>/live (root-owned, 0755; every name made by root PointLive for a host its registry held) through readNamesBounded; no entry is stat'd, followed or opened, and nothing under the .instances tree or any tenant path is read. Reports at most 128 unrouted hostnames and 8 KiB of them, with an overflow flag past those or the 4096-name scan bound. Agent only (user carlos); changes nothing; root never reads the report. registry:Host@261,whole:Route@243 faf46d977778900a12fcb0bd3d8aba94e9e227a166af4fb489af012e0c0a83c1 |
| +@legacy ff9bc0958d50dfd6527959a953e8b28b68ddbae45a98cec255f55ec66c271a41 internal/host/movesoffline_facts.go offlineMoveFactsProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339 (round 1 P1-1): the armed moves worker's offlineMoveFacts over the status tick's routes with os.Geteuid(); nil when none is armed, the box is not offline-capable, or the agent runs as root (refused before any filesystem access). whole:Route@128 3ca4f5b13ed40f19e642093e27c0b254080fd724eb123c8daa342d26d19433f8 |
| +@legacy 3eb94c44249fdbd841db5c046e4e4e67117cf016b70678eda2447eca0a385934 internal/host/movesoffline_facts.go readNamesBounded legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339 (round 1 P1-3): os.Open of the directory and Readdirnames in batches, at most max names (getdents only: nothing stat'd or followed), and whether more remain; a missing directory has no names. Agent only, read only. file:Open@95,file:Readdirnames@279,file:Readdirnames@485 48773914dfdc133ba845b7855486d6151c0752f4b6bd80f73e71abf9e831222e |
| +@legacy 837bbc4fc70d6dd6071861d7fc9f548b350c9b9d9f9076dd71b535a0c78fdf79 internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added. whole:Route@10554,whole:Route@12368,whole:Route@12649,whole:Route@13007,whole:Route@6583,whole:Route@6610,whole:Route@7918 d31679b7894515917fe6fff0181b1e05d3507e042fc6952f557c8b3bed453783 |
| +internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 32791b85240b09b4c70694b6cc07cddf1f657838f35072544ffe08e25c93be09 |
| +internal/host/movesoffline_facts.go movesWorker.offlineMoveFacts legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339 (round 1: item 4 cut, P1-1, P1-3): returns nil under euid 0 before touching the disk. Otherwise lists only the names of <opt>/live (root-owned, 0755; every name made by root PointLive for a host its registry held) through readNamesBounded; no entry is stat'd, followed or opened, and nothing under the .instances tree or any tenant path is read. Reports at most 128 unrouted hostnames and 8 KiB of them, with an overflow flag past those or the 4096-name scan bound. Agent only (user carlos); changes nothing; root never reads the report. registry:Host@261,whole:Route@243 faf46d977778900a12fcb0bd3d8aba94e9e227a166af4fb489af012e0c0a83c1 |
| +internal/host/movesoffline_facts.go offlineMoveFactsProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339 (round 1 P1-1): the armed moves worker's offlineMoveFacts over the status tick's routes with os.Geteuid(); nil when none is armed, the box is not offline-capable, or the agent runs as root (refused before any filesystem access). whole:Route@128 3ca4f5b13ed40f19e642093e27c0b254080fd724eb123c8daa342d26d19433f8 |
| +internal/host/movesoffline_facts.go readNamesBounded legacy accepted-legacy accepted-legacy;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339 (round 1 P1-3): os.Open of the directory and Readdirnames in batches, at most max names (getdents only: nothing stat'd or followed), and whether more remain; a missing directory has no names. Agent only, read only. file:Open@95,file:Readdirnames@279,file:Readdirnames@485 48773914dfdc133ba845b7855486d6151c0752f4b6bd80f73e71abf9e831222e |
| +internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added. whole:Route@10554,whole:Route@12368,whole:Route@12649,whole:Route@13007,whole:Route@6583,whole:Route@6610,whole:Route@7918 d31679b7894515917fe6fff0181b1e05d3507e042fc6952f557c8b3bed453783 |
| +@coverage . 3bbbac33b39ea2533731fafb1c1f1a2e21f206ab6a8784469905f1da29596e35 |
| +@coverage internal/host 207c76a96e63f14af1f170282d6f3b488b5fd6490c22ee027d00c0feb0eed1c0 |
| +@coverage internal/status b133ac8995f6ef0123394e2d0611304aa37f11409b1e14ae67a43e1ed3bf2469 |
diff --git a/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv b/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv| index 468c9f688..be803b8c5 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv |
| @@ -6,7 +6,7 @@ |
| @legacy 4ef72ca2ef3fd96a836ca96e6e8ed2a3cd8c730d65010fcf2d46cf7f810ac42a infra/modules/region-host/variables.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's variables with console_mail_from (validated as one lowercase address) and console_mail_region, both empty by default; no read is added and nothing on a box reads the file;rev3=census-ruling-hunt-account-root-hardening;basis=adds deny_release_key_reads (bool, default true); no read is added and nothing on a box reads the file;rev3=census-ruling-region-ha-p3b;basis=Add default-fixed mode and validated group count, zones, pinned image/release/template, ingress, configuration key and transaction-open refusal. Operator-supplied Terraform values select root boot inputs; no direct box runtime read and no group activation by default.;rev3=census-ruling-region-ha-g2-fixes;basis=Add an empty-default set of additional alert topic ARNs, validating concrete SNS topic syntax and excluding wildcards/subscriptions; operator Terraform input, no box runtime read.;rev3=census-ruling-region-ha-g3-fixes;basis=Add optional alerts_topic_arn with concrete same-region SNS ARN validation and mutual exclusion with alerts_email. The caller owns the existing topic policy and subscriptions; no runtime sink is configured and no new root read is added.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: five variables, managed_fleets_enabled (bool, default false, refused unless mode is fixed), managed_fleets_deployment, managed_fleets_regions (concrete ami/subnet/sg IDs, arm64 types, no ID in two regions), managed_fleet_bucket_prefix (1-24 chars, no reserved prefix, must not cover the deployment, data or staging buckets, disjoint from store_bucket_prefix) and managed_fleet_user_path (literal IAM path, disjoint from store_user_path); store_bucket_prefix and store_user_path gain a validation refusing *, ? or ${ only when managed fleets and object storage are both on; operator Terraform input only; no box runtime read and nothing on a box reads the file;rev3=census-ruling-fixedbox-health-alarms;basis=Add optional health_alerts_topic_arn (concrete same-region SNS ARN validation, empty default); enable_auto_recovery description covers both status alarms. Operator Terraform input; no box runtime read.;rev3=census-ruling-w6-ingress-drain;basis=new variable ingress_target_group_arns (list(string), default [], non-nullable) validated as distinct ELB target group ARNs (arn:aws(-x)*:elasticloadbalancing:<region>:<12 digits>:targetgroup/<name>/<16 hex>); drives the IAM policy and output above. No read added.;rev3=census-ruling-stats-prune-400;basis=new variable enable_analytics_version_prune (bool, default false) driving the policy above; operator Terraform input; no box runtime read;rev3=census-ruling-platform-mail-submission;basis=Task 8: variable "mailer", an object {ses_region, ses_account_id, deployment_bucket_region, optional deployment_bucket_kms_key_arn} defaulting to null, which creates nothing; validated (AWS region shapes, 12-digit account, KMS ARN or empty). file:external@0 4e3076d5835fcd03f51edcd5f6847371c2f2059598b4bf7841cba2aead5b3754 |
| @legacy 2d0d5c7d06f3d3299a7b17609928866ebb192d07468a1876e0ad9df56571ace8 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. registry:Host@5822 a1cd273f24047c63670f8c32c000a84f1a3861d058da38c5318551929f312390 |
| @legacy 562d26b51dcbce93d68fabfe933e074c2b2933fcded74156fd88f559407862da internal/host/agent.go provisionTickConfig legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-ha-p1a-433;basis=the agent (carlos-edge.service, user carlos) and the edges file loop's eligibility: the same CARLOS_POOLS read, now parsed by provision.ParseBoxPools (internal/provision, envelope re-pinned), the one parser boxPools also uses. "@shared" (provision.SharedPoolToken, never a valid pool name) is the shared "" pool; other tokens are literal as before; empty elements and repeats dropped. No read added.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 4, rule 2): sets ReconcileConfig.FleetBox to the box's own fleet label from resolveFleetIdentity(getenv), only when the identity resolves and region == PlacementTarget(identity.Fleet); otherwise it stays "" (the box admits only unlabelled records). The same environment the fleet loops already read; read sites unchanged (2). Agent config, not root.;rev3=census-ruling-platform-mail-submission;basis=Task 5: its region, pools and fleet label now come from BoxScopeFromEnv, which is the same three reads moved out unchanged (CARLOS_REGION trimmed, provision.ParseBoxPools(CARLOS_POOLS), and resolveFleetIdentity's label only when its fleet is the one the region places the box on), so the box-local mailer resolves "on this box" by the agent's rule. The ReconcileConfig it returns is field for field what it was. Agent, not root. data-literal@173,data-literal@214 cabe3cb9662118eb82ddbc77dbbdb80b6718494caea097c8ffb894ccc4903fe3 |
| -@legacy 589908d713736c8e6a9e3ff35f04288a44aa15643b899bdd3ec8e0b97d43d808 internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). whole:Route@10554,whole:Route@12628,whole:Route@12909,whole:Route@6583,whole:Route@6610,whole:Route@7918 4dd7407a53e445f78e63f160bee068d835b26d5d8fd3300d389ba5dbcab26d5a |
| +@legacy cbc74621890e2fc074cde212107d0aa7ec6348b364881fc201d5352ebdd30524 internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added.;rev3=census-ruling-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). whole:Route@10554,whole:Route@12628,whole:Route@12909,whole:Route@13267,whole:Route@6583,whole:Route@6610,whole:Route@7918 352bd5962a711a29f0f0f2f0d5e4d0a9a58f41ebf049e4f37ff41c31a4ea4eae |
| @legacy 722920e1d095fe935962342d131ef5e8d5c97481b52b7ddc38dc214bf84ee9a5 internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-gvisor-demos;basis=Create the rootfs parent at 0700 and runtime root at 0755. Existing host.env/unit reads unchanged; workload templates remain unarmed.;rev3=census-ruling-platform-mail-submission;basis=Task 3: the sysusers.d/carlos.conf it writes is now the constant sysusersConf, which adds "u carlos-mailer - \"CARLOS mailer\" - /usr/sbin/nologin" ahead of the existing "g carlos-sockets -" line, so the tmpfiles line naming group carlos-mailer resolves on a box whose confs arrive by a staged-tree refresh. Constant text, no input; no read added. file:Command@12045,file:ReadFile@564,file:ReadFile@7111 62fa76ad0fa812a0effc7c6add43ddcf54313450c13f20fbb2fee9d004488588 |
| @legacy aea72efedb3cc995ae9c791962e3e80f7dfe0b54d87da8c3ca13616baf7a433b internal/host/bootstrap.go privilegedPlan legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-platform-mail-submission;basis=Task 3: one more constant argv, useradd --system --user-group --no-create-home --shell /usr/sbin/nologin carlos-mailer, right after carlos's, behind runPrivileged's existing guard (user.Lookup of the argv's own last word). No input; no read added. data-literal@382 4f353dc38a329ff88fdec4bc2611c44b7ac483eee308b73f58100abc539707cc |
| @legacy 72a9a01566413d03e47904622675de11f9728a7412ccd1c66164f6b269500437 internal/host/demo_units/demo.conf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-1;basis=Retains read-only /run and /var tmpfs overlays and all network/size restrictions. Resets InaccessiblePaths and restates /etc/carlos -/run/carlos-control so the hidden control directory need not exist during namespace setup; /etc/carlos remains required. No new source or bind.;rev3=census-ruling-platform-mail-submission;basis=Task 3: the restated InaccessiblePaths= line after the reset gains -/run/carlos-mailer -/etc/carlos-mailer, so a demo box's drop-in does not drop the mailer entries carlos-instance@ and carlos-instance-gen@ now carry. Optional entries; only hides more; no source or bind added. file:external@0 a9e9b766b8dc528c67e128622901f5e491c8abf247681c4e0a4479fbea5d25b9 |
| @@ -19,7 +19,7 @@ |
| @legacy d3ddb6b0fb0df8d25decbef65730cff27308294850683e817a3e5333947870c8 internal/host/units/carlos-instance-sidecar@.service external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5: the same one namespace-block line, TemporaryFileSystem=/dev/pts:ro, as carlos-instance@.service; nothing else;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-instance-stop-execstop-528;basis=one line added after ExecStart=, ExecStop=-+/opt/carlos/carlos instance-stop $MAINPID (#528, Paul's option 2), plus TimeoutStopFailureMode=kill after TimeoutStopSec=20: PID 1 runs the platform binary's instance-stop as root (the + prefix) at a stop with $MAINPID, a value systemd supplies; instance-stop reads only that argument, /proc/self/cgroup and /proc/<MAINPID>/cgroup (kernel-written), and acts only through a pidfd on the unit's own main process (refused unless in the unit's own cgroup); no bind source, user, mount or tenant-writable path read added;rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: InaccessiblePaths= gains -/run/carlos-mailer -/etc/carlos-mailer (optional). Only hides more; no read added. file:external@0 a3c88ea82548f46bbd8516fc4a9060bb5934273b60eb572647784a7ccfab528c |
| @legacy 0a4d139cf9839189f90e09f4c57e29ddacc5eb320287a237770a080167db91df internal/host/units/carlos-instance-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the binary tty template, carlos-instance-cmd@.service outside six named lines held by TestTTYTemplateEqualsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit tty %I (the same root binary as every template), StandardInput=file:/run/carlos/logs/%I.tty.sock replacing the cmd StandardOutput socket (PID 1 opens it as root on the nosymfollow logs mount, as the cmd streams), StandardOutput=journal, StandardError=journal, and BindReadOnlyPaths sources tty-app/tty-live under /run/carlos-control/exe/%I (root-only exe layout, as cmd-app/cmd-live). Same namespace block byte for byte, runs as carlos. Task 6: POST /tty (handleOneShot(RoleTTY), claimAwareLegacy) starts it, after the role lock, the loaded-state refusal and refuseStagedExe; the tty-app/tty-live sources are laid out by ensureCmdExeAt(RoleTTY) and removed by removeCmdExe(RoleTTY) at /stop role=tty and /sweep;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: InaccessiblePaths= gains -/run/carlos-mailer -/etc/carlos-mailer (optional). Only hides more; no read added. file:external@0 a316b14b25091ff3ed3dc2186378cc0b88bc23471d6ad45ede8302f278668034 |
| @legacy 1d51de12094b335de855b3620973b88ae3938185b243b820641dbd5adf48a875 internal/host/units/carlos-instance@.service external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5: one namespace-block line added after TemporaryFileSystem=/dev/mqueue:ro, TemporaryFileSystem=/dev/pts:ro (with its comment): PID 1 mounts an empty read-only tmpfs over the private /dev/pts, hiding the host devpts PrivateDevices= binds in; no bind source, Exec line, user or path read by root added; the block stays byte-identical across the binary templates (TestInstanceTemplatesShareOneNamespace);rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-instance-stop-execstop-528;basis=one line added after ExecStart=, ExecStop=-+/opt/carlos/carlos instance-stop $MAINPID (#528, Paul's option 2), plus TimeoutStopFailureMode=kill after TimeoutStopSec=20: PID 1 runs the platform binary's instance-stop as root (the + prefix) at a stop with $MAINPID, a value systemd supplies; instance-stop reads only that argument, /proc/self/cgroup and /proc/<MAINPID>/cgroup (kernel-written), and acts only through a pidfd on the unit's own main process (refused unless in the unit's own cgroup); no bind source, user, mount or tenant-writable path read added;rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: InaccessiblePaths= gains -/run/carlos-mailer -/etc/carlos-mailer (optional). Only hides more; no read added. file:external@0 348dd223f7f1bcd8cb2db90c7acb25f4cf3e9b29568c0b4b63ce13d6d1ab3af9 |
| -@legacy 5a4d8a4a9ea0e00aa0186c84c18f49f5ae434c340651f4bbe636d3311cf39dfd internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: copies Probes.MailerArmed into BoxMetrics.MailerArmed (json mailer_armed, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 b2a6b68d0c028970efee40812263bf1e4a6214b90c568d8275deb81b61ff1e66 |
| +@legacy cb2f127165d056df377c627a652c3db218ac3fd6b9c12c6c8282e5bb32998455 internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: copies Probes.MailerArmed into BoxMetrics.MailerArmed (json mailer_armed, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 37ddeb689c59f9454c962fa800e2ac14e225d909b837a0e74f0e09bbff2ff12f |
| @legacy 683a26c2185a385d210ce4b376f13740422e0e405a09e402953a0457ca608508 infra/modules/region-host/mailer.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 8, new: with var.mailer set (default null: nothing), aws_iam_user.mailer carlos-mailer-<region> at path /carlos-mailer/ (precondition: ses_account_id is the module's own account) and aws_iam_user_policy.mailer with ses:SendRawEmail on identity/*, configuration-set/carlos-* and tenant/carlos-*/* in ses_region (the tenant per Task 8 review P2-1, as the console's own policy grants its tenant), and s3:GetObject on apps/*/*/email/senders/*, apps/*/*/instances/* and accounts/*/email/domains/* (plus kms:Decrypt via S3 only when a bucket KMS key is given). No s3:ListBucket, no write, no IAM action, no access key resource (the key never enters state). The host role gains nothing. In group mode two String region parameters, CARLOS_MAIL_REGION and CARLOS_DEPLOYMENT_REGION, under the region's existing /carlos/<deployment>/<region>/ path, which host-env write --group already reads and validates against hostenv's allowlist. References no sibling script; nothing a box's root runs or reads beyond those two plain values. file:external@0 a48c782bf4f63f5121c6ccae7d19793f0af4c9f9856127319f6bb9014357890f |
| @legacy 1dfce6c598f867f9f8e3251758ab91e9a1d16656d9831806b5fab5b8c5421952 infra/modules/region-host/tests/mailer.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 8, new: plan-only runs under mock_provider: off by default; the user's name and path; the policy's two statements exactly; no ListBucket, Put, delete, SendEmail, IAM or wildcard action; KMS adds decrypt through S3 only; another account refused; a bad region refused; the host role gains no SES. Test-only. file:external@0 d8f1e5acb446a2e33848958b3ea036ab81c1f17565ab8df5409883b0afb39164 |
| @legacy e22f1e9844d61fe949ab40748b17135bde43efa378e310b484c471ffbce7eed9 infra/modules/region-host/tests/mailer_group.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 8, new: plan-only runs under mock_provider with group.tftest.hcl's fixtures (plus an AMI override): the two region parameters' names and values with mailer set, none without. Test-only. file:external@0 c36b70fc72d0b317db438c66a7e669a49a92ddce904ae8307f3503031c53f73f |
| @@ -47,7 +47,7 @@ infra/modules/region-host/outputs.tf external legacy accepted-legacy accepted-le |
| infra/modules/region-host/variables.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-console-invite-delivery;basis=tofu on an operator's machine with the operator's AWS credentials (no box unit; no binary embeds the file): main's variables with console_mail_from (validated as one lowercase address) and console_mail_region, both empty by default; no read is added and nothing on a box reads the file;rev3=census-ruling-hunt-account-root-hardening;basis=adds deny_release_key_reads (bool, default true); no read is added and nothing on a box reads the file;rev3=census-ruling-region-ha-p3b;basis=Add default-fixed mode and validated group count, zones, pinned image/release/template, ingress, configuration key and transaction-open refusal. Operator-supplied Terraform values select root boot inputs; no direct box runtime read and no group activation by default.;rev3=census-ruling-region-ha-g2-fixes;basis=Add an empty-default set of additional alert topic ARNs, validating concrete SNS topic syntax and excluding wildcards/subscriptions; operator Terraform input, no box runtime read.;rev3=census-ruling-region-ha-g3-fixes;basis=Add optional alerts_topic_arn with concrete same-region SNS ARN validation and mutual exclusion with alerts_email. The caller owns the existing topic policy and subscriptions; no runtime sink is configured and no new root read is added.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: five variables, managed_fleets_enabled (bool, default false, refused unless mode is fixed), managed_fleets_deployment, managed_fleets_regions (concrete ami/subnet/sg IDs, arm64 types, no ID in two regions), managed_fleet_bucket_prefix (1-24 chars, no reserved prefix, must not cover the deployment, data or staging buckets, disjoint from store_bucket_prefix) and managed_fleet_user_path (literal IAM path, disjoint from store_user_path); store_bucket_prefix and store_user_path gain a validation refusing *, ? or ${ only when managed fleets and object storage are both on; operator Terraform input only; no box runtime read and nothing on a box reads the file;rev3=census-ruling-fixedbox-health-alarms;basis=Add optional health_alerts_topic_arn (concrete same-region SNS ARN validation, empty default); enable_auto_recovery description covers both status alarms. Operator Terraform input; no box runtime read.;rev3=census-ruling-w6-ingress-drain;basis=new variable ingress_target_group_arns (list(string), default [], non-nullable) validated as distinct ELB target group ARNs (arn:aws(-x)*:elasticloadbalancing:<region>:<12 digits>:targetgroup/<name>/<16 hex>); drives the IAM policy and output above. No read added.;rev3=census-ruling-stats-prune-400;basis=new variable enable_analytics_version_prune (bool, default false) driving the policy above; operator Terraform input; no box runtime read;rev3=census-ruling-platform-mail-submission;basis=Task 8: variable "mailer", an object {ses_region, ses_account_id, deployment_bucket_region, optional deployment_bucket_kms_key_arn} defaulting to null, which creates nothing; validated (AWS region shapes, 12-digit account, KMS ARN or empty). file:external@0 4e3076d5835fcd03f51edcd5f6847371c2f2059598b4bf7841cba2aead5b3754 |
| 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. registry:Host@5822 a1cd273f24047c63670f8c32c000a84f1a3861d058da38c5318551929f312390 |
| internal/host/agent.go provisionTickConfig legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-ha-p1a-433;basis=the agent (carlos-edge.service, user carlos) and the edges file loop's eligibility: the same CARLOS_POOLS read, now parsed by provision.ParseBoxPools (internal/provision, envelope re-pinned), the one parser boxPools also uses. "@shared" (provision.SharedPoolToken, never a valid pool name) is the shared "" pool; other tokens are literal as before; empty elements and repeats dropped. No read added.;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 4, rule 2): sets ReconcileConfig.FleetBox to the box's own fleet label from resolveFleetIdentity(getenv), only when the identity resolves and region == PlacementTarget(identity.Fleet); otherwise it stays "" (the box admits only unlabelled records). The same environment the fleet loops already read; read sites unchanged (2). Agent config, not root.;rev3=census-ruling-platform-mail-submission;basis=Task 5: its region, pools and fleet label now come from BoxScopeFromEnv, which is the same three reads moved out unchanged (CARLOS_REGION trimmed, provision.ParseBoxPools(CARLOS_POOLS), and resolveFleetIdentity's label only when its fleet is the one the region places the box on), so the box-local mailer resolves "on this box" by the agent's rule. The ReconcileConfig it returns is field for field what it was. Agent, not root. data-literal@173,data-literal@214 cabe3cb9662118eb82ddbc77dbbdb80b6718494caea097c8ffb894ccc4903fe3 |
| -internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). whole:Route@10554,whole:Route@12628,whole:Route@12909,whole:Route@6583,whole:Route@6610,whole:Route@7918 4dd7407a53e445f78e63f160bee068d835b26d5d8fd3300d389ba5dbcab26d5a |
| +internal/host/agent.go statusLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's context carries the box's lifetime judge; read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 953b9fda (its later changes, regional box names and self-serve moves plan 1 among them, under main's own census rulings), where the tick fills rootfs_ready and rootfs_blocked from armedRootfs.Load().probe, which each tick runs NestedOK's checks and asks the control socket's GET /ready/rootfs (never the store); the same four direct sites;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: takes root's GET /egress reader and fills p.Egress = egressStatusProbe(egressStatus, routes, provision.PolicyReadStates()) and p.SizeCommittedMiB = sizeCommittedMiB(armedSizeSource.Load(), routes); the two added whole:Route sites are the tick's own registry list handed to those two units (decision rows), which read root's control socket and the activator's memory; no store request added; the four existing sites unchanged, offsets moved.;rev3=census-ruling-fleet-alerts-1;basis=the agent (carlos-edge.service, user carlos): the status tick passes os.Geteuid() to alertDeliveryProbe, which fills AlertDelivery.EngineBeat/EngineBeatWhy from engineBeatArmed (the env value and the euid only, no file access, root refused before the path is looked at), and fills Probes.DiskFullETAHours from diskETAProbe(&processDiskTrend, now), a Theil-Sen fit over the metrics loop's in-memory ring of disk readings; the same six sites, no read added, no store request added;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): the status tick's Probes gain HeldStreams: heldStreamsState(), which calls the edge's in-memory counters function (nil until the edge is ready). No file, bucket or registry access added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: read the detached in-memory replica snapshot source into Probes.ReplicaCopies on the existing five-minute tick. Existing six direct read sites unchanged. No additional bucket request, changed cadence or app lifecycle action.;rev3=census-ruling-agent-start-demo-3;basis=Report moved capability only when the serving edge reports readiness; report claim-seed support only with CARLOS_DEMO_CLAIM=1. Reads the explicit capability flag from the process environment; no new filesystem or registry read.;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 fix round 1 (#511 R16 amendment): the status tick also fills Probes.ApplyFinished from systemApplyFinished(release.OptDir()), an Lstat of root's apply journal <opt>/system/router/journal.json in the root-owned, world-readable state directory: finished only when the journal is absent, any other answer unknown and so unfinished. Round 0: Probes.PrevRelease from prevReleaseOf (carlos.prev and carlos.prev.version, the files withMovesFields already reads). Reported in the private BoxMetrics block; no bucket request or cadence change.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: the agent (carlos-edge.service, user carlos): the status tick fills p.OfflineMove = offlineMoveFactsProbe(routes); the added whole:Route site is the tick's own registry list handed to that unit, which under a non-root euid lists the names of root's <opt>/live and nothing else; no store request added.;rev3=census-ruling-platform-mail-submission;basis=Task 3 (plan gap G6 (b)): the status tick also fills Probes.MailerArmed from mailerArmed(mailwire.MailerSocket, 2s): a stat of /run/carlos-mailer/mailer.sock and, only when it is a socket, GET /v1/health on it. The agent (carlos-edge.service, user carlos), not root; reported in the private BoxMetrics block only. The same six sites; no store request, no read of /etc/carlos-mailer (which uid carlos cannot traverse). whole:Route@10554,whole:Route@12628,whole:Route@12909,whole:Route@13267,whole:Route@6583,whole:Route@6610,whole:Route@7918 352bd5962a711a29f0f0f2f0d5e4d0a9a58f41ebf049e4f37ff41c31a4ea4eae |
| internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-gvisor-demos;basis=Create the rootfs parent at 0700 and runtime root at 0755. Existing host.env/unit reads unchanged; workload templates remain unarmed.;rev3=census-ruling-platform-mail-submission;basis=Task 3: the sysusers.d/carlos.conf it writes is now the constant sysusersConf, which adds "u carlos-mailer - \"CARLOS mailer\" - /usr/sbin/nologin" ahead of the existing "g carlos-sockets -" line, so the tmpfiles line naming group carlos-mailer resolves on a box whose confs arrive by a staged-tree refresh. Constant text, no input; no read added. file:Command@12045,file:ReadFile@564,file:ReadFile@7111 62fa76ad0fa812a0effc7c6add43ddcf54313450c13f20fbb2fee9d004488588 |
| internal/host/bootstrap.go const tmpfilesConf authority A,C,G,J4 root-input;kept=A,C,G;scope=protected-decision-only;rev3=census-ruling-platform-mail-submission;basis=Task 3: two constant lines, "d /run/carlos-mailer 0750 root carlos -" (the mailer's socket directory, beside /run/carlos-control and shaped like it) and "d /etc/carlos-mailer 0750 root carlos-mailer -" (the key directory, which uid carlos cannot traverse). Root creates two root-owned directories; no file inside either is created, owned or seeded (the key is the operator's, by hand). No input; no read added. data-literal@1237,data-literal@1309,data-literal@1927,data-literal@21,data-literal@2328,data-literal@311,data-literal@810 d9849c0d887ce4c8698d67dfc9cf136f5b9922300b058fda6186d2fd4b42411a |
| internal/host/bootstrap.go privilegedPlan legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-platform-mail-submission;basis=Task 3: one more constant argv, useradd --system --user-group --no-create-home --shell /usr/sbin/nologin carlos-mailer, right after carlos's, behind runPrivileged's existing guard (user.Lookup of the argv's own last word). No input; no read added. data-literal@382 4f353dc38a329ff88fdec4bc2611c44b7ac483eee308b73f58100abc539707cc |
| @@ -62,7 +62,7 @@ internal/host/units/carlos-instance-seed@.service external legacy accepted-legac |
| internal/host/units/carlos-instance-sidecar@.service external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5: the same one namespace-block line, TemporaryFileSystem=/dev/pts:ro, as carlos-instance@.service; nothing else;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-instance-stop-execstop-528;basis=one line added after ExecStart=, ExecStop=-+/opt/carlos/carlos instance-stop $MAINPID (#528, Paul's option 2), plus TimeoutStopFailureMode=kill after TimeoutStopSec=20: PID 1 runs the platform binary's instance-stop as root (the + prefix) at a stop with $MAINPID, a value systemd supplies; instance-stop reads only that argument, /proc/self/cgroup and /proc/<MAINPID>/cgroup (kernel-written), and acts only through a pidfd on the unit's own main process (refused unless in the unit's own cgroup); no bind source, user, mount or tenant-writable path read added;rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: InaccessiblePaths= gains -/run/carlos-mailer -/etc/carlos-mailer (optional). Only hides more; no read added. file:external@0 a3c88ea82548f46bbd8516fc4a9060bb5934273b60eb572647784a7ccfab528c |
| internal/host/units/carlos-instance-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the binary tty template, carlos-instance-cmd@.service outside six named lines held by TestTTYTemplateEqualsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit tty %I (the same root binary as every template), StandardInput=file:/run/carlos/logs/%I.tty.sock replacing the cmd StandardOutput socket (PID 1 opens it as root on the nosymfollow logs mount, as the cmd streams), StandardOutput=journal, StandardError=journal, and BindReadOnlyPaths sources tty-app/tty-live under /run/carlos-control/exe/%I (root-only exe layout, as cmd-app/cmd-live). Same namespace block byte for byte, runs as carlos. Task 6: POST /tty (handleOneShot(RoleTTY), claimAwareLegacy) starts it, after the role lock, the loaded-state refusal and refuseStagedExe; the tty-app/tty-live sources are laid out by ensureCmdExeAt(RoleTTY) and removed by removeCmdExe(RoleTTY) at /stop role=tty and /sweep;rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: InaccessiblePaths= gains -/run/carlos-mailer -/etc/carlos-mailer (optional). Only hides more; no read added. file:external@0 a316b14b25091ff3ed3dc2186378cc0b88bc23471d6ad45ede8302f278668034 |
| internal/host/units/carlos-instance@.service external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5: one namespace-block line added after TemporaryFileSystem=/dev/mqueue:ro, TemporaryFileSystem=/dev/pts:ro (with its comment): PID 1 mounts an empty read-only tmpfs over the private /dev/pts, hiding the host devpts PrivateDevices= binds in; no bind source, Exec line, user or path read by root added; the block stays byte-identical across the binary templates (TestInstanceTemplatesShareOneNamespace);rev3=census-ruling-instance-syscall-filter;basis=the tenant syscall filter (#527 Q5): three [Service] lines after SystemCallArchitectures=native (SystemCallFilter=@system-service; SystemCallFilter=~@keyring io_uring_setup io_uring_enter io_uring_register userfaultfd; SystemCallErrorNumber=ENOSYS), applied by PID 1 as a seccomp filter on the unit's own process as carlos; no bind source, Exec line, user, mount or path read by root added, with its comment, inside the shared namespace block (byte-identical across the binary templates);rev3=census-ruling-instance-stop-execstop-528;basis=one line added after ExecStart=, ExecStop=-+/opt/carlos/carlos instance-stop $MAINPID (#528, Paul's option 2), plus TimeoutStopFailureMode=kill after TimeoutStopSec=20: PID 1 runs the platform binary's instance-stop as root (the + prefix) at a stop with $MAINPID, a value systemd supplies; instance-stop reads only that argument, /proc/self/cgroup and /proc/<MAINPID>/cgroup (kernel-written), and acts only through a pidfd on the unit's own main process (refused unless in the unit's own cgroup); no bind source, user, mount or tenant-writable path read added;rev3=census-ruling-w6-ingress-drain;basis=adds Before=carlos-edge-drain.service (with a comment). Ordering only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: InaccessiblePaths= gains -/run/carlos-mailer -/etc/carlos-mailer (optional). Only hides more; no read added. file:external@0 348dd223f7f1bcd8cb2db90c7acb25f4cf3e9b29568c0b4b63ce13d6d1ab3af9 |
| -internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: copies Probes.MailerArmed into BoxMetrics.MailerArmed (json mailer_armed, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 b2a6b68d0c028970efee40812263bf1e4a6214b90c568d8275deb81b61ff1e66 |
| +internal/status/snapshot.go CollectBox legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;basis=copies Probes.RootfsReady and RootfsBlocked into BoxMetrics (private, like Layout); the same 28 sites, no read added;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Task 11 and #329 plan 3 Task 7: copies Probes.Egress and Probes.SizeCommittedMiB into BoxMetrics (private, like Layout) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate count is left as is (display);rev3=census-ruling-regional-domains-447;basis=#447 Task 7: copies Probes.AliasesRead into BoxMetrics.AliasesRead (json aliases_read, omitempty) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-fleet-alerts-1;basis=copies Probes.DiskFullETAHours into BoxMetrics.DiskFullETAHours (json disk_full_eta_hours, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added;rev3=census-ruling-edge-held-streams;basis=copies Probes.HeldStreams into BoxMetrics.HeldStreams (json held_streams, omitempty, additive) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-stateless-replicas-3;basis=Fix round 1 Q20: carry already-supplied ReplicaCopies into a separate optional private BoxMetrics replica_copies field; allow copy evidence alone to create the metrics block. Upstreams retains address probes only. Existing 28 Route read sites unchanged; no filesystem, bucket, console or CLI read.;rev3=census-ruling-agent-start-demo-3;basis=Report claim-seed protocol capability only when explicitly configured and runtime moved readiness only when armed; dormant status keeps its original JSON shape. Census read-site delta: unchanged (28).;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 (#511 R16 and its amendment): copies Probes.PrevRelease and Probes.ApplyFinished into BoxMetrics (json prev_release and apply_finished, omitempty; private, like Release) and counts them in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-offline-move-stage-refusals-339;basis=#339: copies Probes.OfflineMove into BoxMetrics.OfflineMove (json offline_move, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 3: copies Probes.MailerArmed into BoxMetrics.MailerArmed (json mailer_armed, omitempty; private, like Layout) and counts it in the condition that builds Metrics; the same 28 sites, no read added. registry:Alias@4543,registry:CertExpiresAt@3160,registry:CertExpiresAt@3396,registry:CertExpiresAt@4658,registry:DBPath@2495,registry:DBPath@2553,registry:DNSCheckedAt@3365,registry:DNSCheckedAt@4627,registry:DNSStatus@3139,registry:DNSStatus@3334,registry:DNSStatus@4597,registry:Hibernate@3853,registry:Host@2295,registry:Host@2437,registry:Host@2666,registry:Host@3280,registry:Host@3315,registry:Host@4578,registry:Kind@2473,registry:Kind@3807,registry:Platform@2152,registry:ServingVersion@2324,registry:ServingVersion@2447,registry:Socket@4066,registry:Version@2186,registry:Version@2305,whole:Route@1581,whole:RouteAlias@4440 37ddeb689c59f9454c962fa800e2ac14e225d909b837a0e74f0e09bbff2ff12f |
| infra/modules/region-host/mailer.tf external legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 8, new: with var.mailer set (default null: nothing), aws_iam_user.mailer carlos-mailer-<region> at path /carlos-mailer/ (precondition: ses_account_id is the module's own account) and aws_iam_user_policy.mailer with ses:SendRawEmail on identity/*, configuration-set/carlos-* and tenant/carlos-*/* in ses_region (the tenant per Task 8 review P2-1, as the console's own policy grants its tenant), and s3:GetObject on apps/*/*/email/senders/*, apps/*/*/instances/* and accounts/*/email/domains/* (plus kms:Decrypt via S3 only when a bucket KMS key is given). No s3:ListBucket, no write, no IAM action, no access key resource (the key never enters state). The host role gains nothing. In group mode two String region parameters, CARLOS_MAIL_REGION and CARLOS_DEPLOYMENT_REGION, under the region's existing /carlos/<deployment>/<region>/ path, which host-env write --group already reads and validates against hostenv's allowlist. References no sibling script; nothing a box's root runs or reads beyond those two plain values. file:external@0 a48c782bf4f63f5121c6ccae7d19793f0af4c9f9856127319f6bb9014357890f |
| infra/modules/region-host/tests/mailer.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 8, new: plan-only runs under mock_provider: off by default; the user's name and path; the policy's two statements exactly; no ListBucket, Put, delete, SendEmail, IAM or wildcard action; KMS adds decrypt through S3 only; another account refused; a bad region refused; the host role gains no SES. Test-only. file:external@0 d8f1e5acb446a2e33848958b3ea036ab81c1f17565ab8df5409883b0afb39164 |
| infra/modules/region-host/tests/mailer_group.tftest.hcl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 8, new: plan-only runs under mock_provider with group.tftest.hcl's fixtures (plus an AMI override): the two region parameters' names and values with mailer set, none without. Test-only. file:external@0 c36b70fc72d0b317db438c66a7e669a49a92ddce904ae8307f3503031c53f73f |
| @@ -86,11 +86,11 @@ internal/activator/backend_exec.go ExecBackend.spawnUnitFrom legacy accepted-leg |
| internal/activator/prepare.go ExecBackend.listenControl legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-edge-page-cache-1;basis=passes the whole route to edge.ListenControl instead of rt.Host (the -registry:Host +whole:Route change); nothing else;rev3=census-ruling-platform-mail-submission;basis=Task 4: the same replacement as spawnChildFrom, with gen as the write fence's generation, so the nested and rootfs listener mounts exactly what the flat one does. Agent, not root. registry:Host@508,whole:Route@361,whole:Route@389 f6534861cdbeef80dbcfaf6b07df685e4ac2f2a86650db54f174871526a50aff |
| internal/activator/rootfs.go ExecBackend.spawnRootfs legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-route (J1, as spawnUnitFrom, whose shape it has): new (rootfs Plan 2 Tasks 5 and 9): prepareKeyedAt (the instance's own directories, environment and listeners, unchanged), the schema-2 tenant launch file (environment only, CARLOS_SOCKET and CARLOS_DB set by the agent), the caller's exec gate, then StartRootfs over the control socket naming the image and web; root resolves the command from its own staged manifest (C4) and the tenant file may name no command (the trampoline refuses one); the failure handling is spawnUnitFrom's; its sites are the row's host and route; no root decision; final fix I1: root's answers that guarantee no start (ErrStartRefused: 503 not ready or claim-armed, 501 unconfigured, 400, 409, 507), like its 403, are marked a refusal (refuseRootfs), so verdictOf and classifyStep record no failure of the build and no stop is asked; a 502 and a transport failure still may have run; the same nineteen sites, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 fix wave 1 (d35fcb1f, census P1-1): takes the tier root is asked for as an argument; a zero tier means GenTier's (the former body), so a caller that chose a limit has it kept, as spawnChildFrom and spawnUnitFrom keep theirs; the same nineteen sites, no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=sets up.inputs = launchInputs(id.Version, fileEnv): the image version and env this spawn already read, hashed in memory; no new read; read sites unchanged (20); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main launchInputs on rootfs handle from existing staged image version and fileEnv. Keep branch sandbox gate and root identity validation. No new read.;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: one log line before killFailedRootfsGen naming the host, the unit and the error already in hand; the +registry:Host site is that argument to log.Printf; no new read source, behaviour unchanged;rev3=census-ruling-platform-mail-submission;basis=Task 6: the same warnUndeclaredMailBuild call for a rootfs spawn. Agent, not root. registry:Host@1358,registry:Host@1531,registry:Host@1831,registry:Host@1950,registry:Host@2697,registry:Host@3034,registry:Host@3261,registry:Host@3388,registry:Host@3713,registry:Host@3841,registry:Host@390,registry:Host@3950,registry:Host@4667,registry:Host@4761,whole:Route@1105,whole:Route@1137,whole:Route@1224,whole:Route@199,whole:Route@2057,whole:Route@3094,whole:Route@4026,whole:Route@502,whole:Route@602,whole:Route@732 a19e5be10a746fec3fedc5715314f6cf00fa6f3d4be23db3242bf2f599a1a563 |
| 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. file:Exec@21578,file:Open@2191,file:Statfs@57102,registry:App@13287,registry:App@13665,whole:Route@13279,whole:Route@13657,whole:Route@50580 ee6470495a59bc35232da4558dc1082c7c068dbee1893cf3c2da365557b9360b |
| -@coverage . 92eeac6b896196505876a5a4c5dea470134c43cc45996e9343b32481b3ec4baa |
| +@coverage . 3780784fd3cc19b54f0a8ef1db0b1a65f0a44da05bc895ceb85789ee16e755aa |
| @coverage infra/modules/region-host d1a978ca67367880d0940ae7aa460f311addd4335c196a279d86caa6fe1e1721 |
| @coverage infra/modules/region-host/tests 1aa5c549b79e7d8b19a266a2aeae8e4e2bb22b40072f36362da95bcf2c439a07 |
| @coverage internal/activator 457bc68060d4b9293294bd27cce112ca64946b1b45779e4afe61616a0f8a0d4f |
| -@coverage internal/host eeccc339940f00c1544d98a6e1d6346b190182f1897451c9761209d8356bce19 |
| +@coverage internal/host 2635ff930ef387fefe663ccd44c2b550f9f8d2e9669a45186e13d97fef177411 |
| @coverage internal/host/demo_units 3a34238356068c6176879f3ee189c81af8e08bfcc0246c5feba80d7169f7af6a |
| @coverage internal/host/units 63a333f0bb4a354fdde9802089f4ec6794cdfbf774c20fbd48cffab805cd022c |
| @coverage internal/hostenv 6c96c4abe8548fe3cf12d3a220de3e2917c3edfa5320b1662ea76bdf364d24b5 |
| @@ -101,4 +101,4 @@ internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve- |
| @coverage internal/moves 9390702695d308a327f5572f4ff5967718141c5d385dff7671ff1e2c825ef407 |
| @coverage internal/provision a7fca446b2464e9d0804272a46146013085cdec8fecb96a3508cc055295f31d3 |
| @coverage internal/release 26028ee5f49462e120b401530ce539a81c76c632bfa6065f6881b80680a3e9cb |
| -@coverage internal/status 28fae993456954e4e8743fbc7be7c3528b836865de21fb9f401a97cf8eb8b4e2 |
| +@coverage internal/status 44d0b0191cd8b9cd8f3b56ff27f4e856e356c544b3a5dbd2d86c5eaf0ac05664 |
diff --git a/internal/status/contract_test.go b/internal/status/contract_test.go| index 8c672eab7..cee5ea4f5 100644 |
| --- a/internal/status/contract_test.go |
| +++ b/internal/status/contract_test.go |
| @@ -83,7 +83,7 @@ var allowedBoxKeys = map[string][]string{ |
| "routes": {"static", "resident", "hibernating", "awake", "asleep"}, |
| "replication": {"healthy", "lag_seconds"}, |
| // capabilities names supported protocols only, in the bucket-private metrics. |
| - "metrics": {"capabilities", "mem_total_bytes", "mem_avail_bytes", "load1", "disk_free_bytes", "release", "tunnel", "route_versions", "upstreams", "layout", "config_refusals", "config_refusals_total", "release_refusals", "proof_waits", "config_guard", "build_states", "build_states_err", "update_settings", "updates", "egress", "size_committed_mib"}, |
| + "metrics": {"capabilities", "mem_total_bytes", "mem_avail_bytes", "load1", "disk_free_bytes", "release", "tunnel", "route_versions", "upstreams", "layout", "config_refusals", "config_refusals_total", "release_refusals", "proof_waits", "config_guard", "build_states", "build_states_err", "update_settings", "updates", "egress", "size_committed_mib", "offline_move"}, |
| "metrics.route_versions": {wildcardAnyKey}, |
| "metrics.upstreams": {wildcardAnyKey}, |
| "metrics.upstreams.*[]": {"addr", "up", "since", "fails", "last_error"}, |
| @@ -116,6 +116,10 @@ var allowedBoxKeys = map[string][]string{ |
| // in the private block only; the values are pinned to the field level. |
| "metrics.egress": {wildcardAnyKey}, |
| "metrics.egress.*": {"allowed", "refused", "state", "detail"}, |
| + // offline_move (#339) is what an offline move's stage and start doors |
| + // read: the hosts this box keeps a stale live link for, bounded, and |
| + // whether it holds more. Private block only, pinned to the field level. |
| + "metrics.offline_move": {"stale_live_links", "stale_live_links_overflow"}, |
| } |
| // allowedFleetKeys are THE schema for Fleet's JSON output. Same friction as |
| @@ -386,6 +390,9 @@ func fixtureProbes() status.Probes { |
| // The committed figure, so metrics.size_committed_mib is exercised |
| // by the allowlist walk too (#329). |
| SizeCommittedMiB: &sizeCommitted, |
| + // The offline move facts, so metrics.offline_move is exercised by |
| + // the allowlist walk too (#339). |
| + OfflineMove: &status.OfflineMoveFacts{StaleLiveLinks: []string{"contract-left.internal"}, StaleLiveLinksOverflow: true}, |
| ConfigGuard: "bypassed (CARLOS_NO_SEALED_CONFIG)", |
| MemFrac: &memFrac, |
diff --git a/internal/status/snapshot.go b/internal/status/snapshot.go| index 85bccb89b..e28a8f9cc 100644 |
| --- a/internal/status/snapshot.go |
| +++ b/internal/status/snapshot.go |
| @@ -232,8 +232,39 @@ type Probes struct { |
| // SizeCommittedMiB is the sum, in MiB, of the sizes this box's awake |
| // instances run at (#329, spec §5.5), or nil with no activator armed. |
| SizeCommittedMiB *int64 |
| + // OfflineMove is what this box tells an offline move's stage and start |
| + // doors while the instance still serves (#339), or nil when the box |
| + // cannot take part in an offline move or cannot say. Private Metrics |
| + // only: it names hosts. |
| + OfflineMove *OfflineMoveFacts |
| } |
| +// OfflineMoveFacts is what a box that can take part in an offline move |
| +// reports about its own disk for the console's stage and start doors |
| +// (#339): a live link it keeps for a host it has no row for, which would |
| +// otherwise refuse the move only at flip, with the instance offline. |
| +// Present (even empty) means the box looked; absent is a box that cannot |
| +// say, which the doors read as saying nothing. |
| +type OfflineMoveFacts struct { |
| + // StaleLiveLinks are the hosts this box keeps a live link for |
| + // (<opt>/live/<host>) with no route row here: what a box the instance |
| + // once left keeps, root-owned. Sorted, and bounded: at most |
| + // MaxStaleLiveLinks names and MaxStaleLiveLinkBytes bytes of them. |
| + StaleLiveLinks []string `json:"stale_live_links,omitempty"` |
| + // StaleLiveLinksOverflow says the box holds more than it reports |
| + // (StaleLiveLinks is then a partial list), or stopped listing early. |
| + // A door cannot tell from it that a host has no link. |
| + StaleLiveLinksOverflow bool `json:"stale_live_links_overflow,omitempty"` |
| +} |
| + |
| +// The bounds on OfflineMoveFacts.StaleLiveLinks, which keep a box report |
| +// far below the reader's per-report cap (maxFleetBoxBodyBytes) whatever a |
| +// box holds: past either, the box sets StaleLiveLinksOverflow. |
| +const ( |
| + MaxStaleLiveLinks = 128 |
| + MaxStaleLiveLinkBytes = 8 << 10 |
| +) |
| + |
| // HostEgress is one instance's egress read-back (#328, spec §4.4): the |
| // addresses its slice holds, the entries refused and why, and a state word |
| // with its detail when the allow is not simply in force. Everything is |
| @@ -787,6 +818,11 @@ type BoxMetrics struct { |
| // promised, beside MemTotalBytes and MemAvailBytes. Information for the |
| // console's size door, never a gate. Omitted with no activator armed. |
| SizeCommittedMiB *int64 `json:"size_committed_mib,omitempty"` |
| + // OfflineMove is the box's offline move facts (#339, Probes.OfflineMove): |
| + // the hosts it keeps a stale live link for. Hostname-bearing and private |
| + // like RouteVersions. Omitted on a box that cannot take part in an |
| + // offline move. |
| + OfflineMove *OfflineMoveFacts `json:"offline_move,omitempty"` |
| } |
| // UpdateSettingsProtocol is the BoxMetrics.UpdateSettings a binary reports |
| @@ -1229,7 +1265,7 @@ func CollectBox(routes []registry.Route, p Probes, now time.Time) Box { |
| len(routeDBBytes) > 0 || p.Layout != nil || len(p.ConfigRefusals) > 0 || len(p.ReleaseRefusals) > 0 || len(p.ProofWaits) > 0 || p.Rollout != nil || p.ConfigGuard != "" || |
| p.Alerts != nil || p.GeoIP != nil || p.HeldStreams != nil || len(p.BuildStates) > 0 || p.BuildStatesErr != "" || |
| p.DemoClaimSeedReady || p.DemoMovedReady || p.UpdateSettings != 0 || len(p.Updates) > 0 || len(p.Egress) > 0 || p.SizeCommittedMiB != nil || |
| - p.MailerArmed { |
| + p.MailerArmed || p.OfflineMove != nil { |
| var capabilities []string |
| if p.DemoClaimSeedReady { |
| capabilities = append(capabilities, seeds.DemoClaimCapability) |
| @@ -1288,6 +1324,7 @@ func CollectBox(routes []registry.Route, p Probes, now time.Time) Box { |
| SizeCommittedMiB: p.SizeCommittedMiB, |
| MailerArmed: p.MailerArmed, |
| + OfflineMove: p.OfflineMove, |
| } |
| } |
diff --git a/internal/status/snapshot_test.go b/internal/status/snapshot_test.go| index 1ffac77ed..5cf4bebaf 100644 |
| --- a/internal/status/snapshot_test.go |
| +++ b/internal/status/snapshot_test.go |
| @@ -467,3 +467,26 @@ func TestCollectBoxCarriesMailerArmed(t *testing.T) { |
| t.Fatalf("the box JSON lacks mailer_armed: %s", raw) |
| } |
| } |
| + |
| +// TestCollectBoxCarriesOfflineMoveFacts pins Probes.OfflineMove (#339): the |
| +// facts reach the private Metrics block as offline_move, and an empty |
| +// report (the box looked and found nothing) is still published, so a door |
| +// can tell it from a box that cannot say. |
| +func TestCollectBoxCarriesOfflineMoveFacts(t *testing.T) { |
| + at := time.Date(2026, 11, 13, 9, 0, 0, 0, time.UTC) |
| + facts := &OfflineMoveFacts{StaleLiveLinks: []string{"left.example.com"}, StaleLiveLinksOverflow: true} |
| + b := CollectBox(nil, Probes{OfflineMove: facts}, at) |
| + if b.Metrics == nil || b.Metrics.OfflineMove != facts { |
| + t.Fatalf("metrics = %+v, want the offline move facts", b.Metrics) |
| + } |
| + out, err := json.Marshal(CollectBox(nil, Probes{OfflineMove: &OfflineMoveFacts{}}, at)) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if !strings.Contains(string(out), `"offline_move":{}`) { |
| + t.Fatalf("an empty report is not published: %s", out) |
| + } |
| + if b := CollectBox(nil, Probes{}, at); b.Metrics != nil { |
| + t.Fatalf("no facts and nothing else known must mean no metrics block: %+v", b.Metrics) |
| + } |
| +} |
diff --git a/move.go b/move.go| index 29d6eb566..a897a2d3f 100644 |
| --- a/move.go |
| +++ b/move.go |
| @@ -1498,6 +1498,17 @@ func (w *offlineRun) headline(r offlineReply) { |
| w.sayWaiting(r) |
| return |
| } |
| + if v.State == provision.OfflineReverting && v.NeverOffline { |
| + // An abort from staging: nothing moved and nothing comes back, |
| + // only the staged copy goes (#339). |
| + moveSay(w.m.out, fmt.Sprintf("Nothing moved. The stage of %s was abandoned, and %s kept serving in %s.", host, host, v.fromPlace())) |
| + if v.Next == "finish" { |
| + moveSay(w.m.out, fmt.Sprintf("The staged copy of %s is removed. Run carlos move offline finish --host %s to end the move.", host, host)) |
| + } else { |
| + moveSay(w.m.out, fmt.Sprintf("Removing the staged copy of %s from %s.", host, v.toPlace())) |
| + } |
| + return |
| + } |
| moveSay(w.m.out, moves.MoveStartingLine(host, v.fromPlace(), v.toPlace())) |
| if w.sayFailure(v) { |
| return |
| @@ -1600,6 +1611,11 @@ func (w *offlineRun) runStatus(ctx context.Context) int { |
| } |
| failed := false |
| for _, it := range v.Items { |
| + if v.NeverOffline { |
| + // Nothing of the manifest is checked for a move that never |
| + // went offline; an older console still sends the items. |
| + break |
| + } |
| if it.Diagnostic == "" { |
| moveSay(w.m.out, fmt.Sprintf("Item %s is %s.", it.Slug, it.Check)) |
| } else { |
diff --git a/move_test.go b/move_test.go| index d64b063e4..be2a38120 100644 |
| --- a/move_test.go |
| +++ b/move_test.go |
| @@ -1914,6 +1914,30 @@ func TestMoveOfflineAbortStaged(t *testing.T) { |
| } |
| } |
| +// status after an abort from staging (#339, item 2): nothing moved, so it |
| +// says so, and lists no item as waiting even from a console that still |
| +// sends the manifest's items. |
| +func TestMoveOfflineStatusAfterAStagedAbort(t *testing.T) { |
| + const nothing = "Nothing moved. The stage of acme.shop.example.com was abandoned, and acme.shop.example.com kept serving in ie." |
| + items := []frame{{"id": "db", "owner": "landing", "status": "waiting"}, {"id": "files", "owner": "landing", "status": "waiting"}} |
| + c := &fakeOfflineConsole{gets: []frame{offView("offline-reverting", frame{"never_offline": true, "sealer": "", "items": items, |
| + "reports": []frame{offReport("ie-box", "source", "reverted", true)}})}} |
| + code, out := runOfflineAgainst(t, c, "status") |
| + if want := nothing + "\n" + oUnstage + "\nie-box is reverted as the source.\n"; code != 0 || out != want { |
| + t.Fatalf("exit %d, output:\n%s\nwant 0:\n%s", code, out, want) |
| + } |
| + c = &fakeOfflineConsole{gets: []frame{offView("offline-reverting", frame{"never_offline": true, "sealer": "", "next": "finish", "items": items})}} |
| + code, out = runOfflineAgainst(t, c, "status") |
| + if want := nothing + "\n" + oUnstaged + "\n"; code != 0 || out != want { |
| + t.Fatalf("exit %d, output:\n%s\nwant 0:\n%s", code, out, want) |
| + } |
| + for _, line := range []string{oStarting, oBack, "Item "} { |
| + if strings.Contains(out, line) { |
| + t.Fatalf("the status of a staged abort says %q:\n%s", line, out) |
| + } |
| + } |
| +} |
| + |
| // TestMoveLinesNameRegionsByLabel: surface 25. Labels in every sentence, |
| // the request still sends the code. |
| func TestMoveLinesNameRegionsByLabel(t *testing.T) { |