carlos / platform Public

email: per-app submission switch, its door and its preconditions

Task 6 of the platform mail submission plan, with Paul's 2026-11-13
rulings on G3, G4, G6, G9 and G10 recorded in the plan.

The switch: `carlos email submission on|off --app <a>`, door
POST /api/cli/apps/{account}/{app}/email/submission (admin). On refuses,
409 with its remedy, unless the app's mail is declared and enabled, its
prefix ends in _SMTP, the deployment has SES event ingest and every
granted domain a configuration set, every instance record's route is
reported by a fresh box running a build that declares `--mail submit`,
every channel the records follow heads one, a tenant-attributed
sender's identities and configuration sets are associated with the
tenant (G8, via the provisioner's ListTenantResources), and every box
hosting the app has its mailer armed (G6). Then mail.SwitchOn, a serial
bump and an app-wide restart. Off re-mints through Enable.

Delivery: switched bundles hold no <P>_SMTP_* and no AWS key, only
TrimSuffix(EnvPrefix, "_SMTP") + "_MAIL_FROM" (CARLOS_MAIL_FROM,
TITO_MAIL_FROM; never CARLOS_SMTP_MAIL_FROM), in the default bundle and
every owned environment, including one created after the flip
(mintOwnedEnvironmentMail checks the switch explicitly and calls
DeliverMailFromIn). Release removes it. Enable delivers nothing while
switched; Rotate and EnableEnvironment refuse. The app-level user is
kept for the overlap week and reaped by the hourly grace pass once G4
holds (7 days on, a mailer send, no app_user send for 7 days).

While on, every console door that changes what a route serves refuses
an undeclared build ("switch submission off first"), pinned by
TestSubmissionGateCoversEveryServeDoor and its second-door guard; a wake
is never refused, the agent logs and emits an event instead. The
release manifest gains `mail` (`carlos ship --mail submit`, echo-checked;
refused for rootfs for now). The mailer_unarmed alert flags a box that
hosts a switched app's route with no armed mailer. Status and
`carlos email status` gain a submission block.

Also fixes the branch's red CI since Task 3: `mailer` is now a pinned
top-level word, and the CLI golden is re-recorded (Linux) with the
mailer, email submission and ship --mail cases. Copy is a DRAFT record
(platform-mail-submission-copy.json) awaiting Paul's review. Census:
Task 6 claims and the record-write census layer updated, overlay
re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev ad3a0f289fcbbcacc3fa22b10e450009b803d171 parent 903aa01
59 files changed, +4,726 −74
  • apimode.go +8 −1
  • approved_platform_mail_submission_copy_test.go +39 −0
  • cli.go +8 −1
  • commands_test.go +2 −0
  • docs/mailer-runbook.md +4 −3
  • docs/parity.md +4 −2
  • docs/site/cli.md +17 −0
  • docs/superpowers/notes/census-claims-platform-mail-submission.tsv +7 −1
  • docs/superpowers/notes/census-proposal-platform-mail-submission.md +12 −5
  • docs/superpowers/plans/2026-11-13-platform-mail-submission.md +5 −5
  • docs/superpowers/plans/platform-mail-submission-copy.json +247 −0
  • internal/activator/backend_exec.go +18 −0
  • internal/activator/mailbuild.go +59 −0
  • internal/activator/mailbuild_test.go +199 −0
  • internal/activator/rootfs.go +1 −0
  • internal/console/alertmailer_test.go +183 −0
  • internal/console/alertnotify.go +9 −0
  • internal/console/alertpages.go +2 −1
  • internal/console/alertsignals.go +206 −5
  • internal/console/apicli.go +34 −1
  • internal/console/apiinstances.go +12 −0
  • internal/console/apimail.go +44 −0
  • internal/console/apiship_mail_test.go +67 −0
  • internal/console/apisubmission.go +429 −0
  • internal/console/apisubmission_test.go +365 −0
  • internal/console/apiupdates.go +4 −0
  • internal/console/channelmove.go +7 −0
  • internal/console/pendinghandlers.go +4 −1
  • internal/console/plangracepass.go +6 −0
  • internal/console/routedecls.go +1 −0
  • internal/console/server.go +10 −2
  • internal/console/submissioncopy.go +41 −0
  • internal/console/submissiongate.go +263 −0
  • internal/console/submissiongate_test.go +662 −0
  • internal/console/teamcreds.go +11 −2
  • internal/console/teamcreds_test.go +2 −1
  • internal/console/updatescore.go +6 −0
  • internal/host/agent.go +6 −0
  • internal/mail/aws.go +33 −0
  • internal/mail/memprovisioner.go +18 −0
  • internal/mail/submission.go +419 −0
  • internal/mail/submission_test.go +567 −0
  • internal/mail/sweep.go +104 −0
  • internal/mail/walk.go +16 −0
  • internal/mail/walk_environment.go +25 −10
  • internal/provision/platform_mail_submission_census_test.go +34 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv +17 −9
  • internal/release/manifest_mail_test.go +119 −0
  • internal/release/release.go +23 −0
  • mail_cli.go +133 −1
  • mail_cli_test.go +1 −1
  • parity/cli.tsv +2 −0
  • parity/parity.tsv +1 −0
  • ship_mail.go +41 −0
  • ship_mail_test.go +129 −0
  • ship_rootfs.go +1 −1
  • ship_rootfs_test.go +1 −0
  • testdata/clireg-golden.jsonl +37 −20

CI cancelled — superseded by a newer push — run details

apimode.go

Loading diff…

approved_platform_mail_submission_copy_test.go

Loading diff…

cli.go

Loading diff…

commands_test.go

Loading diff…

docs/mailer-runbook.md

Loading diff…

docs/parity.md

Loading diff…

docs/site/cli.md

Loading diff…

docs/superpowers/notes/census-claims-platform-mail-submission.tsv

Loading diff…

docs/superpowers/notes/census-proposal-platform-mail-submission.md

Loading diff…

docs/superpowers/plans/2026-11-13-platform-mail-submission.md

Loading diff…

docs/superpowers/plans/platform-mail-submission-copy.json

Loading diff…

internal/activator/backend_exec.go

Loading diff…

internal/activator/mailbuild.go

Loading diff…

internal/activator/mailbuild_test.go

Loading diff…

internal/activator/rootfs.go

Loading diff…

internal/console/alertmailer_test.go

Loading diff…

internal/console/alertnotify.go

Loading diff…

internal/console/alertpages.go

Loading diff…

internal/console/alertsignals.go

Loading diff…

internal/console/apicli.go

Loading diff…

internal/console/apiinstances.go

Loading diff…

internal/console/apimail.go

Loading diff…

internal/console/apiship_mail_test.go

Loading diff…

internal/console/apisubmission.go

Loading diff…

internal/console/apisubmission_test.go

Loading diff…

internal/console/apiupdates.go

Loading diff…

internal/console/channelmove.go

Loading diff…

internal/console/pendinghandlers.go

Loading diff…

internal/console/plangracepass.go

Loading diff…

internal/console/routedecls.go

Loading diff…

internal/console/server.go

Loading diff…

internal/console/submissioncopy.go

Loading diff…

internal/console/submissiongate.go

Loading diff…

internal/console/submissiongate_test.go

Loading diff…

internal/console/teamcreds.go

Loading diff…

internal/console/teamcreds_test.go

Loading diff…

internal/console/updatescore.go

Loading diff…

internal/host/agent.go

Loading diff…

internal/mail/aws.go

Loading diff…

internal/mail/memprovisioner.go

Loading diff…

internal/mail/submission.go

Loading diff…

internal/mail/submission_test.go

Loading diff…

internal/mail/sweep.go

Loading diff…

internal/mail/walk.go

Loading diff…

internal/mail/walk_environment.go

Loading diff…

internal/provision/platform_mail_submission_census_test.go

Loading diff…

internal/provision/testdata/plan14-root-reads-chain.tsv

Loading diff…

internal/provision/testdata/plan14-root-reads-platform-mail-submission.tsv

Loading diff…

internal/release/manifest_mail_test.go

Loading diff…

internal/release/release.go

Loading diff…

mail_cli.go

Loading diff…

mail_cli_test.go

Loading diff…

parity/cli.tsv

Loading diff…

parity/parity.tsv

Loading diff…

ship_mail.go

Loading diff…

ship_mail_test.go

Loading diff…

ship_rootfs.go

Loading diff…

ship_rootfs_test.go

Loading diff…

testdata/clireg-golden.jsonl

Loading diff…