notifier: alert email cannot fire on a real gateway — no contact writer, no SMTP env #369

Closed
opened 2026-08-09 19:59:38 +00:00 by ben · 2 comments
Owner

Found by the #183 rehearsal ratchet's Stage-0 exploration (spec
docs/superpowers/specs/2026-08-09-183-vps-rehearsal-ratchet-design.md). The
rehearsal's alert-email leg stays a named skip until this lands.

The notifier is external SMTP by design (ADR 0106, fixed sender
notify@mail.matou.nz — internal/notify/notify.go:30), but on a freshly
founded community it can never deliver:

  • nothing in production ever calls SetAlertContact
    (internal/monitor/monitor.go:615): founding does not seed it (the doc
    comment claims it does), and the dashboard client returns
    notYetServed('setAlertContact')
    (dashboard/src/lib/api/monitoringClient.ts:117)
  • the rendered gateway unit exports no OURCLOUD_SMTP_*
    (internal/clan/vmguest.go:185), so productionNotifier is nil and
    delivery is a silent no-op (control-plane/cmd/control-plane/main.go:92)

Ruling needed: where does a founded community's gateway get its submission
credentials for the Matou relay, and which surface writes the alert contact
(founding seed from the operator email, the dashboard, or both)?

Acceptance: given a founded community with an alert contact set, when a
CRITICAL alert raises, then the email arrives at the contact address from
notify@mail.matou.nz — proven by the rehearsal drive's alert-email leg
polling a test mailbox.

Found by the #183 rehearsal ratchet's Stage-0 exploration (spec `docs/superpowers/specs/2026-08-09-183-vps-rehearsal-ratchet-design.md`). The rehearsal's alert-email leg stays a named skip until this lands. The notifier is external SMTP by design (ADR 0106, fixed sender `notify@mail.matou.nz` — `internal/notify/notify.go:30`), but on a freshly founded community it can never deliver: - nothing in production ever calls `SetAlertContact` (`internal/monitor/monitor.go:615`): founding does not seed it (the doc comment claims it does), and the dashboard client returns `notYetServed('setAlertContact')` (`dashboard/src/lib/api/monitoringClient.ts:117`) - the rendered gateway unit exports no `OURCLOUD_SMTP_*` (`internal/clan/vmguest.go:185`), so `productionNotifier` is nil and delivery is a silent no-op (`control-plane/cmd/control-plane/main.go:92`) Ruling needed: where does a founded community's gateway get its submission credentials for the Matou relay, and which surface writes the alert contact (founding seed from the operator email, the dashboard, or both)? Acceptance: given a founded community with an alert contact set, when a CRITICAL alert raises, then the email arrives at the contact address from `notify@mail.matou.nz` — proven by the rehearsal drive's alert-email leg polling a test mailbox.
Author
Owner

Ruled (Ben, 2026-08-10) — ADR 0153; flipping ready-for-agent. Spec:
docs/superpowers/specs/2026-08-10-own-vps-carrier-design.md §4.

  1. Shared-while-alpha SMTP credential: one Matou-held submission
    credential, app-side config (never the repo) → sops clan var at founding →
    OURCLOUD_SMTP_ADDR/_FROM/_USERNAME/_PASSWORD rendered into the
    control-plane unit (vmguest.go, the mail.go DKIM pattern).
  2. OURCLOUD_CLAIM_SECRET rides the SAME render — one vars pipe closes
    ADR 0135/0136's identical gap and unblocks the #330 heartbeat.
  3. Founding seeds the alert contact from the S2 operator contact —
    SetAlertContact's first production caller, on the seed leg.

Follow-ups to file when closing this (not in scope): per-community credential
minting (needs a Matou provisioning endpoint; amends this back to 0106's
end-state), the dashboard contact editor
(monitoringClient.ts notYetServed('setAlertContact')).

Acceptance stands as written in the body, plus: the notifier's "resting" log
line is unreachable on a freshly founded community.

