spec: platform mail submission — instances send without holding a credential
Approved design (docs only). An instance submits mail on its own control socket (POST /v1/mail, CARLOS_ADMIN_TOKEN); the agent stamps the route and forwards to a box-local carlos-mailer (own uid, instancectl peer rule, box-local routes only) that checks From, cap and pause before sending through SES with one dedicated IAM user whose key only it can read. No SES on the box role; no IAM user per sender; attribution by EmailTags believed only from the mailer's principal. Per-app switch, ordered behind a manifest declaration; rastrillo gains a submit transport. For Paul's Oficina teams: Alta's team runs block on it (Paul, 2026-11-12). Paul's rulings 2026-11-12: no layout precondition (residual stated in §6); cap counter per box (§4.1 a). Reviewed by Claude Fable 5.2 (claude-fable-5-2) under AGENTS.md stopping rules: round 1 (297b5a74a) 3 P1 (uid family x2, attribution); round 2 (8997b3914) 1 P1 (attribution) + 6 P2, rule 2 applied to both families; round 3 (7929892c0) APPROVE, no P1; P2s applied in e48f50d79. Before build: §9.1 SES spike and census cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Squashed from design/platform-mail-submission into main.
1 file changed,
+394
−0
docs/superpowers/specs/2026-11-12-platform-mail-submission-design.md+394 −0
CI cancelled — superseded by a newer push — run details
diff --git a/docs/superpowers/specs/2026-11-12-platform-mail-submission-design.md b/docs/superpowers/specs/2026-11-12-platform-mail-submission-design.md| new file mode 100644 |
| index 000000000..8dd3a0ccf |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-12-platform-mail-submission-design.md |
| @@ -0,0 +1,394 @@ |
| +# Platform mail submission: instances send without holding a credential |
| + |
| +**Date:** 2026-11-12 · **Status:** **APPROVED** (Fable 5.2, round 3, no P1; revision 5 applies its P2s) · |
| +**Branch:** `design/platform-mail-submission` from `origin/main` `99df838cf` |
| +· **Author:** Claude Opus 5.5, for Paul. |
| + |
| +**Review history (stopping rules apply).** Round 1: Fable 5.2 on revision |
| +1 (`297b5a74a`) returned CHANGES REQUIRED, with 3 P1s, 6 P2s and 5 P3s. |
| +P1-1 and P1-2 are one fault family, **"uid `carlos` does not separate the |
| +agent (or the mailer's principal) from a tenant"**. P1-3 is "attribution, |
| +cap and pause need a home". Revision 2 (`8997b3914`) answered them. |
| +Round 2: Fable 5.2 returned CHANGES REQUIRED with **one P1, in the |
| +attribution family**: a forged event tag. There were also six P2s, two of |
| +them in the uid family. Both families have now had findings two rounds |
| +running, so **stopping rule 2 applies to both.** Revision 3 does not write |
| +third fixes. For attribution it takes rule 2's third option: state the |
| +invariant, enforce it in one place, and guard it with a test (decision |
| +6). For the uid family it puts the choice to Paul (decision 7, §11). |
| +Round 3 is limited to this revision's diff and Paul's rulings. A fourth |
| +round needs Paul's go. **Paul ruled on 2026-11-12** ("Yes to all |
| +recommendations"): the layout precondition is cut, and the residual is |
| +stated (§11 item 1). The cap counter is per box (§4.1 (a)). Revision 4 |
| +records both. |
| + |
| +**Builds on:** `2026-09-15-tenant-email-senders-design.md` ("Extend the |
| +IAM-per-sender model now, and iterate towards a platform SMTP relay", and |
| +its §10). **Replaces, for switched apps:** `implementation/team-scoped-credentials.md` |
| +§3a's per-environment mail credentials. **Uses:** the control channel |
| +(`internal/edge/purge.go` `ListenControl`; `backend_exec.go` and |
| +`prepare.go` bind sites), the `instancectl` peer rule |
| +(`internal/instancectl/server.go`), and the isolated-exec layout |
| +(`internal/host/units/carlos-instance@.service`). |
| + |
| +**Stopping rule 5.** Who asks: Paul, for Oficina. What they get: Alta's |
| +team instances send mail with no IAM user or credential per instance. |
| +When it switches on: Paul blocked Alta's production team runs on this |
| +design (2026-11-12, "Happy to block"), so it switches on at the first |
| +such run. |
| + |
| +--- |
| + |
| +## 1. The problem |
| + |
| +A sending credential lives **inside the instance**. That is true at the |
| +app level (`carlos-mail-<acct>-<app>`, delivered as `<P>_SMTP_*`) and, |
| +under §3a, per owned environment (`…+e+<env>`). This has three costs. |
| + |
| +1. **One IAM user per sender.** The ceiling is 5,000 per account and not |
| + adjustable (senders spec §12). Alta's first five teams of six apps |
| + would be 30. |
| +2. **The credential is the authority.** Whoever reads `<P>_SMTP_PASS` |
| + sends as that sender from anywhere. The cap is counted after the fact, |
| + from SES events. |
| +3. **On the flat layout, per-instance credentials isolate less than they |
| + appear to.** Exec children share uid `carlos` (`admintoken.go`), so a |
| + compromised flat instance can read a sibling's env file. **On the |
| + nested (isolated-exec) layout it cannot.** That instance sees "nothing |
| + but the instance's own two directories" (`carlos-instance@.service:4-6`), |
| + and IMDS is denied to it (`:162`). |
| + |
| +## 2. The design in one paragraph |
| + |
| +**An instance submits a message on its own control socket, and the |
| +platform sends it.** The control socket is per instance, bound by the |
| +agent (`edge.ListenControl`), and gated by the instance's |
| +`CARLOS_ADMIN_TOKEN`. A new verb on it, `POST /v1/mail`, takes one |
| +message. The agent knows which route owns the socket. It forwards the |
| +message, stamped with that route, to a **box-local mailer**. The mailer |
| +accepts connections only from the agent's own main process, refuses any |
| +route that is not on its box, checks the sender's policy before sending, |
| +and sends through SES with **one dedicated IAM user for the fleet**. That |
| +user's key is readable only by the mailer. |
| + |
| +## 3. Decisions (approved by review; 7 and 9 ruled by Paul) |
| + |
| +| # | Decision | Rejected | |
| +|---|---|---| |
| +| 1 | **Submission is a verb on the existing control socket,** mounted at both bind sites (flat `backend_exec.go:2557`, nested `prepare.go:298`) under its own condition, not under the `Timers`/`UpdatesReader` mount | A network SMTP relay with per-sender passwords, which still puts a credential in every instance. A second per-instance channel | |
| +| 2 | **The mailer's credential is a single dedicated IAM user (`carlos-mailer-<region>`), not the box role.** Its key is in a root-written file readable only by the static user `carlos-mailer` (precedent: `/etc/carlos/relay-masters`). The mailer unit has `IPAddressDeny` for IMDS. **The box role gains nothing** | SES on the instance role. Every uid the IMDS gate admits gets the whole role, and the gate admits uid `carlos` by construction (`group-init.sh.tftpl:110-111`), so every flat exec child could send as any identity (round 1, P1-1) | |
| +| 3 | **The mailer's peer rule is `instancectl`'s:** `SO_PEERCRED` uid `carlos` **and** pid equal to `carlos-edge.service`'s MainPID. The socket directory is in the instance units' `InaccessiblePaths`, as `/run/carlos-control` is | A uid-only check, which every flat exec child passes (round 1, P1-2) | |
| +| 4 | **The mailer refuses any `(account, app, host)` that is not a route on its own box.** It reads this from the bucket's instance records (§5). Where a record names a box (`FleetBox`), that box must be this one. Where it does not, the record's region and pool must be this box's. **The check is therefore exact for fleet-assigned instances and region-and-pool-wide for the rest.** §6 states this | Trusting the agent's stamp for any route anywhere | |
| +| 5 | **Every instance of a switched app sends as the app sender** (`SenderAppID`), as owned environments are counted today (`walk_environment.go`). Per-instance senders stay with #148, unbuilt | Inventing instance senders here (round 1, P1-3: nothing on main creates one) | |
| +| 6 | **Attribution by SES `EmailTags`** (`account`, `app`, `sender`) on every send through the mailer. **Invariant: a tag is believed only from the mailer's own principal.** `SenderOfCaller` checks the caller first. Only when `ses:caller-identity` is `carlos-mailer-<region>` does it read the tags. Every other caller keeps today's path, and its tags are ignored. Any SMTP-credentialed tenant can set tags with an `X-SES-MESSAGE-TAGS` header (`sesv2/types/types.go:391`), so believing tags from anyone would let a tenant charge its bounces and complaints to another app. Enforced in that one function, with guard test 8.11. **Gated on the spike** (§9 item 1): that the tags arrive in `mail.tags` on Bounce, Complaint and Delivery events | Reading the tag before the caller (revision 2), which lets an unswitched app's sends be charged to a victim (round 2, P1-A). The caller identity alone, which is the same for every switched app (round 1, P1-3) | |
| +| 7 | **No layout precondition. Ruled by Paul, 2026-11-12.** Decisions 2–4 make submission no worse than today on either layout (round 2, P2-1), and §6 states the residual | Revision 2's "switched apps nested only". It claimed nested tokens are invisible to flat siblings, but nested isolation is one-way: a flat child runs in the agent's unit with `ReadWritePaths=/data /run/carlos` (`carlos-edge.service:41,50`), and can read a nested instance's env file (`paths.go:43,56`) and dial its control socket (`paths.go:49`). As written, per app, it bought nothing and would have blocked on §9 item 2 | |
| +| 8 | **Pause becomes a field on the sender record**, independent of `Provisioned`, **keeping today's pause kinds** (cap, rate, plan, manual: `mail.go:65-88`). Cap pauses lift at the day roll (`resumeStaleCapPause`), and the others do not. The console writes it (`carlos email pause`, and the automatic pauses), and the mailer reads it by etag. **While the app-level key still exists (§7.4's week), a pause also deactivates that key**, as today | Pause as IAM key state, which does not exist once the user is reaped (`SetSenderPaused` returns `ErrNotProvisioned`; `enforceMailLimits` returns early) | |
| +| 9 | **The cap is enforced before the send, with a per-box counter** (§4.1 (a), ruled by Paul, 2026-11-12) | Counting only from events, after the send | |
| +| 10 | **The switch.** It is `carlos email submission on --app <a>`, with a `docs/site/cli.md` heading and a `parity/parity.tsv` row. It is **ordered**: the door refuses it unless every route of the app runs a build that has declared the `submit` transport (the app's manifest `mail = "submit"`). When on, no `<P>_SMTP_*` is delivered anywhere, `ReapEnvironment` runs for each existing owned environment's user, and `mintOwnedEnvironmentMail` checks the switch explicitly rather than relying on `Provisioned == nil`. **The precondition holds for as long as the switch is on, not only at the flip.** Adopting, rolling back to, or pinning a build whose manifest lacks the declaration is refused (`release.Manifest`, additive field, `release.go:55-60`). The refusal names its remedy: **switch submission off first**, which re-mints through `Enable`. Those refusals stop an older build ever becoming live, so waking is **not** refused, because a refused wake would turn a mail gap into a site outage. A wake that finds an undeclared build logs loudly instead The build a route runs is read from its route record's live version. **Before §7.4's reap, `carlos email test --submit`** sends through the submit path per route, as proof rather than a declaration | Flipping before the apps can submit, which is an outage (round 1, P2-3) | |
| +| 11 | **`CARLOS_MAIL=submit` follows the bind,** not the switch and not mailer health: set when the switch is on and the control socket is bound (`ctl != nil`). Mailer health is what `503 MAILER_UNAVAILABLE` is for. A health probe at spawn would leave an instance with neither channel for its whole lifetime (round 2, P2-5). rastrillo fails loudly at boot when a switched app has neither `CARLOS_MAIL` nor SMTP variables. It is added to both `agentOwnedNames` (`backend_exec.go:2749`) and `moves.AgentOwnedVars` (`envreport.go:62`), which a test pins as a pair | Setting it from the switch alone, which leaves an app with no SMTP variables and no channel when a bind fails | |
| + |
| +### 4.1 The cap counter (ruled: (a)) |
| + |
| +Every instance of a switched app is the app sender (decision 5), and its |
| +instances are on many boxes. There are two options. |
| + |
| +- **(a) Per box, before the send; fleet-wide from events.** Each mailer |
| + keeps a durable daily counter per sender and refuses at the cap. The |
| + console still counts every send from SES events and sets the cap pause |
| + (decision 8), and §5's per-sender token bucket limits how fast any box |
| + sends. So **overshoot is roughly the per-sender rate × event latency, |
| + not boxes × cap.** It needs no new coordination, and the mailer needs |
| + only bucket reads. |
| +- **(b) Leased from the bucket.** A per-sender, per-day counter object |
| + with CAS by etag, from which mailers lease small allowances. Overshoot |
| + is bounded by outstanding leases. It costs a lease object, expiry, burst |
| + contention, and **bucket-write authority on the mailer.** |
| + |
| +**Ruled by Paul, 2026-11-12: (a).** The cap is an abuse brake, |
| +not a billing limit, and round 2 showed that (a)'s true bound is set by |
| +rate × event latency. Revision 2 recommended (b) on a looser bound. (b) |
| +stays the stated upgrade path, with no app change needed. |
| + |
| +## 4. The verb |
| + |
| +`POST /v1/mail` on the control socket, with |
| +`Authorization: Bearer <CARLOS_ADMIN_TOKEN>`. |
| + |
| +- **Body:** a JSON envelope `{ "from", "to": [..], "raw" }`. |
| + - `raw` is the RFC 5322 message, base64, at most 10 MiB, the SES v2 raw |
| + limit (to be confirmed in the spike, §9 item 1). That allows the |
| + attachments Docs and Sheets send. |
| + - `from` must equal the `From:` header. |
| + - `to` is the envelope, at most 50 recipients (to be confirmed in the |
| + spike). |
| +- **Synchronous.** The agent forwards, the mailer sends, and the verb |
| + answers with SES's result. **The retry queue stays in the app** |
| + (rastrillo's existing mail queues). Nothing is queued on the box, so |
| + hibernation is simple: an instance sends only while awake, and its |
| + socket exists only then. |
| +- **Answers:** |
| + - `200 {"message_id"}`: SES accepted it. |
| + - `400`: malformed, or `from` ≠ `From:`. |
| + - `403 {"code":"FROM_NOT_ALLOWED"}`. |
| + - `429 {"code":"CAP_REACHED"|"PAUSED"|"RATE"}`, with `Retry-After`. |
| + The apps' queues must back off, never retry hot. |
| + - `503 {"code":"MAILER_UNAVAILABLE"}`: retry. |
| +- **Not available to** seeds, sidecars, or cmd/tty one-shots. They have |
| + no control socket (`prepare.go:166`, `seedVars`), so a switched app's |
| + seeds cannot send mail. That is stated, not worked around. |
| + |
| +## 5. The mailer |
| + |
| +- **The unit and its user.** `carlos-mailer.service` in |
| + `internal/host/units`, static user `carlos-mailer`, |
| + `IPAddressDeny=169.254.169.254/32 fd00:ec2::254/128`. |
| +- **Its socket.** A root-owned socket directory in every instance unit's |
| + `InaccessiblePaths`. |
| +- **The peer rule** is decision 3. |
| +- **Its credential.** A root-owned file, `0640 root:carlos-mailer`, under |
| + a root-owned directory that uid `carlos` cannot traverse. It holds one |
| + IAM user's key per region. |
| + - **Delivery: armed by the operator by hand,** as `relay-masters` is |
| + (`variables.tf:304`, `bootstrap.go:267-269`). Revision 2 wrongly said |
| + the infra repo writes it. |
| + - **The key never passes through anything uid `carlos` can read.** Not |
| + `user_data` (readable from IMDS by flat children), not an SSM |
| + parameter the host role may read (`main.tf:519-527` records a key |
| + exposed that way), and not the bucket. |
| + - **Rotation:** IAM allows two keys per user. The procedure is to create |
| + the second key, arm it on every box in the region (the mailer reads |
| + both and uses the newer), confirm every box has it, then delete the |
| + old key. Each step is an operator runbook entry. |
| +- **What else the mailer's user may do: read only,** on the bucket keys |
| + for this region's sender records, domain records and instance records: |
| + `apps/*/*/email/senders/*`, the domain records, and the instance |
| + records. **"Route on this box" (decision 4) is read from the instance |
| + records in the bucket,** not the agent's `registry.db`, which lives in |
| + the agent's writable tree. **No bucket write** under §4.1 (a). |
| +- **The send.** SES v2 `SendEmail` with `Content.Raw`, an explicit |
| + `Destination` taken from the envelope, the sender's |
| + `ConfigurationSetName`, `TenantName` when the sender has one, and |
| + `EmailTags`. |
| +- **Header hygiene.** Before sending, the mailer strips `Bcc:` and every |
| + `X-SES-*` header from `raw`. SMTP honours `X-SES-TENANT` and |
| + `X-SES-CONFIGURATION-SET` (`internal/mail/aws.go:14-17`). Whether the v2 |
| + raw path does is unverified, so they are stripped regardless. |
| +- **The IAM policy:** `ses:SendEmail` and `ses:SendRawEmail` on |
| + `identity/*` and the account's configuration sets. It is conditioned on |
| + `ses:FromAddress` matching the platform's verified identities, or on |
| + `ses:TenantName` where the sender has a tenant, the key the senders spec |
| + §3 documents. The From check in the mailer is the real gate, and IAM is |
| + the backstop. |
| +- **Rate.** A per-sender token bucket, so one sender cannot spend the |
| + account-wide SES send rate (senders spec §3) and throttle everyone. |
| +- **Tenants.** If a sender's configuration set or identity is not |
| + associated with its tenant (senders spec §4.2.1 found existing domains |
| + unassociated), sending with `TenantName` fails. **The switch refuses an |
| + app whose sender would send with an unassociated tenant**, until the |
| + backfill (§9 item 3). |
| + |
| +## 6. What this protects, and what it does not |
| + |
| +- **No instance holds a sending credential,** on either layout. |
| +- **No instance exceeds its sender's cap or sends while paused,** within |
| + §4.1's bound. |
| +- **An instance can submit only as its own route.** The agent stamps the |
| + route from the socket, and the mailer accepts only the agent's main |
| + process and only routes on its box. |
| +- **Residual, stated.** On a box with any flat instance, a compromised |
| + flat instance can read **any** instance's admin token on that box, |
| + **nested or not** (nested isolation is one-way; see decision 7), and |
| + submit as that instance. **On that box only.** That is the same reach it |
| + has today over a neighbour's delivered SMTP password. It is better |
| + bounded than today: the sender's From, cap, pause and rate still apply, |
| + and nothing can be taken off the box. It cannot reach the mailer's |
| + socket (peer rule), the mailer's key, or SES through IMDS (the box role |
| + has none). |
| +- **Not closed:** a same-uid flat child that traces the agent process |
| + would pass the peer rule. No kernel setting in the repo prevents it, and |
| + it applies equally to the existing `instancectl` channel. Decision 4 |
| + bounds it to the box. Per-instance uids close this and the residual |
| + above together. |
| +- **A compromised agent** can send as any route on its box, within caps. |
| + It could already read every flat env file. Decision 4 bounds that |
| + agent to its own box only where instance records name a box. Otherwise |
| + it is bounded to the box's region and pool. |
| + |
| +## 7. Migration |
| + |
| +1. **Build:** the verb at both bind sites, the mailer unit and its infra, |
| + pause on the sender record, `EmailTags` attribution, the cap (§4.1), |
| + rastrillo's `submit` transport, and the manifest declaration. |
| + **Census cards** for `internal/host/units` and `infra/` (AGENTS.md). |
| +2. **Apps first:** re-pin rastrillo in the Oficina apps, declare |
| + `mail = "submit"`, deploy. They keep sending over SMTP until the switch. |
| +3. **Flip the switch per app.** Its preconditions (decision 10, and §5's |
| + tenants) are checked by the door. |
| +4. **Reap:** per-environment users via `ReapEnvironment`. The app-level |
| + user is kept until a week of clean submission, then reaped by the walk |
| + (user only, never the identity: senders spec #147). |
| +5. **Standalone credentials** (`email credentials create`) are unaffected. |
| + They are explicit and separate. |
| +6. **Switching off** re-mints through `Enable` and restores `<P>_SMTP_*`. |
| +7. **Team-scoped guard tests 17 and 19** (`team-scoped-credentials.md:400-415`) |
| + gain a switched-app case: a switched app's owned environment holds no |
| + mail credential. |
| +8. **Calls' TURN relay identities** are a separate design (§10). |
| + |
| +## 8. Tests and gates |
| + |
| +1. **No credential reaches an instance.** For a switched app, a rendered |
| + environment (`appconfig.RenderEnv`, `materialize.go:37`), default and |
| + owned, holds no `<P>_SMTP_*` and no AWS key. Golden test. |
| +2. **Identity from the socket.** A message on host A's socket is stamped |
| + A, whatever its body says. |
| +3. **The peer rule.** A uid-`carlos` process that is not the agent's main |
| + pid is refused by the mailer. So is any other uid. |
| +4. **Box-local routes only.** A stamp naming a route not on this box is |
| + refused. |
| +5. **Before-send policy.** A wrong From gets `403`. The cap boundary gets |
| + `429 CAP_REACHED`. A paused sender gets `429 PAUSED`, with no SES call |
| + (fake SES). |
| +6. **Header hygiene.** `Bcc:` and `X-SES-*` never reach SES. |
| +7. **Agent-owned variable.** A tenant-supplied `CARLOS_MAIL` is stripped. |
| + `CARLOS_MAIL` is set when the switch is on and the control socket is |
| + bound, whatever the mailer's health (decision 11). The |
| + `agentOwnedNames` and `AgentOwnedVars` pair is pinned. |
| +8. **The switch's preconditions.** An undeclared build or an |
| + unassociated tenant each refuse the switch. A flat route does not |
| + (decision 7, as ruled). |
| +9. **The IMDS gate.** The mailer unit cannot reach IMDS. The box role has |
| + no SES. `adopt_advice.go`'s parser cannot read negated sets |
| + (`parseNftSkuids`), so this is a unit-file and IAM assertion, not an |
| + nft-parse one. |
| +10. **rastrillo `submit` transport.** It is chosen only on |
| + `CARLOS_MAIL=submit`, backs off on `429` per `Retry-After`, and |
| + retries `503`. It fails at boot when a switched app has neither |
| + channel. |
| +11. **Tags are believed only from the mailer** (decision 6's guard). An |
| + event whose caller is an app's IAM user, carrying another app's |
| + `account`/`app`/`sender` tags, is counted against the caller. The same |
| + event from `carlos-mailer-<region>` is counted against the tagged |
| + sender. |
| +12. **The precondition holds while on.** Adopting, rolling back to or |
| + pinning a build without the declaration is refused for a switched app, |
| + and the refusal names "switch submission off first". Waking is never |
| + refused. |
| +13. **Pause kinds survive.** A cap pause lifts at the day roll; rate, plan |
| + and manual pauses do not. During the overlap week, a pause |
| + deactivates the app-level key. |
| + |
| +## 9. Open: facts to establish before build |
| + |
| +1. **SES spike** (blocking decisions 6 and 9, and the §4 limits): |
| + - `EmailTags` arrive on Bounce, Complaint and Delivery events, in the |
| + shape `sesevents.go` parses. |
| + - The SES v2 raw size limit and recipient limit. |
| + - Whether the v2 raw path honours `X-SES-*` headers. |
| + - The IAM action that v2 raw sends require. |
| + - Whether SES honours `X-SES-MESSAGE-TAGS` over SMTP. Decision 6's |
| + guard is correct either way. |
| + - Which characters SES tag values accept, for sender ids containing |
| + dots. |
| +2. **Which layout the Oficina apps' instances run in.** Informational |
| + only, since decision 7 was cut. It sizes §6's residual for Oficina: |
| + nested routes are not readable by each other, and only flat ones widen |
| + it. |
| +3. **Has the tenant association backfill** (senders spec §4.2.1) landed? |
| +4. **Who changes the infra repo's IMDS gate, if anything.** The |
| + decision-2 design needs no gate change, because the box role gains no |
| + SES. Confirm. |
| + |
| +## 11. Paul's rulings (stopping rule 2), 2026-11-12 |
| + |
| +1. **The uid family (decision 7).** Choose one: |
| + - **Cut the layout precondition, and state the residual** (§6). |
| + Submission is no worse than today on either layout, and better |
| + bounded. **← Ruled.** |
| + - **Refuse at box level:** no switched app on a box with any flat row |
| + (`FlatLayoutChosen`, `backend_exec.go:268-273`). This is the only form |
| + that delivers "a flat sibling cannot submit as a switched app". It |
| + waits on moving Oficina's boxes nested (§9 item 2). |
| + - **Per-instance uids,** the real fix for this and the admin-token gap. |
| + A separate design, and out of scope here. |
| +2. **The cap counter (§4.1): (a) per box. ← Ruled.** (b) stays the |
| + upgrade path. |
| + |
| +## 10. Out of scope |
| + |
| +- An SMTP shim for non-rastrillo apps. |
| +- Inbound mail. |
| +- Customer fleets in other AWS accounts. |
| +- Per-instance senders (#148). |
| +- **Calls' TURN relay identities.** A follow-up in the same shape: |
| + short-lived TURN credentials minted per request on the control socket. |
| + |
| +--- |
| + |
| +## Appendix A — round 1 (Fable 5.2, revision 1 `297b5a74a`) |
| + |
| +| Finding | Answer | |
| +|---|---| |
| +| P1-1 IMDS role reachable by uid carlos | Decision 2: a dedicated IAM user, key readable only by `carlos-mailer`, no SES on the box role, mailer `IPAddressDeny`; §9 item 4 | |
| +| P1-2 uid-only peer check | Decision 3 (`instancectl` rule plus `InaccessiblePaths`), decision 4 (box-local routes), §6 rewritten, test 8.3 | |
| +| P1-3 attribution, counts, cap, pause | Decision 5 (app sender), decision 6 (`EmailTags`, spike-gated), decision 8 (pause on the record), decision 9 and §4.1 (the cap, Paul's call) | |
| +| P2-1 SES call, headers, tenants, recipients, IAM scope | §5, §4, §9 item 1, §9 item 3 | |
| +| P2-2 the two bind sites, mount condition, outcome-following variable, agent-owned pair, seeds | Decisions 1 and 11, §4 "Not available to" | |
| +| P2-3 migration order, existing environment users, mint guard, standalone credentials, guard tests, switching off | Decision 10, §7 | |
| +| P2-4 unit and infra census, adopt parser, who changes the gate | §7.1, test 8.9, §9 item 4 | |
| +| P2-5 synchronous delivery, rate limit | §4 synchronous, §5 rate | |
| +| P2-6 layout | §1.3, decision 7, §9 item 2 | |
| + |
| +**Round 2 (Fable 5.2, revision 2 `8997b3914`):** |
| + |
| +| Finding | Answer | |
| +|---|---| |
| +| P1-A forged tags (attribution family, second round) | Decision 6: the invariant, enforced in `SenderOfCaller`, with guard test 8.11 (rule 2, third option) | |
| +| P2-1 nested tokens readable by flat siblings (uid family, second round) | Decision 7 is cut as proposed, §6's residual is rewritten, and §11 item 1 goes to Paul | |
| +| P2-2 key delivery, wrong precedent, rotation (uid family) | §5 credential: operator-armed, never through a uid-carlos path, with a rotation runbook | |
| +| P2-3 the mailer cannot read sender records | §5: read-only bucket grants; "on this box" taken from the bucket's instance records | |
| +| P2-4 precondition only at the flip | Decision 10 and test 8.12; `carlos email test --submit` before the reap | |
| +| P2-5 the health probe's dead state | Decision 11: follows the bind; rastrillo fails loudly | |
| +| P2-6 pause kinds | Decision 8 and test 8.13 | |
| +| §4.1 view | §4.1: recommendation changed to (a), with the true bound | |
| + |
| +**Round 3 (Fable 5.2, revisions 3 and 4, head `7929892c0`): APPROVE, no |
| +P1.** The review stops here (stopping rule 1). Revision 5 applies its P2s |
| +without reopening: |
| + |
| +| Finding | Answer | |
| +|---|---| |
| +| P2-a stale text (tests 8.7 and 8.8, §7.3, §9 item 2) | Corrected to the rulings and decision 11 | |
| +| P2-b "on this box" only where a record names one (uid family, wording) | Decision 4 and §6 state the exact and region-and-pool bounds | |
| +| P2-c a refused wake turns a mail gap into an outage | Decision 10: no wake refusal, a loud log instead; the rollback refusal names its remedy; test 8.12 | |
| + |
| +**Round history, for any handoff:** |
| +- Round 1: 3 P1s (two in the uid family, one in attribution). |
| +- Round 2: 1 P1 (attribution) and 6 P2s (two in the uid family). Rule 2 |
| + applied to both families. |
| +- Round 3: no P1. |
| + |
| +**Still needed before build:** the §9 item 1 SES spike, which gates |
| +decisions 6 and 9, and census cards for the build diff. |
| + |
| +**P3 follow-up list** (not starting a round): |
| + |
| +- `carlos email test --submit`: how a per-route send is driven, given |
| + that only the agent can reach an instance's control socket. It also |
| + needs its CLI docs heading and parity row. |
| +- Where the agent reads the switch from (decision 11). |
| +- If the SES event carries the caller's full ARN, match on that rather |
| + than the bare name. |
| +- §11 sits before §10. |
| + |
| +- Whether the cap counts messages or recipients (the console counts Send |
| + events). |
| +- The IAM backstop expressed as `identity/*` with a `ses:TenantName` |
| + condition on `carlos-*`, which makes the association backfill mandatory. |
| +- §4.1 is numbered ahead of §4. |
| + |
| +- The raw size limit, now 10 MiB pending the spike. |
| +- `429` back-off in the apps' queues. |
| +- The CLI docs and parity row (decision 10). |
| +- Cite `instancectl` (done). |
| +- Name `RenderEnv`'s file (done). |