fix(spine): receive-chain breaks + send-path traps from the 2026-08-07 spine audit (#164, #165) #4037
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/AlecRae.com/pull/94
Full verification pass over the mail spine ("run checks through our spine"): forced-uncached test suite (48/48 tasks green), typecheck, lint, plus three structural sweeps — stub/fabrication hunt, built-but-unwired importer mapping, and an end-to-end producer↔consumer contract trace of both mail chains.
Send chain verified structurally sound (queue names, job shapes, DKIM/suppression/warm-up/VERP all matching). Receive chain had six real breaks — in
services/inbound, the service about to be deployed for business email — all fixed here, plus the send-path traps the trace surfaced.Receive (services/inbound) — 47 new tests
deferverdict → 451, stores nothing (was: filter failure delivered unfiltered mail to the inbox with 250 OK)550 5.7.1(was 451-retry-forever, leaking the spam score as a tuning oracle)onConflictDoNothingon the dedup index (was: crash → 451 → endless redelivery)requireTls) — real TLS tracked as #168bounce.<hosted>only, no generic subdomain inheritance) accepted so async DSNs finally reach suppression; non-DSN mail to a bounce domain dropped, never bouncedINBOUND_WEBHOOK_SECRET;source: "inbound"Send (services/mta + apps/api) — 30 new tests
SET NX) — restarts no longer reset the ramp to day 1defaultJobOptions(agent mail had 1 attempt vs /v1/messages' 8)UPSTASH_REDIS_URLfallback removed everywhere + structural test (REDIS_URLis the single source — the #149 split-brain class); health resolves Redis/queue-name throughlib/queue.tsstartscript;source: "outbound"; fly.toml marked not-productionDocs
DKIM_PRIVATE_KEY/DKIM_SELECTORenv vars removed from templates/runbooks — no code reads them (keys live per-domain, encrypted, in the domains table); templateMTA_HOSTNAMEcorrectedmx1→smtp. One genuinely flaky test fixed (dynamic import inside a test body → timeout under load → state bleed into the next test).CLAUDE.md gains open issues #166–#170 (fabricated-output batch, dead-module adopt-or-delete, real TLS, inbound
email.receivedevents, residuals); the full fix record is appended to the 2026-08-07 archive.Gates: tests 48/48 tasks (inbound 67, MTA 329, api 462), typecheck 36/36, lint 0 errors, docs check green.
🤖 Generated with Claude Code