**Ruled (Ben, 2026-08-10) — ADR 0153; flipping ready-for-agent.** Spec: `docs/superpowers/specs/2026-08-10-own-vps-carrier-design.md` §4. 1. **Shared-while-alpha SMTP credential**: one Matou-held submission credential, app-side config (never the repo) → sops clan var at founding → `OURCLOUD_SMTP_ADDR/_FROM/_USERNAME/_PASSWORD` rendered into the control-plane unit (`vmguest.go`, the mail.go DKIM pattern). 2. **`OURCLOUD_CLAIM_SECRET` rides the SAME render** — one vars pipe closes ADR 0135/0136's identical gap and unblocks the #330 heartbeat. 3. **Founding seeds the alert contact** from the S2 operator contact — `SetAlertContact`'s first production caller, on the seed leg. Follow-ups to file when closing this (not in scope): per-community credential minting (needs a Matou provisioning endpoint; amends this back to 0106's end-state), the dashboard contact editor (`monitoringClient.ts` `notYetServed('setAlertContact')`). Acceptance stands as written in the body, plus: the notifier's "resting" log line is unreachable on a freshly founded community.
Author
Owner

Done (own-VPS T4, ADR 0153 §4) — landed in 57ac469, on origin/main.

The alert path can now fire on a founded community. The two gaps the issue named are closed:

  1. SetAlertContact now has a production caller. The control-plane whole composition seeds the monitor at boot from OURCLOUD_ALERT_CONTACT_EMAIL/_NAME (whole_composition.go, productionAlertContact in main.go) — SetAlertContact's FIRST production caller. Founding seeds it from the S2 operator contact (internal/founding/privatepath.go sets GatewayFacts.AlertContactEmail = draft.Details.Operator.Email); an unreachable contact stays the honest count-0 (ADR 0100).
  2. The gateway unit exports the submission credential. internal/clan/vmguest.go renders OURCLOUD_SMTP_ADDR/_FROM/_USERNAME/_PASSWORD + OURCLOUD_CLAIM_SECRET from clan-var paths ($(cat ${gen.path}), the mail.go DKIM pattern), flag-gated on GatewayFacts.SMTPSubmission/ClaimSecret. The alert contact rides environment.etc + $(cat) (the kanidm-path pattern), nixEscape'd once for its Nix string.

Split from the carrier (T2, #368): the loopback/private path has no external relay, so it seeds only the contact — SMTP/claim stay dormant (productionNotifier rests at its honest no-op). The own-VPS carrier sets the flags and FEEDS the alpha credential + claim secret into the ourcloud-smtp-* / ourcloud-claim-secret generators on its seed leg (the exported generator-name constants are the render↔feed contract).

Verified: render-seam tests both paths (internal/clan/vmguest_test.go), boot-seed tests over the whole composition (control-plane/cmd/control-plane/compose_alertcontact_test.go), and the nix eval smoke GREEN with the contact render (the gateway machine's toplevel evaluates). Full acceptance (email arrives at the contact) is proven by the rehearsal drive's alert-email leg (T5, #368), which this unblocks.

Follow-ups filed (ADR 0153, out of scope): #386 per-community credential minting, #387 the dashboard setAlertContact editor.

Done (own-VPS T4, ADR 0153 §4) — landed in `57ac469`, on origin/main. **The alert path can now fire on a founded community.** The two gaps the issue named are closed: 1. **`SetAlertContact` now has a production caller.** The control-plane whole composition seeds the monitor at boot from `OURCLOUD_ALERT_CONTACT_EMAIL/_NAME` (`whole_composition.go`, `productionAlertContact` in `main.go`) — SetAlertContact's FIRST production caller. Founding seeds it from the S2 operator contact (`internal/founding/privatepath.go` sets `GatewayFacts.AlertContactEmail = draft.Details.Operator.Email`); an unreachable contact stays the honest count-0 (ADR 0100). 2. **The gateway unit exports the submission credential.** `internal/clan/vmguest.go` renders `OURCLOUD_SMTP_ADDR/_FROM/_USERNAME/_PASSWORD` + `OURCLOUD_CLAIM_SECRET` from clan-var paths (`$(cat ${gen.path})`, the mail.go DKIM pattern), flag-gated on `GatewayFacts.SMTPSubmission`/`ClaimSecret`. The alert contact rides `environment.etc` + `$(cat)` (the kanidm-path pattern), nixEscape'd once for its Nix string. **Split from the carrier (T2, #368):** the loopback/private path has no external relay, so it seeds only the contact — SMTP/claim stay dormant (`productionNotifier` rests at its honest no-op). The own-VPS carrier sets the flags and FEEDS the alpha credential + claim secret into the `ourcloud-smtp-*` / `ourcloud-claim-secret` generators on its seed leg (the exported generator-name constants are the render↔feed contract). **Verified:** render-seam tests both paths (`internal/clan/vmguest_test.go`), boot-seed tests over the whole composition (`control-plane/cmd/control-plane/compose_alertcontact_test.go`), and the `nix eval` smoke GREEN with the contact render (the gateway machine's toplevel evaluates). Full acceptance (email arrives at the contact) is proven by the rehearsal drive's alert-email leg (T5, #368), which this unblocks. **Follow-ups filed (ADR 0153, out of scope):** #386 per-community credential minting, #387 the dashboard `setAlertContact` editor.
ben closed this issue 2026-08-10 03:11:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#369
No description provided.