carlos / platform Public

plan: mail submission rev 3, Fable plan round 2 (APPROVED) P2s and P3s

Round 2 approved rev 2 with no P1; the review stops (rule 1). Rev 3
applies its findings without reopening:
- P2-A: mail_caller_sends joins mailAppTables, the day-column case and
  store_gate.go, with rename and account-move test cases. The reap also
  refuses while the app-level user keeps a pre-rename name.
- P2-B: G10 puts the hand-made-route outage to Paul (family "one working
  channel", second round). Adds an operator check before switch-on and
  names the outage in the switch-on copy.
- P3s: deployment_bucket_region in operator step 5;
  absentOnDeniedStore as a store wrapper so provision.GetRecord's read is
  covered; the census note's glued sentence is split.

Docs only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 7f04a370239045ff06402716c44126d82fa42ffc parent 130f03f
2 files changed, +33 −11
  • docs/superpowers/notes/census-plan-platform-mail-submission.md +5 −1
  • docs/superpowers/plans/2026-11-13-platform-mail-submission.md +28 −10

CI passed — run details

diff --git a/docs/superpowers/notes/census-plan-platform-mail-submission.md b/docs/superpowers/notes/census-plan-platform-mail-submission.md
index 51b06c916..1bc744ae9 100644
--- a/docs/superpowers/notes/census-plan-platform-mail-submission.md
+++ b/docs/superpowers/notes/census-plan-platform-mail-submission.md
@@ -14,7 +14,11 @@ That writes the real `census-proposal-platform-mail-submission.md`, its overlay
- replaces Task 5's credentials constructor with `NewS3StoreFromConfig` over `rootaws.LoadStaticConfig` (P2-3);
- adds `CARLOS_DEPLOYMENT_REGION` (P2-3);
- adds the AccessDenied-as-absent read (P2-4);
-- drops the `s3:ListBucket` statement from Task 8 (P2-4). Read sites and dispositions below are predictions. The recorded dispositions of existing units are whatever the chain holds at build time.
+- drops the `s3:ListBucket` statement from Task 8 (P2-4).
+
+**Rev 3** (after Fable round 2, APPROVED) changes no unit's scope. The mailer's AccessDenied read becomes a `release.Store` wrapper inside `internal/mailer`, already covered by that package's `new` row. The remaining rev 3 changes are in `internal/console`, which is out of scope.
+
+Read sites and dispositions below are predictions. The recorded dispositions of existing units are whatever the chain holds at build time.
Ruling `census-ruling-platform-mail-submission`. The independent reviewer approves or rejects every change below; nothing goes to the census owner (Paul, #280, 2026-10-26). The reviewer is from the other family than the author: Astra for a Claude author.
diff --git a/docs/superpowers/plans/2026-11-13-platform-mail-submission.md b/docs/superpowers/plans/2026-11-13-platform-mail-submission.md
index 075a50aa2..c6a5de03d 100644
--- a/docs/superpowers/plans/2026-11-13-platform-mail-submission.md
+++ b/docs/superpowers/plans/2026-11-13-platform-mail-submission.md
@@ -17,7 +17,9 @@
- P1-1 was in a new family, "a switched app's bundles lack `<P>_MAIL_FROM`".
- P2-1 was in the attribution family. That is the family's third round counting the design's two, so this plan applies the fix the reviewer named and does not write a fix of its own (rule 2's third option: one place, a guard test).
- **Rev 2** (this revision) applies all nine fixes and the P3s that were cheap to fold in, and lists the rest under "P3 follow-ups". The table at the end maps each finding to its change.
-- **Round 2** is scoped to the rev 2 diff. A round 3 needs Paul's go.
+- **Round 2:** Fable 5.2 reviewed rev 2 at `130f03f` and returned **APPROVED, no P1**, so the review stops here (rule 1). **Rev 3** (this revision) applies its two P2s and three P3s without reopening.
+ - P2-B is the second round in the family **"one working channel"**: a switched app's route must have a channel that works, or it fails loudly without taking the site down. P1-1 was the first. A third finding in that family goes to Paul as a choice (rule 2); G10 already puts it to him.
+- A round 3 needs Paul's go.
- The plan was rebased onto `origin/main` `8f8207719` (#962, `internal/edge` only, touching nothing this plan changes). **The build branch must be cut from `8f8207719` or a later tip**, so the census chain it proposes against is current.
---
@@ -36,6 +38,7 @@ Each gap names the task it blocks, the spec text, what the code shows, and a rec
| G6 | Task 8, Task 9 | §5: key "armed by the operator by hand", and never through `user_data`, SSM or the bucket | Group-mode boxes are launched unattended by their Auto Scaling group (`group-init.sh.tftpl:312-338`). A new or replaced group box has **no key**, so its mailer never starts and every switched instance on it answers `503 MAILER_UNAVAILABLE` until someone arms it. Every automatic delivery path the spec rules out is one uid `carlos` can read | Ask Paul. Options: (a) switched apps run on fixed boxes only, refused by the door; (b) the box reports "mailer armed" in its status record, the door and an alert read it, and the operator arms each new box (a runbook step per scale event); (c) a separate design for unattended key delivery. This plan builds (b)'s report and alert (Task 3 step 6, Task 6 precondition) because it helps under every option |
| G7 | Task 6 | Decision 10: "**Adopting**, rolling back to, or pinning a build whose manifest lacks the declaration is refused" | Every person-facing change of what a route serves goes through a console door. A box's `carlos adopt` (root) also adopts channel heads that a direct-bucket promote (pinfra scripts) moved, without the console | Refuse at every console door that changes what a route serves (one shared check, and a guard test over the route table). At the box, log loudly and raise an event on adopt and on wake, as decision 10 already does for wake. A box-side adopt **refusal** would be new root authority, and the plan does not add it unless Paul asks |
| G8 | Task 6 | §5 Tenants: "The switch refuses an app whose sender would send with an unassociated tenant" | Nothing records whether an identity or configuration set is associated with its tenant (`DomainRecord`, `internal/mail/domain.go:59-66`). Senders spec §4.2.1's backfill is §9 item 3, still open | The door asks SES live (`ListTenantResources`) through the console's provisioner, only when the app sender has a `TenantARN`. The control-plane role may need `ses:ListTenantResources`. That policy is not in this repo (senders spec §4.2 item 2). A sender with no `TenantARN` sends without `TenantName` and needs no association |
+| G10 | Task 4, Task 9, operator step 8 | Decision 11: rastrillo "fails loudly at boot when a switched app has neither channel" | With `CARLOS_MAIL` set only for `rt.Provisioned` (round 1 P2-2), a **hand-made route** (a registry row with no instance record) of a switched app has neither channel. Its bundle lost the SMTP variables, so rastrillo refuses at boot: **a mail gap becomes a site outage for that route**. Nothing in the door can see such a route, because the box report keys `RouteVersions` by host, not by app (round 2 P2-B; family "one working channel", second round) | **Paul's choice.** The plan as written takes (a), and the copy and the operator check say so.<br>(a) Accept it, with an operator check before switch-on that every route of the app has an instance record (operator step 8), and the outage named in the `email submission on` copy.<br>(b) Add the app to the box report (a host-to-app map) so the door can refuse.<br>(c) Let rastrillo fall back to logged mail rather than refuse at boot, which reverses decision 11's loud failure |
| G9 | Task 5 | §5 Rate: "a per-sender token bucket" | No rate or burst is given | 2 messages a second, a burst of 20, per sender per box, as package constants. Paul to confirm against the deployment's SES send rate |
Plan choices that are not gaps, for the plan reviewer (each resolves an item on round 3's P3 list or an unstated detail):
@@ -164,6 +167,8 @@ Tasks 1 and 2 can start at once and run in parallel. Task 7 can start once Task
- Modify: `internal/mailwire/mailwire.go` (tag names, the mailer caller rule)
- Modify: `internal/console/sesevents.go` (`recordAndEnforceMail` `:500`)
- Modify: `internal/console/store.go` (the schema list beside `mail_sender_counts` `:301-312`: one new table), `internal/console/mailcounts.go` (two store methods beside `RecordMailEvent` `:109`)
+- Modify: `internal/console/mailevents.go`: `mailAppTables` (`:113`) gains `"mail_caller_sends"`, and `mailAppTimeColumn` (`:190-200`) gains `case "mail_caller_sends": return "day"`. Then `carryMailApp` and `forgetMailApp` move and forget its rows with the app on a rename (`store.go:2656`) or an account move (`store.go:2547`), comparing the day string correctly (`mailAppTimeSince` `:208`) (round 2 P2-A).
+- Modify: `internal/console/store_gate.go`: the table map gains `"mail_caller_sends": {Sqid: "account", App: "app"}` beside `mail_sender_counts` (`:231-236`), so the gate's purge and claim checks cover it (round 2 P2-A)
- Test: `internal/mail/events_test.go`, `internal/mail/sender_test.go`, `internal/console/sesevents_test.go`, `internal/console/mailcounts_test.go`
**Interfaces:**
@@ -182,7 +187,7 @@ Tasks 1 and 2 can start at once and run in parallel. Task 7 can start once Task
- `"mailer"` when `mailwire.IsMailerCaller(caller)`;
- `"app_user"` when the caller's bare name (or a user ARN's last segment) equals `UserName(acct, app)` exactly;
- `"other"` for everything else: `+s+` standalones, `+e+` environment users, and unknown callers.
- - A new table, additive (`CREATE TABLE IF NOT EXISTS`): `mail_caller_sends (account TEXT NOT NULL, app TEXT NOT NULL, day TEXT NOT NULL, class TEXT NOT NULL, sends INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (account, app, day, class))`. It is pruned with the same retention as `mail_sender_counts`.
+ - A new table, additive (`CREATE TABLE IF NOT EXISTS`): `mail_caller_sends (account TEXT NOT NULL, app TEXT NOT NULL, day TEXT NOT NULL, class TEXT NOT NULL, sends INTEGER NOT NULL DEFAULT 0, PRIMARY KEY (account, app, day, class))`. It is pruned with the same retention as `mail_sender_counts`, and it joins every list an app-keyed mail table joins (files above).
- `func (s *Store) RecordMailCallerSend(ctx context.Context, acct, app, day, class string) error` upserts `sends = sends + 1`.
- `func (s *Store) MailCallerSends(ctx context.Context, acct, app, sinceDay string) (map[string]int64, error)` sums by class over `day >= sinceDay`.
- `recordAndEnforceMail` calls `RecordMailCallerSend` for **Send** events only, and only on the named path (after the live check). The class is computed from `ev.Caller` and the **resolved** account and app, never from tags. A tag can name the app, but only the caller decides the class, so a forged tag can neither hide an `app_user` send nor fake a `mailer` one.
@@ -200,7 +205,8 @@ Tasks 1 and 2 can start at once and run in parallel. Task 7 can start once Task
- `TestRecordAndEnforceChargesCallerNotForgedTag` (console, fake store): an SMTP app's event with another app's tags increments the caller's counts and never the tagged app's; the same event from the mailer increments the tagged sender's.
- `TestMailerNameNeverParsesAsApp`: `AppOfCaller("carlos-mailer-eu-west-1")` is false. The reason: `carlos-mailer-…` does not start with `carlos-mail-` at all (the character after `mail` is `e`, not `-`), so the prefix cut fails before any account is parsed. Also pin the converse: `IsMailerCaller(UserName(acct, app))` is false for a table of valid accounts and apps (round 1 P3).
- `TestCallerClass`: the mailer's bare name and user ARN give `mailer`; `carlos-mail-abc-docs` for (abc, docs) gives `app_user`; the same name for (abc, sheets) gives `other`; a `+s+` and a `+e+` name give `other`.
- - `TestMailCallerSendsCounts` (store): two `mailer` sends, one `app_user` send yesterday and one today, and an `other` send; `MailCallerSends(since=today)` gives `{mailer:2, app_user:1, other:1}`. Pruning removes days past retention.
+ - `TestMailCallerSendsCounts` (store): two `mailer` sends, one `app_user` send yesterday and one today, and an `other` send; `MailCallerSends(since=today)` gives `{mailer:2, app_user:1, other:1}`. Pruning removes days past retention. **App rename** (round 2 P2-A): `app_user` sends recorded under the old name, then a rename (`store.go:2656`'s path), then `MailCallerSends` on the new name returns them and the old name returns none. The same holds for an account move (`:2547`). So the reap's 7-day `app_user == 0` check cannot pass because the history stayed behind.
+ - The existing table-coverage tests over `mailAppTables` and the store gate's map (whatever pins them today) pass with the new table in both.
- `TestCallerClassIgnoresForgedTags` (console): an SMTP app's Send carrying the mailer's tags for itself is counted `app_user`; a Bounce adds nothing to `mail_caller_sends`.
- [ ] **Step 2: Run** `go test ./internal/mail/ -run 'TestParseEventKeepsTags|TestTagsBelievedOnlyFromMailer|TestMailerNameNeverParsesAsApp|TestCallerClass' && go test ./internal/console/ -run 'TestRecordAndEnforceChargesCallerNotForgedTag|TestMailCallerSendsCounts|TestCallerClassIgnoresForgedTags'`. Expected: FAIL.
- [ ] **Step 3: Implement.** Update the two existing test callers of `SenderOfCaller` (`sender_test.go`, `walk_environment_test.go`) to pass `nil` tags.
@@ -333,7 +339,7 @@ Tasks 1 and 2 can start at once and run in parallel. Task 7 can start once Task
Both are new optional host.env keys. `carlos mailer serve` refuses to start without either, with one journal line naming the missing key.
Every AWS config the mailer builds comes from `rootaws.LoadStaticConfig(ctx, keyID, secret, awsconfig.WithRegion(<region>))` (`internal/rootaws/config.go:45`). That function already refuses `AWS_PROFILE`, empties the shared config files and disables IMDS. The mailer never calls `LoadDefaultConfig`.
- `internal/release`: `func NewS3StoreFromConfig(cfg aws.Config, bucket string) *S3Store` builds the client with the same options `newS3Store` applies today: `s3compat.Options()` and the checksum settings, which honour `CARLOS_S3_ENDPOINT` and `CARLOS_S3_QUIRKS`. Those options move into one unexported helper that both call; neither body's behaviour changes.
-- **A missing object reads as absent, not as an error** (round 1 P2-4). The mailer's IAM user has no `s3:ListBucket`, so S3 answers a missing key with `403 AccessDenied`, not `404`, and `s3NotFound` (`store.go:887-896`) does not fold that. The mailer's three reads (sender, instance and domain records) go through `func readAbsentOnDenied(ctx, s release.Store, key string) ([]byte, string, error)`. It maps `os.ErrNotExist` **and** an `AccessDenied` API error to "absent". Absent always refuses (`SUBMISSION_OFF`, `ROUTE_NOT_ON_BOX` or `FROM_NOT_ALLOWED`), so the mapping cannot admit anything. A denied read is logged as such, at most once a minute per prefix, so a broken policy is visible and is not mistaken for a real absence. Domain records are read by `mailwire.DomainKey(acct, domain)` for each `Grant.Domains` entry, never listed, so no List grant is needed.
+- **A missing object reads as absent, not as an error** (round 1 P2-4). The mailer's IAM user has no `s3:ListBucket`, so S3 answers a missing key with `403 AccessDenied`, not `404`, and `s3NotFound` (`store.go:887-896`) does not fold that. The mailer's three reads (sender, instance and domain records) go through **a store wrapper**, not a helper function (round 2 P3): `routeHere` reads through `provision.GetRecord`, which takes a `release.Store` and calls its `Get`. So `type absentOnDeniedStore struct{ release.Store }` overrides `Get` to return an `os.ErrNotExist`-wrapped error for an `AccessDenied` API error, and passes everything else through. The mailer builds its one store as `absentOnDeniedStore{release.NewS3StoreFromConfig(...)}` and hands that same value to `provision.GetRecord` and to its own sender and domain reads. A denial and a real absence both read as "absent". Absent always refuses (`SUBMISSION_OFF`, `ROUTE_NOT_ON_BOX` or `FROM_NOT_ALLOWED`), so the mapping cannot admit anything. A denied read is logged as such, at most once a minute per prefix, so a broken policy is visible and is not mistaken for a real absence. Domain records are read by `mailwire.DomainKey(acct, domain)` for each `Grant.Domains` entry, never listed, so no List grant is needed.
- `internal/provision`: `type BoxScope struct { Region string; Pools []string; FleetBox string }` and `func BoxServesRecord(b BoxScope, rec Record) bool`. It returns exactly `ReconcileConfig{Region: b.Region, Pools: b.Pools, FleetBox: b.FleetBox}.inScope(rec.Region, rec.Pool, everywhereClass(rec)) && …ownsRecord(rec) && !rec.Retired`. It is built from the **same unexported predicates**, which do not change, so "on this box" means what the reconciler means. Where `FleetBox` is set the check is exact; otherwise it is region and pool (decision 4, §6).
- `internal/mailer/keys.go`: the key file format is up to two lines of `<access-key-id> <secret-access-key> <created RFC 3339>`; `#` comments and blank lines are skipped.
- `func LoadKeys(path string) ([]Key, error)` refuses a file that is not mode `0640`, not owned by root, or not group `carlos-mailer`, and refuses more than two keys.
@@ -375,7 +381,7 @@ Tasks 1 and 2 can start at once and run in parallel. Task 7 can start once Task
- `TestKeysFile`: a mode or owner other than `0640 root:carlos-mailer` is refused (a test seam for the owner check); three keys are refused; the newest wins; an mtime change reloads.
- `TestMailerNeverUsesIMDS`: building the SES and S3 clients makes no call to a fake IMDS endpoint set through `AWS_EC2_METADATA_SERVICE_ENDPOINT`, and the configs carry exactly the two named regions.
- `TestMailerRefusesWithoutRegion` (round 1 P2-3): `carlos mailer serve` with `CARLOS_MAIL_REGION` unset, and again with `CARLOS_DEPLOYMENT_REGION` unset, exits non-zero naming the key, before it serves anything.
- - `TestMailerReadsAccessDeniedAsAbsent` (round 1 P2-4): a fake store answering `AccessDenied` for the sender gives `403 SUBMISSION_OFF`, for the instance record `403 ROUTE_NOT_ON_BOX`, and for a domain record `403 FROM_NOT_ALLOWED`. None reaches SES, and each logs the denial. Any other store error gives `503 MAILER_UNAVAILABLE`.
+ - `TestMailerReadsAccessDeniedAsAbsent` (round 1 P2-4; through the wrapper, including via `provision.GetRecord`): a fake store answering `AccessDenied` for the sender gives `403 SUBMISSION_OFF`, for the instance record `403 ROUTE_NOT_ON_BOX`, and for a domain record `403 FROM_NOT_ALLOWED`. None reaches SES, and each logs the denial. Any other store error gives `503 MAILER_UNAVAILABLE`.
- `TestDomainViewDecodesMailDomain` (round 1 P3): a fully populated `mail.DomainRecord`, marshalled and decoded as `mailwire.DomainView`, keeps every field the view names. Lives in `internal/mail`'s tests, which can import both.
- `TestTierDefaultCapShared`: `internal/console`'s `TierCap("")` equals `mailwire.DefaultDailyCap`.
- `TestBoxServesRecordMatchesReconciler`: for a table of records and box scopes, `BoxServesRecord` agrees with what a reconcile pass would mint (reuse the reconcile test fixtures).
@@ -419,7 +425,8 @@ Tasks 1 and 2 can start at once and run in parallel. Task 7 can start once Task
- `internal/mail/sweep.go`: `ReapAppUserAfterSubmission` reaps the app-level user and key only (never the identity: senders spec #147), sets `Submission.AppUserReapedAt`, and clears `Provisioned`. It runs only when **all** of the following hold (G4):
- the switch has been on for at least 7 days;
- `MailCallerSends(acct, app, since = the switch day)["mailer"] >= 1`;
- - `MailCallerSends(acct, app, since = today − 7)["app_user"] == 0`.
+ - `MailCallerSends(acct, app, since = today − 7)["app_user"] == 0`;
+ - `Provisioned.IAMUser == UserName(acct, app)`. If a rename left the app-level user under its old name, its sends would resolve to the old app and never count as `app_user` for this one, so the reap refuses and logs. Fail-closed; the operator re-enables or reaps by hand.
It reads Task 2's caller-class counts (`Store.MailCallerSends`, round 1 P2-1) through a function argument, `func(acct, app, sinceDay string) (map[string]int64, error)`, so `internal/mail` stays free of the console. A read error skips the reap for that pass. As G4 says, this proves the SMTP key stopped being used, not that every route can submit.
- The door, `POST /api/cli/apps/{account}/{app}/email/submission` with body `{"on": bool}`, `Kind: kindCLI`, `Allow: svcrole.Allow(svcrole.Admin)` (the authority `email enable` has). On `on: true` it checks, in order, and each failure is `409` with the remedy:
1. the app's mail is declared and enabled;
@@ -437,7 +444,7 @@ Tasks 1 and 2 can start at once and run in parallel. Task 7 can start once Task
- **The precondition holds while on** (decision 10, test 8.12): `func (s *Server) submissionBuildRefusal(ctx, acct, app, version string) *doorRefusal` returns `409` "this build does not declare `--mail submit`, and email submission is on for <app>: switch submission off first (carlos email submission off --app <app>), or ship with --mail submit". Every door from step 1's enumeration calls it before it writes. Waking is never refused. Instead, at spawn, when `MailSwitch` is on and the staged manifest's `Mail != "submit"`, the agent logs at error level and emits an instance event, once per (host, version). The adopt pass does the same when it adopts such a head (G7).
- The status reply and `carlos email status` gain a Submission block: on or off, since when, whether the app-level user is kept or reaped, and the boxes not armed.
-- [ ] **Step 0: UX pass, then copy review** (AGENTS.md). Mock the CLI output of `email submission on|off` and the status block, the five precondition refusals, the build refusal, and the `mailer_unarmed` alert's title and body, at 80 columns. Lead with the state. Draft IDs `PMS-C1`.. in `platform-mail-submission-copy.json`. Run the copy-review skill, and apply Paul's edits verbatim. `TestApprovedPlatformMailSubmissionCopy` via `checkApprovedCopy` (`approved_copy_test.go:71`). **Paul's step.**
+- [ ] **Step 0: UX pass, then copy review** (AGENTS.md). Mock the CLI output of `email submission on|off` and the status block, the five precondition refusals, the build refusal, and the `mailer_unarmed` alert's title and body, at 80 columns. **The `email submission on` confirmation names the G10 outage** (round 2 P2-B). A route with no instance record cannot send mail once this is on, and its app will refuse to start, so check `carlos instances --app <a>` first. Lead with the state. Draft IDs `PMS-C1`.. in `platform-mail-submission-copy.json`. Run the copy-review skill, and apply Paul's edits verbatim. `TestApprovedPlatformMailSubmissionCopy` via `checkApprovedCopy` (`approved_copy_test.go:71`). **Paul's step.**
- [ ] **Step 1: Enumerate the serve doors.** Grep `routedecls.go` for every handler that writes a channel pointer, an instance's channel, an update pin or policy, or a rollback, and list them in `submissionServeDoors` (a slice of route patterns). Write `TestSubmissionGateCoversEveryServeDoor`. It drives each listed door against a switched app with an undeclared build and expects the refusal. It also fails if a route declaration whose handler calls a known pointer, channel or pin writer is missing from the list. That second check is the second-door guard (AGENTS.md "a rule stated as an absence").
- [ ] **Step 2: Write the failing tests.**
- `TestManifestMailField`: `""` and `"submit"` valid, `"smtp"` refused; a manifest without the key parses as `""` and marshals byte-identically to before (the `Label` rule).
@@ -562,7 +569,7 @@ Nothing below is done by the plan's implementers. Each production change needs P
- Roll the platform binary to the fleet through the usual canary, then stable, channel. The roll installs the three mailer units, the `carlos-mailer` user and the two directories on every box. The units stay inactive, because there is no key yet.
- **Deploy the console and restart it**, then check `curl /api/version` reports the new build. The console must attribute mailer events (Task 2) before any mailer send, and must accept `ship --mail` (Task 6) before any app ships with it (round 1 P3).
- **Update your own `carlos` CLI** to the release before any `carlos ship --mail submit` or `carlos email submission`. An old CLI does not know the flag.
-5. **Scoped approval, then the IAM user** for each region that hosts Oficina instances, in the deployment that hosts them (the flagship, `carloku-infrastructure`, whose account ran §9.0's spike: confirm). Bump every `?ref=` to the new tag, set `mailer = { ses_region = "eu-west-1", ses_account_id = "<acct>" }` on the region-host module, then `tofu init -upgrade`, a read plan, and `tofu apply`. It creates one IAM user and one inline policy per region, at no cost. Then, still under the approval: `aws iam create-access-key --user-name carlos-mailer-<region>`. Keep the secret only in your terminal, never in a file in a repo, SSM, the bucket or `user_data`.
+5. **Scoped approval, then the IAM user** for each region that hosts Oficina instances, in the deployment that hosts them (the flagship, `carloku-infrastructure`, whose account ran §9.0's spike: confirm). Bump every `?ref=` to the new tag, set `mailer = { ses_region = "eu-west-1", ses_account_id = "<acct>", deployment_bucket_region = "<bucket region>" }` on the region-host module (round 2 P3), then `tofu init -upgrade`, a read plan, and `tofu apply`. It creates one IAM user and one inline policy per region, at no cost. Then, still under the approval: `aws iam create-access-key --user-name carlos-mailer-<region>`. Keep the secret only in your terminal, never in a file in a repo, SSM, the bucket or `user_data`.
6. **Arm each box that hosts the apps' routes** (fixed boxes, and each current group box):
- 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;
@@ -571,8 +578,9 @@ Nothing below is done by the plan's implementers. Each production change needs P
The `.path` unit starts the socket. Check `systemctl is-active carlos-mailer.socket` and, after the first send, `journalctl -u carlos-mailer`. `carlos email status` shows the box as armed.
On a fixed box, also check the IMDS gate allowlists uids and so refuses `carlos-mailer` (`nft list ruleset`, against `scripts/harden-host.sh`).
7. **New or replaced group boxes** (G6, pending the ruling): until a ruling, each one needs step 6. The `mailer_unarmed@<box>` alert names it.
-8. **Per app (Task 9 step 4):** `carlos email submission on --app <a>`. Watch for 7 days. The app-level user's reap is automatic.
-9. **Rotation** (any time after step 6; runbook): create the second key, arm it on every box in the region (the mailer uses the newer one), confirm every box with `carlos email status` and the journal, then `aws iam delete-access-key` for the old one.
+8. **Check before each switch-on** (round 2 P2-B, G10): every route of the app has an instance record. Compare the hosts the boxes serve for the app (`carlos instances --app <a>` on each box that hosts it; the remote form is a known product gap, AGENTS.md "Operate via API and CLI") with the app's instance records (`carlos instances --app <a>` in API mode). A host served with no record is a hand-made route. Give it a record (adoption), or remove it, before switching on. Otherwise it stops at its next start (G10).
+9. **Per app (Task 9 step 4):** `carlos email submission on --app <a>`. Watch for 7 days. The app-level user's reap is automatic.
+10. **Rotation** (any time after step 6; runbook): create the second key, arm it on every box in the region (the mailer uses the newer one), confirm every box with `carlos email status` and the journal, then `aws iam delete-access-key` for the old one.
---
@@ -605,6 +613,16 @@ Out of scope, so no card: `internal/mail` and `internal/console` (both outside `
| P3 census propose per task | Every census-touching task reruns `census-propose` under the same NAME |
| P3 import guard | `TestMailerSidePackagesDoNotImportMail` (Task 4) |
+## Round 2 findings → changes (rev 3)
+
+| Finding | Change |
+|---|---|
+| **P2-A** `mail_caller_sends` must join every app-keyed mail list | Task 2: `mailevents.go` `mailAppTables` and the `day` case in `mailAppTimeColumn`; `store_gate.go` row; rename and account-move cases in `TestMailCallerSendsCounts`. Task 6's reap also refuses while the app-level user's name differs from `UserName(acct, app)` |
+| **P2-B** `rt.Provisioned` turns a mail gap into an outage for a hand-made route | G10 puts the choice to Paul (family "one working channel", second round); operator step 8 checks every route has a record before switch-on; the `email submission on` copy names the outage |
+| P3 operator step 5 | `deployment_bucket_region` added to the `mailer` object |
+| P3 `readAbsentOnDenied` | Now `absentOnDeniedStore`, a `release.Store` wrapper, so `provision.GetRecord`'s read is covered too |
+| P3 census note | The glued sentence in the rev 2 note is split |
+
### P3 follow-up list (does not start a round)
- An SCP or permissions boundary in the SES account refusing `iam:CreateRole` and `iam:CreateUser` on `carlos-mailer-*`, so the name rule is enforced rather than only stated.