catalogue: mail-port — the mail service ships its full port ((software undecided)) #229
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Depends on
Reference
Matou/idss#229
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
Arc seed #223 (split confirmed by Ben, 2026-07-30) — the
mailcatalogue service ships its port. Template: the files-port ticket #220. Enriched by/to-spec2026-07-31 from the gate-confirmed mail design tier: the mail grill (2026-07-30/31, both gates confirmed by Ben — ADR 0115 transport, ADR 0116 identity/software, DDR 0117 mailbox lifecycle; commitc378fce), the flowdocs/ux/flows/mail.mermaid, and the confirmed wireframe setdocs/ux/wireframes/mail/(five screens, Ben-confirmed in-browser; commite1e4ddf).Problem Statement
A community's members have no mail of their own: their addresses live with the very providers the community founded an OurCloud to leave, and every message transits someone else's machines. The operator can't offer
name@their-own-domainmail without becoming a mail admin — records, deliverability, reverse DNS — a skill bar far above the P1 persona. And self-hosted mail's classic failure is silent: everything looks deployed while outbound lands in spam folders and nobody is told. Todaymailis a slug of intent in the catalogue — no module, no reconciler, no health check — and under ADR 0112 it cannot activate vacuously.Solution
Full member mailboxes on the community's own fleet, honest about what provably works. Outbound is direct — no third party sees members' mail — but gated by a mail-readiness preflight (port-25 egress, PTR match, not-CGNAT); inbound and client traffic enter at the gateway, which grows 25/587/465/993 TCP-proxied over the mesh (MX at the apex) — ADR 0115. Records are set automatically on a matou.nz name (broker record CRUD) or presented as an honest second registrar visit on an own domain (copy-paste + per-record verification poll — amends ADR 0014). A red leg is a named standing state on the service ("can receive, can't send reliably" / "records not verified — can't receive yet"), never a silent spam-folder. The mail service stores no identity: accounts resolve live from kanidm, webmail (Roundcube) consumes OIDC, mail clients use IdP-minted app passwords; Stalwart backs the port — ADR 0116. The mailbox itself is opt-in: claimed from the portal at the member's fixed folded-slug address, held (not bounced) while suspended, archived on offboard, and its address is never reissued — DDR 0117. The five wireframes are the UI contract.
User Stories
Operator — provisioning & mail readiness (MAIL-S1,
mail-s1-mail-readiness.html)mailin P4, When the deploy runs, Then assess and impact run as for any service and the deploy pauses at Mail readiness — records + sending preflight — and cannot complete until the health gate resolves.<slug>.matou.nzname, I want the mail records set automatically, so that I never see DNS. (MAIL-S1 records edge, broker CRUD ADR 0049/#221)Operator — degraded, named, standing (MAIL-S1x,
mail-s1x-degraded-named-standing.html)Member — claiming a mailbox (MAIL-M1/M2/M2x)
mail-m1-no-mailbox-yet.html; DDR 0117)<folded-slug>@<apex>), honest copy that nothing is being received for me, and one action: claim.mail-m2-claim-your-mailbox.html; ADR 0029, DDR 0117)mail-m2x-claim-refused.html; ADR 0074, the P6-S3x pattern)Member — using mail (MAIL-M3/M4, external doors)
Lifecycle — held, archived, never reissued (DDR 0117)
<slug>@<apex>, When any later person joins or claims, Then that address can never be assigned to them — binding on the IdP too (the slug is not re-mintable for a new person while the community lives).The port contract (ADR 0062 + the port-declared parts)
mailstops being a slug of intent. (#220's proven template)mail, Then webmail serves atmail.<apex>from the hostname authority, behind the identity-aware ingress (forward_auth); the client protocols (IMAP/submission at the gateway TCP layer) are declared as the port's exempt/credential-class surface, covered by app passwords and the credential sweep.Implementation Decisions
internal/mailsvc, built on theinternal/nextcloudtemplate — the port package exposing the orbit ServicePort (claim/hold/archive + offboard fates) and the real send/receive health check. One seam; no new orchestrator — the member orbit and provisioning drive it.mailentry stays helper-role and not-NeedsPublic (ADR 0115).docs/ux/wireframes/mail/,data-field/data-action/data-statusare the stable element IDs): MAIL-S1/S1x extend the P4 dashboard world; MAIL-M1/M2/M2x are member-portal screens; MAIL-M3 (Roundcube) and MAIL-M4 (kanidm self-service) are external doors — linked to, never built as OurCloud screens.Testing Decisions
mailsvc's verbs and observes converged service state; the health check proves a real send/receive loop.provision_brand_health_test.goprecedent — assignmail, deploy through the whole composition, health gate resolves, named states stand and clear; fakes for Stalwart's management API and the readiness legs at the seam boundary (fakes are the testing seam's instrument, never production — ADR 0100).smoke-mailvialab-dns(the smoke-* precedent) — real records onclan-lab.matou.nz, real Stalwart deploy, the send/receive loop and at least one degraded-leg → named-state → clear cycle on real infrastructure.internal/enrollwire's integration-test shape for wire-level faces, and the member-orbit reconciler tests for verb convergence.Out of Scope
Confirmed scope-outs of the mail grill: shared/komiti addresses and aliases; mailing lists; CalDAV/CardDAV; import/migration from old providers; quota configuration UI (fixed sane default); catch-all addresses; custom localpart. Also out: a smarthost/relay path (later opt-in ticket), any Matou-side mail (ADR 0106's alert path is separate), and deleting mail data in any form (v1 never deletes — DDR 0117/ADR 0075).
Further Notes
mailnames a "no health check declared" fault — this spec closes that honestly rather than vacuously.design-verifychecks the shipped UI against the five wireframes; the held/archived states deliberately have no member screens (operator-side P6 member detail carries them).Task manifest
Blocks
Nothing — last in the confirmed order (#218→#219→#220→children).
Grilled — 2026-07-30/31, both gates confirmed by Ben (commit
c378fce). The design tier this ticket was blocked on now exists:docs/ux/flows/mail.mermaid(MAIL-S1/S1x operator readiness; MAIL-M1/M2/M2x/M3/M4 member journey). CONTEXT.md: Mailbox / Mail readiness / App password + mail object-states.internal/mailsvcon theinternal/nextcloudtemplate (orbit ServicePort + real send/receive health check); a mail-readiness adapter in the founding-adapters family withsmoke-mailvialab-dns; the composition seam test extended perprovision_brand_health_test.go.needs-designstays until the wireframe session lands the five screens (MAIL-S1, S1x, M1, M2, M2x — M3/M4 are external doors), then/to-specenriches this ticket and it re-armsready-for-agent.Wireframed — 2026-07-31, confirmed by Ben in-browser (commit
e1e4ddf). The five screens fromdocs/ux/flows/mail.mermaidare now the mail UI contract, indocs/ux/wireframes/mail/(README index updated):mail-s1-mail-readiness.html— the readiness step P4 gains when mail is selected: the four records as copy-paste values with founding-S10's per-record verification poll (own domain = the honest second registrar visit, ADR 0115; on a matou.nz name the broker sets them and only the checks show) + the sending preflight (port-25 egress / PTR / not-CGNAT).mail-s1x-degraded-named-standing.html— the standing named states on the p4-s5x skeleton: can receive, can't send reliably (drawn, with evidence + plain advice) and records not verified — can't receive yet (labelled variant, shell-au precedent); stands in chrome + Services, clears itself on a green re-run.mail-m1-no-mailbox-yet.html— opt-in empty state showing the address that would be theirs (mere@example.nz, folded slug at the apex — DDR 0117 / ADR 0029).mail-m2-claim-your-mailbox.html— claiming as one act at the fixed address; localpart choice / quota / aliases documented as deliberate absences.mail-m2x-claim-refused.html— refused at the gate, unexplained on screen (the p6-s3x pattern); held/archived surface operator-side via P6 member detail, never as member screens.MAIL-M3 (Roundcube webmail) and MAIL-M4 (kanidm self-service app passwords) are external doors — linked to, never drawn. No new DDR was needed; every layout call follows an existing ruling.
needs-designstays — next session runs/to-specto enrich this ticket and re-arm itready-for-agent.Specced — 2026-07-31 (
/to-spec, the design-tier close-out). The ticket body is now the full child spec synthesized from the mail design tier: 24 user stories with Given/When/Then acceptance criteria sourced fromdocs/ux/flows/mail.mermaidand the five confirmed wireframes, the confirmed seam (internal/mailsvcon the nextcloud template + a mail-readiness adapter in the founding-adapters family), testing decisions (composition seam test perprovision_brand_health_test.go+smoke-mailvialab-dns), and the grill's scope-outs.needs-design→ready-for-agent. The native dependency on #220 (files-port) stands, so this enters the frontier when #220 closes. The mail design tier — grill (c378fce) → wireframes (e1e4ddf) → spec — is complete.Backend port core landed on main (commit
b13fb81) — the ticket is over-scoped for one slice; a scope decision is needed to close it.The mail-port backend port core is merged and green (
go build/vet/test+ golangci-lint across the tree):internal/clan/mail.go+mail_attach.go—RenderMail/AttachMail: the Stalwart+Roundcubemail.nix(SMTP+IMAP+JMAP one binary, ed25519 DKIM, LDAP directory → kanidm so accounts resolve live and no person is stored in mail — ADR 0116; Roundcube over OIDC; all secrets via clan vars; the node opens no public port). Webmail hostmail.<apex>and the mail domain derived from the ONE hostname authority (ADR 0113); the StalwartdataDiris the declared Mail dataset (ADR 0080). Node-only, idempotent, missing-apex refused — the #220 shape.internal/clan/frontdoor.go(+attach) — ADR 0115 / AC20: the gateway grows[ 80 443 25 465 587 993 ]and TCP-proxies each mail port over the mesh to the mail node (Caddy layer4) only when mail is provisioned; absent mail only 80/443 stand.internal/mailsvc— a realmemberorbit.ServicePort(Service=mail) over Stalwart's management API implementing the DDR 0117 lifecycle:Claim(opt-in birth at the fixed folded-slug address, idempotent, never re-mints), hold on suspend (receiving continues, nothing bounces), release, archive on offboard (disabled-kept-in-place, ADR 0075), reassign refused (never reissued), RoleMapping front-door-only. Contract-tested vs a faithful Stalwart double.control-planemailHealthCheck— a real functional Stalwart/healthzpipeline probe (SMTP+IMAP listeners + kanidm directory, never a liveness ping — ADR 0062/0116), registered in the shared registry, wired via the derivedhttps://mail.<apex>URL intoproductionServicePorts+composeOffboardCatalogue.Expect(mail). Seam-tested perprovision_brand_health_test.go.internal/mailreadiness— joins the founding-adapters family (#193/#194 injected-I/O, no-fake-in-path): the record poll (MX/SPF/DKIM/DMARC) + the sending preflight (port-25 egress / PTR / not-CGNAT) fold to the named standing statesrecords-not-verified/can-receive-cant-send/active(the S1x tokens); advice never veto (ADR 0015).Decision needed (raised to Mattermost 2026-08-01; no reply within the window, so this durable record +
ready-for-human). Rule 2b means #229 cannot close without the five wireframe screens, and there is a live-infra tier. The remainder is ~3 further slices that shouldn't be crammed into one iteration:SetupSurfacedeploy-gate (the readiness step must pause the deploy — a real provision-flow integration). Member M1/M2/M2x are a net-new member-portal surface — no member portal exists in the repo yet (only the/haere-maijoin-surface precedent indashboard/src/entry/join.ts), so they need a new/mailboot + routing + SPA fallback + a/api/mailHTTP vertical (claim/status).smoke-mail(real send/receive loop + a degraded-leg → named-state → clear cycle).For context: the files service got the equivalent across #204/#213/#218/#219/#220/#251 plus its screens — #229 conflates that whole arc.
My recommendation: close #229 on the landed backend core and split the UI screens +
smoke-mail+ kanidm-verify into follow-up tickets (the exact deferral precedent files-port #220 set with its smoke). Alternatively, keep #229 open and re-armready-for-agentfor the UI+smoke to land under this number in follow-up iterations. Either way the backend core is on main and nothing is lost. A late Mattermost reply resumes the same thread.Ben ruled (2026-08-06, ready-for-human sweep): close on the landed backend core, split the remainder — the files-port precedent, as recommended.
Follow-ups filed, each
ready-for-agent:smoke-mail(lab send/receive loop + degraded-state cycle)The mail design tier (grill
c378fce→ wireframese1e4ddf→ spec) remains the contract for all three. Closing.