carlos / platform Public

infra: carlos-mailer IAM user and policy, no key in state

Task 8 of the platform mail submission plan. region-host gains a
`mailer` input (null by default: nothing created). Set, it creates
carlos-mailer-<region> under /carlos-mailer/ with one inline policy:
ses:SendRawEmail on identity/* and configuration-set/carlos-* in the mail
region (no From or TenantName condition yet, gap G5), and s3:GetObject on
the sender, instance and domain records of the deployment bucket, with
no s3:ListBucket and no write. kms:Decrypt through S3 is added only for
an SSE-KMS bucket. There is no aws_iam_access_key: the key never enters
state. The host role gains nothing. A precondition refuses a mailer
whose ses_account_id is not the module's own account, since the console
believes tags only from a carlos-mailer-* caller in the SES account.

Group mode writes CARLOS_MAIL_REGION and CARLOS_DEPLOYMENT_REGION as
region parameters, which `host-env write --group` reads into host.env.

Tests: tests/mailer.tftest.hcl (fixed) and tests/mailer_group.tftest.hcl
(group fixtures copied, so they do not ride on group.tftest.hcl's runs),
plan-only under mock_provider; TestMailerInfraGrantsOnlyTheUser checks
every module file for an access key, SendRawEmail outside mailer.tf, and
role attachments. docs/mailer-runbook.md: creating and arming the key,
group boxes, rotation, disarming, and the carlos-mailer-* name rule.

Census: Task 8 claims added, overlay re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 7497c5729f034ca2abb28c0874c2605c44e96e80 parent eeb5100
12 files changed, +801 −6
  • docs/mailer-runbook.md +231 −0
  • docs/superpowers/notes/census-claims-platform-mail-submission.tsv +7 −0
  • docs/superpowers/notes/census-proposal-platform-mail-submission.md +10 −3
  • infra/modules/region-host/README.md +33 −0
  • infra/modules/region-host/mailer.tf +104 −0
  • infra/modules/region-host/outputs.tf +5 −0
  • infra/modules/region-host/tests/mailer.tftest.hcl +164 −0
  • infra/modules/region-host/tests/mailer_group.tftest.hcl +144 −0
  • infra/modules/region-host/variables.tf +30 −0
  • internal/awsmanaged/mailer_infra_test.go +58 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv +14 −2

CI failed — run details

diff --git a/docs/mailer-runbook.md b/docs/mailer-runbook.md
new file mode 100644
index 000000000..8ac70cd16
--- /dev/null
+++ b/docs/mailer-runbook.md
@@ -0,0 +1,231 @@
+# The box-local mailer: arming, rotation and the name rule
+
+The box-local mailer sends mail for apps switched to platform mail
+submission (design `docs/superpowers/specs/2026-11-12-platform-mail-submission-design.md`,
+plan `docs/superpowers/plans/2026-11-13-platform-mail-submission.md`). It runs
+on every box as `carlos-mailer.service`, under its own user `carlos-mailer`,
+and sends through SES as one IAM user per region, `carlos-mailer-<region>`,
+under the path `/carlos-mailer/`.
+
+The user is created by the `region-host` module (`mailer` input). Its **key is
+not**: it never enters tofu state, an SSM parameter, the bucket or
+`user_data`, because each of those is somewhere uid `carlos` or its tooling
+can read. An operator creates the key and arms each box by hand. Until a box
+has the key, nothing on it listens: `carlos-mailer-arm.path` starts the
+socket only once `/etc/carlos-mailer/keys` exists.
+
+Everything here is a production change. Each step that touches AWS or a box
+needs scoped approval first (AGENTS.md, "Production infrastructure needs
+scoped approval"): account, region, resources, permissions, cost, cleanup.
+
+## Before you start
+
+- The platform release carrying the mailer is rolled to the boxes that host
+ the apps, the console is deployed and restarted (`curl /api/version`), and
+ your own `carlos` CLI is updated to it.
+- You know the SES account and region (for the flagship: the carloku
+ account, 271376211898, `eu-west-1`, where §9.0's spike ran) and the
+ deployment bucket's region.
+- **The module must run in the SES account.** `mailer.ses_account_id` must
+ be the account the `region-host` module's provider runs in; the plan
+ refuses otherwise. The console believes SES event tags only from a caller
+ named `carlos-mailer-*`, and SES reports that caller from its own account.
+- **Event ingest is on.** A send always names a configuration set, and a
+ deployment with no SNS topic has none, so every send would be refused.
+
+## 1. Create the IAM user and its policy (tofu)
+
+In the deployment's infrastructure repository (the flagship's is
+`carloku-infrastructure`):
+
+1. Bump every `?ref=` of the platform modules to the release tag.
+2. On each `region-host` module that hosts Oficina instances, set:
+
+ ```hcl
+ mailer = {
+ ses_region = "eu-west-1"
+ ses_account_id = "271376211898"
+ deployment_bucket_region = "<the deployment bucket's region>"
+ # Only if the deployment bucket is SSE-KMS:
+ # deployment_bucket_kms_key_arn = "arn:aws:kms:<region>:<account>:key/<id>"
+ }
+ ```
+
+3. Read the plan first:
+
+ ```sh
+ tofu init -upgrade
+ tofu plan
+ ```
+
+ It should add, per region: `aws_iam_user.mailer` (`carlos-mailer-<region>`,
+ path `/carlos-mailer/`) and `aws_iam_user_policy.mailer` with exactly two
+ statements (three with a KMS key): `ses:SendRawEmail` on
+ `identity/*` and `configuration-set/carlos-*` in `ses_region`, and
+ `s3:GetObject` on `apps/*/*/email/senders/*`, `apps/*/*/instances/*` and
+ `accounts/*/email/domains/*` in the deployment bucket. On a group region it
+ also adds two String parameters, `/carlos/<deployment>/<region>/CARLOS_MAIL_REGION`
+ and `CARLOS_DEPLOYMENT_REGION`. Nothing changes on the host role. There is
+ no access key in the plan.
+4. `tofu apply`. IAM users and inline policies cost nothing.
+
+```sh
+tofu output mailer_user_name # carlos-mailer-<region>
+```
+
+## 2. Create the access key
+
+Still under the approval, from your own terminal:
+
+```sh
+aws iam create-access-key --user-name carlos-mailer-<region> \
+ --query 'AccessKey.[AccessKeyId,SecretAccessKey,CreateDate]' --output text
+```
+
+That prints `<key id> <secret> <created>`. Keep it in your terminal only: never
+in a file in a repository, an SSM parameter, the bucket, `user_data`, a ticket
+or a chat. You paste it into each box in step 3, then let it go.
+
+The key file holds one line per key:
+
+```
+<access-key-id> <secret-access-key> <created, RFC 3339>
+```
+
+`#` comments and blank lines are ignored. At most two keys (IAM's limit per
+user); the mailer signs with the one whose `created` is newest.
+
+## 3. Arm each box that hosts the apps' routes
+
+Fixed boxes, and every current group box.
+
+1. Open an **interactive** Session Manager shell, not Run Command: a Run
+ Command parameter is stored and listable. Check that session logging will
+ not record the secret.
+2. **First, the regions** (a fixed box; a group box has them from its region
+ parameters). Add to `/etc/carlos/host.env` if they are not there:
+
+ ```
+ CARLOS_MAIL_REGION=<ses region>
+ CARLOS_DEPLOYMENT_REGION=<deployment bucket region>
+ ```
+
+ The regions go in before the key, because the key is what starts the
+ unit. If the key goes in first, the mailer refuses to start and restarts
+ every 5 s, the agent answers `503 MAILER_UNAVAILABLE`, and the box reports
+ the mailer not armed until the regions are added and
+ `systemctl restart carlos-mailer.service` picks them up.
+3. **Then the key**, with echo off so the secret stays off the terminal and
+ out of any transcript:
+
+ ```sh
+ stty -echo; sudo install -m 0640 -o root -g carlos-mailer /dev/stdin /etc/carlos-mailer/keys; stty echo
+ ```
+
+ Paste `<key id> <secret> <created>`, press Enter, then Ctrl-D.
+4. Check it:
+
+ ```sh
+ systemctl is-active carlos-mailer.socket # active
+ sudo journalctl -u carlos-mailer --no-pager | tail
+ ```
+
+ The mailer starts on the first connection; the agent's status tick makes
+ one within five minutes, and the box report's `mailer_armed` turns true.
+ The mailer refuses a key file that is not `0640 root:carlos-mailer`.
+5. On a fixed box, also check the IMDS gate allowlists uids and so refuses
+ `carlos-mailer` (`nft list ruleset`, against `scripts/harden-host.sh` in
+ the infrastructure repository). The mailer's unit denies IMDS itself
+ (`IPAddressDeny`), and its clients never ask; this is the second wall.
+
+## 4. A new or replaced group box
+
+A box its Auto Scaling group launches has the regions but **no key**, so its
+mailer never starts and every switched instance on it answers
+`503 MAILER_UNAVAILABLE` until it is armed (plan gap G6, awaiting Paul's
+ruling). Until there is a ruling, arm each new group box with step 3. The box
+report's `mailer_armed` is false on such a box.
+
+Do not seed `CARLOS_MAIL_REGION` or `CARLOS_DEPLOYMENT_REGION` into a group
+region with `carlos system host-env seed`: the module owns those two
+parameters, and a seed would overwrite them as SecureStrings and fight the
+next `tofu apply`.
+
+## 5. Rotation
+
+IAM allows two keys per user, and the mailer reads both and signs with the
+newer. No restart is needed: it reloads the file when it changes.
+
+1. Create the second key (step 2).
+2. On every box in the region, write a file holding both keys, the old line
+ and the new one (step 3.3, with both lines pasted).
+3. Confirm every box: `journalctl -u carlos-mailer` shows
+ `clients rebuilt over key <new id>`, and the box report still shows
+ `mailer_armed`.
+4. Delete the old key:
+
+ ```sh
+ aws iam delete-access-key --user-name carlos-mailer-<region> --access-key-id <old id>
+ ```
+
+5. Rewrite each box's file with the new line only, at your leisure.
+
+A key file that stops loading (a bad line, the wrong mode) makes the mailer
+refuse every send and fail its health check until it loads again: fix the
+file, nothing else is needed.
+
+## 6. Disarming a box
+
+```sh
+sudo rm /etc/carlos-mailer/keys
+sudo systemctl stop carlos-mailer.socket carlos-mailer.service
+```
+
+Without the file the mailer refuses every send at once. Stopping the socket
+also stops the agent dialling it. To disarm a region, delete its keys in IAM
+after the boxes.
+
+## The name rule
+
+The console believes an SES event's `account`, `app` and `sender` tags only
+when the event's caller is the mailer (`IsMailerCaller`). SES reports the
+caller by its **bare name**: a user's name whatever its path, or an assumed
+role's role name. So the trust boundary is the name prefix:
+
+> **No IAM user, under any path, and no IAM role in the SES account may be
+> named `carlos-mailer-*`, except the `region-host` module's mailer users.**
+
+Anyone who could create such a principal could have their sends' tags
+believed, charging bounces and complaints to another app. Creating one needs
+IAM authority in the SES account, which only its operators hold. After any
+IAM change in that account, check:
+
+```sh
+aws iam list-users --query "Users[?starts_with(UserName, 'carlos-mailer-')].[UserName,Path]" --output text
+aws iam list-roles --query "Roles[?starts_with(RoleName, 'carlos-mailer-')].RoleName" --output text
+```
+
+The users must all be at path `/carlos-mailer/` and one per region the module
+manages; the roles list must be empty. An SCP or permissions boundary refusing
+`iam:CreateUser` and `iam:CreateRole` on `carlos-mailer-*` would enforce the
+rule rather than state it: that is on the plan's follow-up list.
+
+## What the policy does not grant
+
+- No `s3:ListBucket`: the mailer reads records by key, and a missing one
+ answers `403 AccessDenied`, which it takes as absent. Absent always
+ refuses.
+- No write anywhere, no IAM action, no `ses:SendEmail` (§9.0: SES v2 raw
+ sends are authorized as `ses:SendRawEmail`).
+- No From condition (gap G5): identities are created per account at runtime,
+ so no static list exists. The mailer's own From check is the gate, and IAM
+ bounds the account, region and resource types.
+- No `ses:TenantName` condition yet: added only once the tenant association
+ backfill (spec §9 item 3) has landed, because before it an untenanted send
+ would be refused.
+- **No `tenant/*` resource.** The console's own send policy grants
+ `tenant/carlos-bab/*` because SES checks the tenant on a tenant-attributed
+ send. The mailer passes `TenantName` for a sender with a `TenantARN`, so
+ until the policy grants `tenant/carlos-*/*` such a sender's sends are
+ likely refused (`503 MAILER_UNAVAILABLE`). Check before switching on an app
+ whose sender has a `TenantARN`.
diff --git a/docs/superpowers/notes/census-claims-platform-mail-submission.tsv b/docs/superpowers/notes/census-claims-platform-mail-submission.tsv
index 6c297a21e..d8a38d1b1 100644
--- a/docs/superpowers/notes/census-claims-platform-mail-submission.tsv
+++ b/docs/superpowers/notes/census-claims-platform-mail-submission.tsv
@@ -48,3 +48,10 @@ internal/mailer/counter.go:Counter.loadLocked Task 5, new: reads the day's count
internal/mailer/counter.go:Counter.writeLocked Task 5, new: writes the day's counts durably (temp file in the same directory, fsync, rename, directory fsync) before a send. carlos-mailer only, in its own state directory.
internal/mailer/keys.go:loadKeys Task 5, new: reads /etc/carlos-mailer/keys (a constant path) as carlos-mailer: refuses anything but a regular 0640 file owned by root and group carlos-mailer, more than two keys, or a malformed line; errors never carry a secret. Root never reads it. The file is written by the operator by hand, in a 0750 root:carlos-mailer directory uid carlos cannot traverse.
internal/mailer/keys.go:KeyFile.Changed Task 5, new: a stat of the same constant key path, compared with the loaded file's mtime, size and inode, so a rotation reloads with no restart. carlos-mailer only.
+#
+# Task 8 (infra: the mailer's IAM user and policy, the group region parameters).
+infra/modules/region-host/mailer.tf:external 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/* and configuration-set/carlos-* in ses_region, 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.
+infra/modules/region-host/variables.tf:external 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).
+infra/modules/region-host/outputs.tf:external Task 8: output "mailer_user_name", the user's name or null. Read-only.
+infra/modules/region-host/tests/mailer.tftest.hcl:external 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.
+infra/modules/region-host/tests/mailer_group.tftest.hcl:external 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.
diff --git a/docs/superpowers/notes/census-proposal-platform-mail-submission.md b/docs/superpowers/notes/census-proposal-platform-mail-submission.md
index a9359af23..8dc5f0592 100644
--- a/docs/superpowers/notes/census-proposal-platform-mail-submission.md
+++ b/docs/superpowers/notes/census-proposal-platform-mail-submission.md
@@ -1,9 +1,11 @@
# Census approval: platform-mail-submission
-Ruling `census-ruling-platform-mail-submission`. The independent reviewer approves or rejects every change below, 13 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-platform-mail-submission`. The independent reviewer approves or rejects every change below, 16 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
+| `infra/modules/region-host/outputs.tf` `external` | body | unchanged (1) | Task 8: output "mailer_user_name", the user's name or null. Read-only. |
+| `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` `runAgent` | body | unchanged (6) | 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). Agent, not root. |
@@ -27,12 +29,14 @@ Ruling `census-ruling-platform-mail-submission`. The independent reviewer approv
| `internal/activator/backend_exec.go` `ExecBackend.spawnChildFrom` | sites | -registry:Host ×3, +whole:Route | Task 4: the inline mount (Timers, UpdatesReader) is replaced by b.controlMount(rt, tokenReader, n): the same verbs under the same conditions, plus the mail verb when b.Mail is set. The three rt.Host reads move into controlMount; the route is passed whole. Agent, not root; nothing else changes. |
| `internal/activator/prepare.go` `ExecBackend.listenControl` | sites | -registry:Host ×3, +whole:Route | 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. |
-Envelopes re-pinned: `.`, `internal/activator`, `internal/host`, `internal/host/demo_units`, `internal/host/units`, `internal/hostenv`, `internal/instancectl`, `internal/mailer`, `internal/mailsubmit`, `internal/mailwire`, `internal/moves`, `internal/provision`, `internal/release`, `internal/status`.
+Envelopes re-pinned: `.`, `infra/modules/region-host`, `infra/modules/region-host/tests`, `internal/activator`, `internal/host`, `internal/host/demo_units`, `internal/host/units`, `internal/hostenv`, `internal/instancectl`, `internal/mailer`, `internal/mailsubmit`, `internal/mailwire`, `internal/moves`, `internal/provision`, `internal/release`, `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:
+- `infra/modules/region-host/outputs.tf` `external`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Keep fixed outputs through indexed resources, return null for group instance/EIP, and expose group, pinned template, ingress and boot-parameter names. Operator Terraform outputs only; no new box read.;rev3=census-ruling-region-ha-g2-fixes;basis=Expose the module alert topic ARN, null without an alerts topic; no new box runtime read.;rev3=census-ruling-region-ha-g3-fixes;basis=Return the selected existing or module-created alert topic ARN, null when neither input is set. Terraform output only; no new root runtime read.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: three outputs, managed_fleet_user_boundary_arn, managed_fleet_user_path and managed_fleet_bucket_prefix, each null unless managed_fleets_enabled; Terraform outputs for the operator only; no box runtime read is added;rev3=census-ruling-w6-ingress-drain;basis=new output ingress_target_groups: the ARNs joined with commas in fixed mode when set, null otherwise and in group mode; the operator copies it into the box's host.env (CARLOS_INGRESS_TARGET_GROUPS) by hand. Output only; no read added.
+- `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` `runAgent`: authority, task B,C,D,F. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained.;rev3=census-ruling-w6-ingress-drain;basis=agent (user carlos), not root. Builds the ingress drain (newIngressDrain) with arming read at ask time from os.Getenv (CARLOS_REGION_HA, CARLOS_INGRESS_TARGET_GROUPS, both from the root-owned host.env), the fixed admission and lease.CurrentSelf (existing IMDS identity); its reader is awstg.Load, the box role's credentials calling ELB DescribeTargetHealth/DescribeTargetGroupAttributes (new AWS reads, by the agent). Wires admission.closeStartsForIngressDrain, the lbhealth drain condition, ingress.setEdge, and ingress.shutdownStarted in WithShutdownStarted. The drain socket (/run/carlos/.ha-drain/drain.sock, agent-user only, existing) is now also served on a fixed box with the drain configured (was group members only), routing /v1/ingress/* to the ingress drain and the group drain verbs to 404 there. armHADepartures now takes fixtureDepartureGetenv() and MakeQueue fixtureDepartureQueue(), which in a production (non-rootrunner) build are os.Getenv and nil, as before. Read sites unchanged (9).;rev3=census-ruling-stateless-replicas-4-task1;basis=Arms the fleet-only replica swap worker next to the placement worker: same console URL and fleet token as the existing replicaCoordinatorAPI, the existing activator Service; stops and joins at shutdown. No new read site, credential or bucket reader.;rev3=census-ruling-stateless-replicas-4-task2;basis=Task 2: sets deployWorker.step to the rollout scheduler answer for the record permit (replicaStepOf over armedRollout), an in-memory callback; no read site, credential or bucket reader added.;rev3=census-ruling-stateless-replicas-4-task2-fix2;basis=Task 2 fix round 2: the swap worker step is armedReplicaStep, the same lazy scheduler lookup as before as a named function; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (01d6ca78, linked-deployments-slice1) starts linkLoop beside tunnelLoop; this branch keeps its replica coordinator wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-final;basis=#511 final wave item 2: wires the swap worker's drive (armedReplicaDrive, the armed rollout manager's DriveReplicaRelease); no read added;rev3=census-ruling-stateless-replicas-4-merge-main2;basis=Merge of main af871da0 (v0.34.49): both sides changed it. Main (178dcfe5, member-backups-2a) moves the inline duty-view closure into armDutyView/dutyView and starts verifyAssignLoop; its sites drop by registry:Host and whole:Route x2 as main recorded them. This branch keeps its replica coordinator, swap worker and drive wiring. Both kept as-is; no read added.;rev3=census-ruling-stateless-replicas-4-drill3;basis=drill 3 R24: makes one in-memory channel, closes it (once) inside the edge's existing shutdown-started callback after ingress.shutdownStarted, and passes it to tunnelLoop, which drains only a fleet channel name; no read added, same six sites; touches no admission, lease, ingress drain, listener or file; the agent process, no root decision;rev3=census-ruling-edge-ppv2;basis=Agent (uid carlos), not root. memwatchLoop now gets edgeProxyCounters(&demoEdge) (in-process counters, no read). The drain socket's driver is newAgentDrainSocket(ingress, e, os.Getenv), which attaches the edge trust handler only when CARLOS_INGRESS_PROXY_SOURCES in the agent's environment (from the root-owned host.env) parses to a non-empty list; the socket is served when drainSocketServed: a group member or a configured ingress drain (both as before), or a box armed for PROXY protocol (new). The socket's path and agent-user-only permissions are unchanged. Read sites unchanged (6).
@@ -58,6 +62,9 @@ Recorded dispositions, which each change must still satisfy:
New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+- new `infra/modules/region-host/mailer.tf:external`: reads +file:external; written legacy, accepted-legacy, frozen
+- new `infra/modules/region-host/tests/mailer.tftest.hcl:external`: reads +file:external; written legacy, accepted-legacy, frozen
+- new `infra/modules/region-host/tests/mailer_group.tftest.hcl:external`: reads +file:external; written legacy, accepted-legacy, frozen
- new `internal/activator/backend_exec.go:ExecBackend.controlMount`: reads +registry:Host ×3, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/backend_exec.go:ExecBackend.mailSubmits`: reads +registry:App ×2, +registry:Host ×2, +registry:Provisioned, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/host/mailerreport.go:mailerArmed`: reads +file:Stat; written legacy, accepted-legacy, frozen
@@ -72,6 +79,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: `07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063` → `72c38da53c18da24c7ba8b4d11f0b7d48f52b133674291683315c163fe57d603`.
+Seal: `07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063` → `cbec0f013ddb418a2bb7dafb8d540d28cfd41670e02e26d52bd56821bf13edda`.
Overlay: `internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/infra/modules/region-host/README.md b/infra/modules/region-host/README.md
index ac2373a4a..c2de81cc6 100644
--- a/infra/modules/region-host/README.md
+++ b/infra/modules/region-host/README.md
@@ -164,6 +164,39 @@ Neither input configures the process alert destination. Set
`CARLOS_ALERT_SNS_TOPIC_ARN` in the host configuration to send in-process
alerts to the chosen topic.
+## The box-local mailer's IAM user
+
+Set `mailer` to create the IAM user the box-local mailer sends as, one per
+region: `carlos-mailer-<region>`, under the path `/carlos-mailer/`. Leave it
+null, the default, on every deployment that has not switched mail submission
+on: nothing is created.
+
+```hcl
+mailer = {
+ ses_region = "eu-west-1"
+ ses_account_id = "271376211898" # the account this module runs in
+ deployment_bucket_region = "eu-west-1"
+ # deployment_bucket_kms_key_arn = "..." # only for an SSE-KMS bucket
+}
+```
+
+The user's inline policy grants `ses:SendRawEmail` on `identity/*` and
+`configuration-set/carlos-*` in `ses_region`, and `s3:GetObject` on the
+sender, instance and domain records of the deployment bucket. Nothing else:
+no `s3:ListBucket`, no write, no IAM. With `deployment_bucket_kms_key_arn` set
+it adds `kms:Decrypt` on that key, through S3 in the bucket's region only.
+The host role gains nothing. In group mode the module also writes
+`CARLOS_MAIL_REGION` and `CARLOS_DEPLOYMENT_REGION` as region parameters, so
+group boxes get them in `host.env`; fixed boxes need them in their
+operator-written `host.env`. `ses_account_id` must be the account the module
+runs in, and the plan refuses otherwise.
+
+The module creates **no access key**, and must never: the key would sit in
+tofu state. The operator creates it and arms each box by hand, and no other
+user or role in the account may be named `carlos-mailer-*`. Both are in
+`docs/mailer-runbook.md` in the platform repository. `mailer_user_name` is
+the user to create the key for.
+
## Attended group maintenance
Group mode installs and starts `amazon-ssm-agent` before CARLOS bootstrap.
diff --git a/infra/modules/region-host/mailer.tf b/infra/modules/region-host/mailer.tf
new file mode 100644
index 000000000..cba67b21d
--- /dev/null
+++ b/infra/modules/region-host/mailer.tf
@@ -0,0 +1,104 @@
+# The box-local mailer's IAM user (platform mail submission design §5,
+# decision 2; plan Task 8). One user per region, carlos-mailer-<region>,
+# under its own path /carlos-mailer/, outside the console's /carlos-mail/,
+# so no console sweep or reap can reach it.
+#
+# There is NO aws_iam_access_key here, and there must never be one: a key
+# in tofu state is a key in a place uid carlos's operators' tooling reads.
+# The operator creates the key with the AWS CLI and arms each box by hand
+# (docs/mailer-runbook.md). The host role gains nothing from this file.
+#
+# The console believes SES event tags only from a caller named
+# carlos-mailer-* (internal/mailwire IsMailerCaller). SES reports a user or
+# a role by its bare name, whatever its path, so no other user or role in
+# this account may take that prefix: the runbook's name rule.
+
+locals {
+ mailer_enabled = var.mailer != null
+}
+
+resource "aws_iam_user" "mailer" {
+ count = local.mailer_enabled ? 1 : 0
+ name = "carlos-mailer-${data.aws_region.current.region}"
+ path = "/carlos-mailer/"
+ tags = {
+ "carlos:role" = "mailer"
+ }
+ lifecycle {
+ precondition {
+ condition = var.mailer.ses_account_id == data.aws_caller_identity.current.account_id
+ error_message = "mailer.ses_account_id must be the account this module runs in: the mailer's user lives in the SES account, where the console's caller check expects it."
+ }
+ }
+}
+
+resource "aws_iam_user_policy" "mailer" {
+ count = local.mailer_enabled ? 1 : 0
+ name = "carlos-mailer"
+ user = aws_iam_user.mailer[0].name
+ policy = jsonencode({
+ Version = "2012-10-17"
+ Statement = concat([
+ {
+ # §9.0: SES v2 SendEmail with raw content is authorized as
+ # ses:SendRawEmail, and needs nothing else. No From condition (gap
+ # G5): identities are created per account at runtime, so no static
+ # list exists; the mailer's From check is the gate, and this bounds
+ # the account, the region and the resource types. A ses:TenantName
+ # StringLike carlos-* condition is added only once the tenant
+ # association backfill (spec §9 item 3) has landed, because before
+ # it an untenanted send would be refused.
+ Sid = "MailerSendRaw"
+ Effect = "Allow"
+ Action = ["ses:SendRawEmail"]
+ Resource = [
+ "arn:aws:ses:${var.mailer.ses_region}:${var.mailer.ses_account_id}:identity/*",
+ "arn:aws:ses:${var.mailer.ses_region}:${var.mailer.ses_account_id}:configuration-set/carlos-*",
+ ]
+ },
+ {
+ # The three record classes the mailer reads, by key. No
+ # s3:ListBucket (plan round 1 P2-4): a missing object answers 403
+ # AccessDenied, which the mailer reads as absent, and absent always
+ # refuses. No write of any kind.
+ Sid = "MailerReadRecords"
+ Effect = "Allow"
+ Action = ["s3:GetObject"]
+ Resource = [
+ "${var.deployment_bucket_arn}/apps/*/*/email/senders/*",
+ "${var.deployment_bucket_arn}/apps/*/*/instances/*",
+ "${var.deployment_bucket_arn}/accounts/*/email/domains/*",
+ ]
+ },
+ ], [for key in compact([var.mailer.deployment_bucket_kms_key_arn]) : {
+ # Only for an SSE-KMS deployment bucket: decrypt through S3 in the
+ # bucket's region, nothing else.
+ Sid = "MailerDecryptRecords"
+ Effect = "Allow"
+ Action = ["kms:Decrypt"]
+ Resource = [key]
+ Condition = { StringEquals = { "kms:ViaService" = "s3.${var.mailer.deployment_bucket_region}.amazonaws.com" } }
+ }])
+ })
+}
+
+# Group boxes read host.env from the region's parameters
+# (/carlos/<deployment>/<region>/, `carlos system host-env write --group`).
+# The mailer's two AWS regions are set there, so a box its group launched
+# has them before the operator arms its key. A fixed box gets them from its
+# operator-written host.env (runbook).
+resource "aws_ssm_parameter" "group_mail_region" {
+ count = local.group_enabled && local.mailer_enabled ? 1 : 0
+ name = "${local.group_ssm_path}/CARLOS_MAIL_REGION"
+ type = "String"
+ value = var.mailer.ses_region
+ tags = local.group_tags
+}
+
+resource "aws_ssm_parameter" "group_deployment_region" {
+ count = local.group_enabled && local.mailer_enabled ? 1 : 0
+ name = "${local.group_ssm_path}/CARLOS_DEPLOYMENT_REGION"
+ type = "String"
+ value = var.mailer.deployment_bucket_region
+ tags = local.group_tags
+}
diff --git a/infra/modules/region-host/outputs.tf b/infra/modules/region-host/outputs.tf
index e2186891d..cb56350a9 100644
--- a/infra/modules/region-host/outputs.tf
+++ b/infra/modules/region-host/outputs.tf
@@ -97,3 +97,8 @@ output "managed_fleet_bucket_prefix" {
description = "Bucket-name prefix managed fleet buckets are created under, for the console's fleet bucket prefix setting. Null when managed fleets are off."
value = var.managed_fleets_enabled ? var.managed_fleet_bucket_prefix : null
}
+
+output "mailer_user_name" {
+ description = "The box-local mailer's IAM user (carlos-mailer-<region>, path /carlos-mailer/), for `aws iam create-access-key --user-name`. Null when mailer is unset. Its key is never in state: the runbook creates it."
+ value = var.mailer == null ? null : aws_iam_user.mailer[0].name
+}
diff --git a/infra/modules/region-host/tests/mailer.tftest.hcl b/infra/modules/region-host/tests/mailer.tftest.hcl
new file mode 100644
index 000000000..c92a8ea62
--- /dev/null
+++ b/infra/modules/region-host/tests/mailer.tftest.hcl
@@ -0,0 +1,164 @@
+# Plan-time tests for the box-local mailer's IAM user (platform mail
+# submission plan, Task 8). mock_provider: no AWS account, no credentials.
+# These assert what the module WOULD create.
+mock_provider "aws" {}
+
+override_data {
+ target = data.aws_vpcs.default
+ values = { ids = ["vpc-0aaaaaaaaaaaaaaaa"] }
+}
+
+override_data {
+ target = data.aws_caller_identity.current
+ values = { account_id = "271376211898" }
+}
+
+override_data {
+ target = data.aws_region.current
+ values = { region = "eu-west-1" }
+}
+
+override_resource {
+ target = aws_sqs_queue.terminations
+ values = { arn = "arn:aws:sqs:eu-west-1:271376211898:carlos-test-host-terminations" }
+}
+
+variables {
+ name = "carlos-test-ie"
+ sg_description = "carlos test host"
+ iam_name = "carlos-test-host"
+ instance_type = "t4g.small"
+ root_volume_size = 20
+ user_data = "#!/bin/sh\n"
+ deployment_bucket_arn = "arn:aws:s3:::carlos-test-platform"
+ data_bucket_arn = "arn:aws:s3:::carlos-test-ie"
+ ssm_parameter_arn = "arn:aws:ssm:eu-west-1:271376211898:parameter/carlos/*"
+}
+
+run "mailer_off_by_default" {
+ command = plan
+ assert {
+ condition = length(aws_iam_user.mailer) == 0 && length(aws_iam_user_policy.mailer) == 0
+ error_message = "mailer unset must create no user and no policy"
+ }
+ assert {
+ condition = output.mailer_user_name == null
+ error_message = "mailer unset: no user name"
+ }
+}
+
+run "mailer_on" {
+ command = plan
+ variables {
+ mailer = {
+ ses_region = "eu-west-1"
+ ses_account_id = "271376211898"
+ deployment_bucket_region = "eu-west-1"
+ }
+ }
+ assert {
+ condition = aws_iam_user.mailer[0].name == "carlos-mailer-eu-west-1" && aws_iam_user.mailer[0].path == "/carlos-mailer/"
+ error_message = "the user is carlos-mailer-<region> under /carlos-mailer/"
+ }
+ assert {
+ condition = output.mailer_user_name == "carlos-mailer-eu-west-1"
+ error_message = "mailer_user_name names the user"
+ }
+ assert {
+ condition = aws_iam_user_policy.mailer[0].user == "carlos-mailer-eu-west-1" && aws_iam_user_policy.mailer[0].name == "carlos-mailer"
+ error_message = "the policy is the mailer user's own, named carlos-mailer"
+ }
+ assert {
+ condition = length(jsondecode(aws_iam_user_policy.mailer[0].policy).Statement) == 2
+ error_message = "exactly two statements"
+ }
+ assert {
+ condition = jsondecode(aws_iam_user_policy.mailer[0].policy).Statement[0].Action == ["ses:SendRawEmail"] && toset(jsondecode(aws_iam_user_policy.mailer[0].policy).Statement[0].Resource) == toset([
+ "arn:aws:ses:eu-west-1:271376211898:identity/*",
+ "arn:aws:ses:eu-west-1:271376211898:configuration-set/carlos-*",
+ ])
+ error_message = "statement 1 is ses:SendRawEmail only, on identity/* and configuration-set/carlos-* in the mail region"
+ }
+ assert {
+ condition = !can(jsondecode(aws_iam_user_policy.mailer[0].policy).Statement[0].Condition)
+ error_message = "no condition on the send until the tenant backfill (gap G5)"
+ }
+ assert {
+ condition = jsondecode(aws_iam_user_policy.mailer[0].policy).Statement[1].Action == ["s3:GetObject"] && toset(jsondecode(aws_iam_user_policy.mailer[0].policy).Statement[1].Resource) == toset([
+ "arn:aws:s3:::carlos-test-platform/apps/*/*/email/senders/*",
+ "arn:aws:s3:::carlos-test-platform/apps/*/*/instances/*",
+ "arn:aws:s3:::carlos-test-platform/accounts/*/email/domains/*",
+ ])
+ error_message = "statement 2 is s3:GetObject only, on the sender, instance and domain records"
+ }
+ assert {
+ condition = alltrue([for s in jsondecode(aws_iam_user_policy.mailer[0].policy).Statement : alltrue([
+ for a in s.Action : !contains(["s3:ListBucket", "s3:PutObject", "s3:DeleteObject", "ses:SendEmail", "s3:*", "ses:*", "*"], a) && !startswith(a, "s3:Put") && !startswith(a, "iam:")
+ ])])
+ error_message = "no s3:ListBucket, no s3:Put*, no delete, no ses:SendEmail, no IAM, no wildcard action"
+ }
+ assert {
+ condition = length(aws_ssm_parameter.group_mail_region) == 0 && length(aws_ssm_parameter.group_deployment_region) == 0
+ error_message = "a fixed box gets its regions from its operator-written host.env, not from parameters"
+ }
+}
+
+run "mailer_kms_bucket_adds_decrypt_via_s3" {
+ command = plan
+ variables {
+ mailer = {
+ ses_region = "eu-west-1"
+ ses_account_id = "271376211898"
+ deployment_bucket_region = "us-east-1"
+ deployment_bucket_kms_key_arn = "arn:aws:kms:us-east-1:271376211898:key/11111111-2222-3333-4444-555555555555"
+ }
+ }
+ assert {
+ condition = length(jsondecode(aws_iam_user_policy.mailer[0].policy).Statement) == 3 && jsondecode(aws_iam_user_policy.mailer[0].policy).Statement[2].Action == ["kms:Decrypt"] && jsondecode(aws_iam_user_policy.mailer[0].policy).Statement[2].Condition.StringEquals["kms:ViaService"] == "s3.us-east-1.amazonaws.com"
+ error_message = "an SSE-KMS bucket adds kms:Decrypt on its key, through S3 in the bucket's region only"
+ }
+}
+
+run "mailer_in_another_account_is_refused" {
+ command = plan
+ variables {
+ mailer = {
+ ses_region = "eu-west-1"
+ ses_account_id = "123456789012"
+ deployment_bucket_region = "eu-west-1"
+ }
+ }
+ expect_failures = [aws_iam_user.mailer]
+}
+
+run "mailer_bad_region_fails_validation" {
+ command = plan
+ variables {
+ mailer = {
+ ses_region = "EU"
+ ses_account_id = "271376211898"
+ deployment_bucket_region = "eu-west-1"
+ }
+ }
+ expect_failures = [var.mailer]
+}
+
+run "host_role_has_no_ses_from_mailer" {
+ command = plan
+ variables {
+ mailer = {
+ ses_region = "eu-west-1"
+ ses_account_id = "271376211898"
+ deployment_bucket_region = "eu-west-1"
+ }
+ }
+ # The console's own ses:SendEmail (console_mail_from) is the only SES the
+ # host role may hold, and it is off here; the mailer's grant is the
+ # user's. TestMailerInfraGrantsOnlyTheUser (internal/awsmanaged) checks
+ # every .tf file for the rest: SendRawEmail only in mailer.tf, and no
+ # access key resource anywhere.
+ assert {
+ condition = length(aws_iam_role_policy.host_console_mail) == 0
+ error_message = "the host role gains no SES from the mailer"
+ }
+}
diff --git a/infra/modules/region-host/tests/mailer_group.tftest.hcl b/infra/modules/region-host/tests/mailer_group.tftest.hcl
new file mode 100644
index 000000000..23ebd2a4e
--- /dev/null
+++ b/infra/modules/region-host/tests/mailer_group.tftest.hcl
@@ -0,0 +1,144 @@
+# The box-local mailer's region parameters for a group box (platform mail
+# submission plan, Task 8). The fixtures are group.tftest.hcl's, copied so
+# these runs do not depend on that file's earlier runs.
+mock_provider "aws" {
+ mock_resource "aws_launch_template" { defaults = { id = "lt-0123456789abcdef0" } }
+ mock_resource "aws_security_group" { defaults = { id = "sg-0123456789abcdef1" } }
+}
+override_data {
+ target = data.aws_region.current
+ values = { region = "eu-west-1" }
+}
+override_data {
+ target = data.aws_ami.group
+ values = { root_device_type = "ebs", root_device_name = "/dev/xvda", most_recent = false, architecture = "arm64" }
+}
+override_data {
+ target = data.aws_partition.current
+ values = { partition = "aws", dns_suffix = "amazonaws.com" }
+}
+override_data {
+ target = data.aws_caller_identity.current
+ values = { account_id = "123456789012" }
+}
+override_data {
+ target = data.aws_vpc.host
+ values = { cidr_block = "10.0.0.0/16", cidr_block_associations = [] }
+}
+override_data {
+ target = data.aws_subnets.group
+ values = { ids = ["subnet-00000000000000001", "subnet-00000000000000002"] }
+}
+override_data {
+ target = data.aws_route_table.group
+ values = { routes = [{ cidr_block = "0.0.0.0/0", gateway_id = "igw-0123456789abcdef0", carrier_gateway_id = "", core_network_arn = "", destination_prefix_list_id = "", egress_only_gateway_id = "", instance_id = "", ipv6_cidr_block = "", local_gateway_id = "", nat_gateway_id = "", network_interface_id = "", odb_network_arn = "", transit_gateway_id = "", vpc_endpoint_id = "", vpc_peering_connection_id = "" }] }
+}
+override_data {
+ target = data.aws_lb.group
+ values = {
+ vpc_id = "vpc-0123456789abcdef0"
+ internal = false
+ load_balancer_type = "network"
+ ip_address_type = "ipv4"
+ enable_cross_zone_load_balancing = true
+ security_groups = ["sg-0123456789abcdef0"]
+ subnet_mapping = [
+ { subnet_id = "subnet-00000000000000001", allocation_id = "eipalloc-00000000000000001", ipv6_address = "", outpost_id = "", private_ipv4_address = "" },
+ { subnet_id = "subnet-00000000000000002", allocation_id = "eipalloc-00000000000000002", ipv6_address = "", outpost_id = "", private_ipv4_address = "" }
+ ]
+ }
+}
+override_data {
+ target = data.aws_lb_target_group.group_http
+ values = { vpc_id = "vpc-0123456789abcdef0", port = 80, protocol = "TCP", target_type = "instance", load_balancer_arns = ["arn:aws:elasticloadbalancing:eu-west-1:123456789012:loadbalancer/net/test/1234"], preserve_client_ip = "true" }
+}
+override_data {
+ target = data.aws_lb_target_group.group_https
+ values = { vpc_id = "vpc-0123456789abcdef0", port = 443, protocol = "TCP", target_type = "instance", load_balancer_arns = ["arn:aws:elasticloadbalancing:eu-west-1:123456789012:loadbalancer/net/test/1234"], preserve_client_ip = "true" }
+}
+override_data {
+ target = data.aws_eip.group["eu-west-1a"]
+ values = { public_ip = "198.51.100.10" }
+}
+override_data {
+ target = data.aws_eip.group["eu-west-1b"]
+ values = { public_ip = "198.51.100.11" }
+}
+override_resource {
+ target = aws_sqs_queue.terminations
+ values = { arn = "arn:aws:sqs:eu-west-1:123456789012:carlos-dev-ie-group-terminations", id = "https://sqs.eu-west-1.amazonaws.com/123456789012/carlos-dev-ie-group-terminations" }
+}
+override_resource {
+ target = aws_cloudwatch_event_rule.terminations
+ values = { arn = "arn:aws:events:eu-west-1:123456789012:rule/carlos-dev-ie-group-terminations" }
+}
+override_resource {
+ target = aws_iam_role.host
+ values = { id = "carlos-dev-ie-group", arn = "arn:aws:iam::123456789012:role/carlos-dev-ie-group" }
+}
+variables {
+ mode = "group"
+ name = "carlos-dev-ie-group"
+ iam_name = "carlos-dev-ie-group"
+ sg_description = "test group"
+ instance_type = "t4g.micro"
+ root_volume_size = 20
+ user_data = ""
+ deployment_bucket_arn = "arn:aws:s3:::carlos-dev-platform"
+ data_bucket_arn = "arn:aws:s3:::carlos-dev-ie"
+ ssm_parameter_arn = ""
+ vpc_id = "vpc-0123456789abcdef0"
+ box_count = 2
+ group_config = {
+ deployment = "dev"
+ region = "ie"
+ placement_region = "ie"
+ pools = ["default"]
+ ami_id = "ami-0123456789abcdef0"
+ release = "v0.100.0"
+ configuration_kms_key_arn = "arn:aws:kms:eu-west-1:123456789012:key/00000000-0000-0000-0000-000000000001"
+ }
+ group_zones = {
+ eu-west-1a = { subnet_id = "subnet-00000000000000001", allocation_id = "eipalloc-00000000000000001" }
+ eu-west-1b = { subnet_id = "subnet-00000000000000002", allocation_id = "eipalloc-00000000000000002" }
+ }
+ group_ingress = {
+ nlb_arn = "arn:aws:elasticloadbalancing:eu-west-1:123456789012:loadbalancer/net/test/1234"
+ nlb_security_group_id = "sg-0123456789abcdef0"
+ target_group_arns = {
+ "80" = "arn:aws:elasticloadbalancing:eu-west-1:123456789012:targetgroup/test-80/1234"
+ "443" = "arn:aws:elasticloadbalancing:eu-west-1:123456789012:targetgroup/test-443/1234"
+ }
+ public_ips = { eu-west-1a = "198.51.100.10", eu-west-1b = "198.51.100.11" }
+ }
+}
+
+# The box-local mailer's two AWS regions reach a group box's host.env as
+# region parameters (platform mail submission plan, Task 8), so a box the
+# group launches has them before an operator arms its key.
+run "group_host_env_has_mail_region" {
+ command = plan
+ variables {
+ mailer = {
+ ses_region = "eu-west-1"
+ ses_account_id = "123456789012"
+ deployment_bucket_region = "us-east-1"
+ }
+ }
+ assert {
+ condition = aws_ssm_parameter.group_mail_region[0].name == "/carlos/dev/ie/CARLOS_MAIL_REGION" && aws_ssm_parameter.group_mail_region[0].value == "eu-west-1"
+ error_message = "CARLOS_MAIL_REGION is the region parameter, set to ses_region"
+ }
+ assert {
+ condition = aws_ssm_parameter.group_deployment_region[0].name == "/carlos/dev/ie/CARLOS_DEPLOYMENT_REGION" && aws_ssm_parameter.group_deployment_region[0].value == "us-east-1"
+ error_message = "CARLOS_DEPLOYMENT_REGION is the region parameter, set to deployment_bucket_region"
+ }
+}
+
+run "group_without_mailer_has_no_mail_region" {
+ command = plan
+ assert {
+ condition = length(aws_ssm_parameter.group_mail_region) == 0 && length(aws_ssm_parameter.group_deployment_region) == 0
+ error_message = "mailer unset: no mailer parameters"
+ }
+}
diff --git a/infra/modules/region-host/variables.tf b/infra/modules/region-host/variables.tf
index 77dff8649..2458261ac 100644
--- a/infra/modules/region-host/variables.tf
+++ b/infra/modules/region-host/variables.tf
@@ -577,3 +577,33 @@ variable "ingress_target_group_arns" {
error_message = "ingress_target_group_arns must be distinct Elastic Load Balancing target group ARNs (arn:aws:elasticloadbalancing:<region>:<account>:targetgroup/<name>/<id>)."
}
}
+
+variable "mailer" {
+ description = <<-EOT
+ The box-local mailer's IAM user (platform mail submission plan, Task 8).
+ Null, the default, creates nothing: every deployment that has not
+ switched mail submission on. Set, it creates carlos-mailer-<region>
+ under /carlos-mailer/ with SendRawEmail in ses_region and read-only
+ GetObject on the sender, domain and instance records, and NO access
+ key: the operator creates the key and arms each box by hand
+ (docs/mailer-runbook.md). ses_account_id must be the account this
+ module runs in. deployment_bucket_kms_key_arn is only for an SSE-KMS
+ deployment bucket.
+ EOT
+ type = object({
+ ses_region = string
+ ses_account_id = string
+ deployment_bucket_region = string
+ deployment_bucket_kms_key_arn = optional(string, "")
+ })
+ default = null
+ validation {
+ condition = var.mailer == null || (
+ can(regex("^[a-z]{2}(-[a-z]+)+-[0-9]$", var.mailer.ses_region)) &&
+ can(regex("^[0-9]{12}$", var.mailer.ses_account_id)) &&
+ can(regex("^[a-z]{2}(-[a-z]+)+-[0-9]$", var.mailer.deployment_bucket_region)) &&
+ (var.mailer.deployment_bucket_kms_key_arn == "" || can(regex("^arn:aws[a-z-]*:kms:", var.mailer.deployment_bucket_kms_key_arn)))
+ )
+ error_message = "mailer needs an AWS region for ses_region and deployment_bucket_region, a 12-digit ses_account_id, and a KMS key ARN or nothing for deployment_bucket_kms_key_arn."
+ }
+}
diff --git a/internal/awsmanaged/mailer_infra_test.go b/internal/awsmanaged/mailer_infra_test.go
new file mode 100644
index 000000000..0873d5c5f
--- /dev/null
+++ b/internal/awsmanaged/mailer_infra_test.go
@@ -0,0 +1,58 @@
+package awsmanaged
+
+import (
+ "os"
+ "path/filepath"
+ "regexp"
+ "strings"
+ "testing"
+)
+
+// The box-local mailer's IAM (infra/modules/region-host/mailer.tf; platform
+// mail submission plan, Task 8), checked across every .tf file of the
+// module, which a tofu test cannot enumerate:
+// - no aws_iam_access_key resource anywhere: the mailer's key is created
+// by the operator and never enters tofu state;
+// - ses:SendRawEmail is granted only in mailer.tf, and mailer.tf attaches
+// nothing to a role: the host role gains nothing (design decision 2);
+// - mailer.tf grants no s3:ListBucket, no write and no IAM action.
+func TestMailerInfraGrantsOnlyTheUser(t *testing.T) {
+ dir := filepath.Join("..", "..", "infra", "modules", "region-host")
+ files, err := filepath.Glob(filepath.Join(dir, "*.tf"))
+ if err != nil || len(files) < 5 {
+ t.Fatalf("module files: %v %v", files, err)
+ }
+ accessKey := regexp.MustCompile(`resource\s+"aws_iam_access_key"`)
+ sawMailer := false
+ for _, f := range files {
+ b, err := os.ReadFile(f)
+ if err != nil {
+ t.Fatal(err)
+ }
+ src := string(b)
+ if accessKey.MatchString(src) {
+ t.Errorf("%s declares an aws_iam_access_key: a key would sit in tofu state", f)
+ }
+ if filepath.Base(f) != "mailer.tf" {
+ if strings.Contains(src, "ses:SendRawEmail") {
+ t.Errorf("%s grants ses:SendRawEmail; only the mailer's user may", f)
+ }
+ continue
+ }
+ sawMailer = true
+ for _, never := range []string{"aws_iam_role_policy", "aws_iam_role_policy_attachment", "aws_iam_policy_attachment",
+ `"s3:ListBucket"`, `"s3:Put`, `"s3:Delete`, `"s3:*"`, `"iam:`, `"ses:SendEmail"`, `"ses:*"`, `"*"`} {
+ if strings.Contains(src, never) {
+ t.Errorf("mailer.tf contains %s", never)
+ }
+ }
+ for _, want := range []string{`path = "/carlos-mailer/"`, `"carlos-mailer-${data.aws_region.current.region}"`, `Action = ["ses:SendRawEmail"]`, `Action = ["s3:GetObject"]`} {
+ if !strings.Contains(src, want) {
+ t.Errorf("mailer.tf lacks %s", want)
+ }
+ }
+ }
+ if !sawMailer {
+ t.Fatal("no mailer.tf in the module")
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index a1e5284f6..0585eb57e 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -204,4 +204,4 @@ plan14-root-reads-static-site-geo-962.tsv 5e8a72175700a3e60c1e283b133c1ee25e36f2
plan14-root-reads-member-backups-drill-nodb.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063
plan14-root-reads-spread-every-schedule-ticks.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063
plan14-root-reads-member-backups-2b.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063
-plan14-root-reads-platform-mail-submission.tsv 72c38da53c18da24c7ba8b4d11f0b7d48f52b133674291683315c163fe57d603
+plan14-root-reads-platform-mail-submission.tsv cbec0f013ddb418a2bb7dafb8d540d28cfd41670e02e26d52bd56821bf13edda
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 7832a4b79..94a07a82d 100644
--- a/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
+++ b/internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv
@@ -1,6 +1,8 @@
# Census overlay platform-mail-submission, written by census-propose (#369). census-ruling-platform-mail-submission, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-platform-mail-submission.md.
-# 19 body, 3 sites, 14 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
-# 13 new dispositions: 0 reads re-frozen at their disposition with the claim, 13 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+# 21 body, 3 sites, 16 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 16 new dispositions: 0 reads re-frozen at their disposition with the claim, 16 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 12110bd4e36dfb84a8352ad3b2ae1f8de1fe5f118f805606a148de17705e112e infra/modules/region-host/outputs.tf external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Keep fixed outputs through indexed resources, return null for group instance/EIP, and expose group, pinned template, ingress and boot-parameter names. Operator Terraform outputs only; no new box read.;rev3=census-ruling-region-ha-g2-fixes;basis=Expose the module alert topic ARN, null without an alerts topic; no new box runtime read.;rev3=census-ruling-region-ha-g3-fixes;basis=Return the selected existing or module-created alert topic ARN, null when neither input is set. Terraform output only; no new root runtime read.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: three outputs, managed_fleet_user_boundary_arn, managed_fleet_user_path and managed_fleet_bucket_prefix, each null unless managed_fleets_enabled; Terraform outputs for the operator only; no box runtime read is added;rev3=census-ruling-w6-ingress-drain;basis=new output ingress_target_groups: the ARNs joined with commas in fixed mode when set, null otherwise and in group mode; the operator copies it into the box's host.env (CARLOS_INGRESS_TARGET_GROUPS) by hand. Output only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 8: output "mailer_user_name", the user's name or null. Read-only. file:external@0 fc7a4e1f10e52775047a9b0cedb636a00641e8f6831970baefea419871be9868
+@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
@@ -17,6 +19,9 @@
@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 7dd2ac1e8007cd5670495d4fe0268fdff6abd3b3ec6a25de497181558a470992 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/* and configuration-set/carlos-* in ses_region, 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 6c125b6d72321a058bdb99de2401a394f07d7ce415fe833f36356c26fbaacae2
+@legacy 27c4785ed8816a60169e5b6247891f48fef431874e177ff3b85f3962bedebb3b 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 057b2449a3da8a5883b782d9d4ba0e12c17b2fa227e0b22c2f34bd3b34a7de2e
+@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
@legacy 5cd628b73d71ab551cb5451e3b7ca0cfa184638efa4b210e2dbef51e32c30b91 internal/activator/backend_exec.go ExecBackend.controlMount legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: the one composer of a control socket's verbs, for both bind sites. Mounts the schedule verbs and GET /updates exactly as the two inline copies did (same conditions, same host, token reader and write fence), and POST /v1/mail (mailsubmit.Mount) under its own condition, b.Mail != nil. Reads rt.Host and passes the route to Mount; returns nil when nothing is mounted. The agent (carlos-edge.service, user carlos), not root. registry:Host@292,registry:Host@347,registry:Host@426,whole:Route@515 827650c1147231c19b6da7e41f3fc97fa4c28e3eda76961dfa788bc9c25f536e
@legacy bce32b49d764738f9b80e81a4b6473b446149bb1e62062886297d1431cc4cc4e internal/activator/backend_exec.go ExecBackend.mailSubmits legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: the CARLOS_MAIL rule. Reads rt.App, rt.Host, rt.Provisioned and RouteAccount(rt) from the agent's own registry row, and asks b.MailSwitch (the agent's cache of the console-written app sender record, internal/host/mailswitch.go: one bounded Get of apps/<acct>/<app>/email/senders/app.json through the agent's deploy store). Logs once per host at error level for an unprovisioned route of a switched app. Agent, not root; no file read. registry:App@213,registry:App@526,registry:Host@317,registry:Host@511,registry:Provisioned@246,whole:Route@185 cfd7494b38dc64c2710233dbc2da850eb7b89fc9aecfa648cd7affd5e9a354d0
@legacy d6700cb69f36e6e7cb8fdf4f4b747269ba9bf6545143e4dd943acedc018bc4b1 internal/host/mailerreport.go mailerArmed legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 3, new: the agent's MailerArmed probe. Stats the constant socket path and dials it for GET /v1/health with a 2 s timeout; true only on a 200. Runs in the agent as carlos, never as root; the path is a constant, in a root-owned 0750 root:carlos directory nothing a tenant or an app can write. Answers a bool into the private status block. file:Stat@72 6fd83d5c27429d06864d02a141f7036c2f3e1e8e89366ad6d2a232d417420052
@@ -33,6 +38,8 @@
@legacy 9d438dcdbaabed1854fa668aa67b6b86f60ede58d5d3d2ba3c3dcb410a9f1976 internal/activator/backend_exec.go ExecBackend.agentOwnedVars legacy accepted-legacy 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.;rev3=census-ruling-platform-mail-submission;basis=Task 4: also decides CARLOS_MAIL through mailSubmits: set to "submit" only when the control socket bound, the verb is mounted, the app sender's switch is on and the route is Provisioned; stripped otherwise, a tenant-supplied value from fileEnv included. agentOwnedNames and moves.AgentOwnedVars gain it as a pinned pair. Only narrows what a tenant's files can set. Agent, not root. registry:Host@1209,whole:Route@1171,whole:Route@631 7cc1bcb0b415ee478350a0519799542e0b1e5419c94121519c6e1b349d613c10
@legacy efaa7c1113d4186ab422cb6350f2a53d99468bb7e8d5e71bf22b1f11612a7687 internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy 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-platform-mail-submission;basis=Task 4: the inline mount (Timers, UpdatesReader) is replaced by b.controlMount(rt, tokenReader, n): the same verbs under the same conditions, plus the mail verb when b.Mail is set. The three rt.Host reads move into controlMount; the route is passed whole. Agent, not root; nothing else changes. file:Command@11030,registry:Host@12313,registry:Host@12674,registry:Host@12768,registry:Host@258,registry:Host@4236,registry:Stateless@10961,whole:Route@10853,whole:Route@11002,whole:Route@11410,whole:Route@13065,whole:Route@13157,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4091,whole:Route@4119,whole:Route@4430,whole:Route@476,whole:Route@6501,whole:Route@8766 dacd2d37b38491f11ba1be34795d5fe40915aa044d6732ccf2bae467c733f80e
@legacy fa76f66ed1ce2b9e9b96dd442f08e32b99d090fa72055b83bb9c2fa35a4907db 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
+infra/modules/region-host/outputs.tf external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p3b;basis=Keep fixed outputs through indexed resources, return null for group instance/EIP, and expose group, pinned template, ingress and boot-parameter names. Operator Terraform outputs only; no new box read.;rev3=census-ruling-region-ha-g2-fixes;basis=Expose the module alert topic ARN, null without an alerts topic; no new box runtime read.;rev3=census-ruling-region-ha-g3-fixes;basis=Return the selected existing or module-created alert topic ARN, null when neither input is set. Terraform output only; no new root runtime read.;rev3=census-ruling-managed-fleets-2b1;basis=managed fleets 2b-1 Task 5: three outputs, managed_fleet_user_boundary_arn, managed_fleet_user_path and managed_fleet_bucket_prefix, each null unless managed_fleets_enabled; Terraform outputs for the operator only; no box runtime read is added;rev3=census-ruling-w6-ingress-drain;basis=new output ingress_target_groups: the ARNs joined with commas in fixed mode when set, null otherwise and in group mode; the operator copies it into the box's host.env (CARLOS_INGRESS_TARGET_GROUPS) by hand. Output only; no read added.;rev3=census-ruling-platform-mail-submission;basis=Task 8: output "mailer_user_name", the user's name or null. Read-only. file:external@0 fc7a4e1f10e52775047a9b0cedb636a00641e8f6831970baefea419871be9868
+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 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-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). Agent, not root. file:Exec@21165,file:Open@2191,file:Statfs@56689,registry:App@13287,whole:Route@13279,whole:Route@50167 688d5b030321081e11232e7e94dda18197939734cb7197c122fdc58b2dad50e6
@@ -52,6 +59,9 @@ internal/host/units/carlos-instance-sidecar@.service external legacy accepted-le
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
+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/* and configuration-set/carlos-* in ses_region, 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 6c125b6d72321a058bdb99de2401a394f07d7ce415fe833f36356c26fbaacae2
+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 057b2449a3da8a5883b782d9d4ba0e12c17b2fa227e0b22c2f34bd3b34a7de2e
+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
internal/activator/backend_exec.go ExecBackend.controlMount legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: the one composer of a control socket's verbs, for both bind sites. Mounts the schedule verbs and GET /updates exactly as the two inline copies did (same conditions, same host, token reader and write fence), and POST /v1/mail (mailsubmit.Mount) under its own condition, b.Mail != nil. Reads rt.Host and passes the route to Mount; returns nil when nothing is mounted. The agent (carlos-edge.service, user carlos), not root. registry:Host@292,registry:Host@347,registry:Host@426,whole:Route@515 827650c1147231c19b6da7e41f3fc97fa4c28e3eda76961dfa788bc9c25f536e
internal/activator/backend_exec.go ExecBackend.mailSubmits legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 4, new: the CARLOS_MAIL rule. Reads rt.App, rt.Host, rt.Provisioned and RouteAccount(rt) from the agent's own registry row, and asks b.MailSwitch (the agent's cache of the console-written app sender record, internal/host/mailswitch.go: one bounded Get of apps/<acct>/<app>/email/senders/app.json through the agent's deploy store). Logs once per host at error level for an unprovisioned route of a switched app. Agent, not root; no file read. registry:App@213,registry:App@526,registry:Host@317,registry:Host@511,registry:Provisioned@246,whole:Route@185 cfd7494b38dc64c2710233dbc2da850eb7b89fc9aecfa648cd7affd5e9a354d0
internal/host/mailerreport.go mailerArmed legacy accepted-legacy accepted-legacy;rev3=census-ruling-platform-mail-submission;basis=Task 3, new: the agent's MailerArmed probe. Stats the constant socket path and dials it for GET /v1/health with a 2 s timeout; true only on a 200. Runs in the agent as carlos, never as root; the path is a constant, in a root-owned 0750 root:carlos directory nothing a tenant or an app can write. Answers a bool into the private status block. file:Stat@72 6fd83d5c27429d06864d02a141f7036c2f3e1e8e89366ad6d2a232d417420052
@@ -69,6 +79,8 @@ internal/activator/backend_exec.go ExecBackend.agentOwnedVars legacy accepted-le
internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy 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-platform-mail-submission;basis=Task 4: the inline mount (Timers, UpdatesReader) is replaced by b.controlMount(rt, tokenReader, n): the same verbs under the same conditions, plus the mail verb when b.Mail is set. The three rt.Host reads move into controlMount; the route is passed whole. Agent, not root; nothing else changes. file:Command@11030,registry:Host@12313,registry:Host@12674,registry:Host@12768,registry:Host@258,registry:Host@4236,registry:Stateless@10961,whole:Route@10853,whole:Route@11002,whole:Route@11410,whole:Route@13065,whole:Route@13157,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4091,whole:Route@4119,whole:Route@4430,whole:Route@476,whole:Route@6501,whole:Route@8766 dacd2d37b38491f11ba1be34795d5fe40915aa044d6732ccf2bae467c733f80e
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
@coverage . 0fbf394b006de2e22e2236a2f0b29bfa959412ddb04068a7c67000d1021e1b06
+@coverage infra/modules/region-host 4823934495827cea60e94da67efac04e8f587ccdbd44aa3b502d0a8bef4bce27
+@coverage infra/modules/region-host/tests 9b7fb791859eb447bc8a6aba08f92cc8ddf9e71972cff7e8fe5e3407f5f881b4
@coverage internal/activator 2fe6860f1b7ef4f5644e17f59fe3cf75759ec2ffe597994c1478edd0512cbc38
@coverage internal/host 0a61b32acb9b181dcc50356db2370ebabe81a66e12096a07526764d0216c792e
@coverage internal/host/demo_units 3a34238356068c6176879f3ee189c81af8e08bfcc0246c5feba80d7169f7af6a