F3 of the go-live plan, registry side. Stacked on #34 (documents) and #33.
Document published → mail to members with IT_ADMIN, OWNER, CXO, FINANCE or LEGAL (the roles that see Documents), linking to PORTAL_URL/<slug>/documents.
POST /v1/notifications (new route group notify, meant for pruefwerk-svc-*): {tenant_id, kind: findings.new, idempotency_key, data: {target_name, new_count, critical, high, medium, low, url}} → mail to IT_ADMIN, OWNER, CXO, LEGAL. Inputs are clamped, and the url must be https.
Demo tenants and tenants without an organization get nothing. Disabled members and USER never get mail.
mail_outbox (migration 0009): one row per recipient, idempotent per key+recipient, rendered at send time. Worker every 20 s with backoff 1 m → 6 h; parked after 12 attempts with the error kept.
internal/mail: SMTP with STARTTLS (587) or TLS (465). multipart/alternative text + HTML, UTF-8 quoted-printable, Auto-Submitted. Embedded German (default) and English templates in one BreakPilot layout: table-based, inline CSS, violet button, Impressum and Datenschutz in the footer.
Config: SMTP_HOST/PORT/USER/PASSWORD, MAIL_FROM (noreply@breakpilot.com), MAIL_FROM_NAME, PORTAL_URL. Without SMTP_HOST, mail queues unsent.
Not in this PR: per-user opt-out (every mail says why the person receives it) and the recipient's own locale (German for everyone for now).
Tests: both stores. Recipients by role, demo and org-less tenants, idempotent repeats, validation, retry after backoff, template escaping and MIME round-trip.
F3 of the go-live plan, registry side. **Stacked on #34** (documents) and #33.
- **Document published** → mail to members with IT_ADMIN, OWNER, CXO, FINANCE or LEGAL (the roles that see *Documents*), linking to `PORTAL_URL/<slug>/documents`.
- **`POST /v1/notifications`** (new route group `notify`, meant for `pruefwerk-svc-*`): `{tenant_id, kind: findings.new, idempotency_key, data: {target_name, new_count, critical, high, medium, low, url}}` → mail to IT_ADMIN, OWNER, CXO, LEGAL. Inputs are clamped, and the url must be https.
- Demo tenants and tenants without an organization get nothing. Disabled members and `USER` never get mail.
- **`mail_outbox`** (migration 0009): one row per recipient, idempotent per key+recipient, rendered at send time. Worker every 20 s with backoff 1 m → 6 h; parked after 12 attempts with the error kept.
- **`internal/mail`**: SMTP with STARTTLS (587) or TLS (465). `multipart/alternative` text + HTML, UTF-8 quoted-printable, `Auto-Submitted`. Embedded **German (default) and English** templates in one BreakPilot layout: table-based, inline CSS, violet button, Impressum and Datenschutz in the footer.
- Config: `SMTP_HOST/PORT/USER/PASSWORD`, `MAIL_FROM` (noreply@breakpilot.com), `MAIL_FROM_NAME`, `PORTAL_URL`. Without `SMTP_HOST`, mail queues unsent.
Not in this PR: per-user opt-out (every mail says why the person receives it) and the recipient's own locale (German for everyone for now).
Tests: both stores. Recipients by role, demo and org-less tenants, idempotent repeats, validation, retry after backoff, template escaping and MIME round-trip.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
A new route group "admin" (the portal's service client only) serves
the staff admin area: tenant search with 30-day usage and last
activity, one detail call with entitlements, subscriptions, licences,
members and recent audit, trial extension (moves trial entitlements
with it and reopens a trial that expired into read-only), invite
resend, and the audit log across tenants.
Changes made from the admin area are audited under the staff member
the portal names in X-Staff-Subject / X-Staff-Email; the header only
counts from a client that holds the admin group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Staff upload a file for a tenant as a draft (streamed to an S3 bucket,
hashed on the way, never buffered whole), publish it, or delete it;
the tenant lists its published documents and gets a five-minute
presigned download link. Uploads, publications and downloads are
audited, a download under the person the portal names.
Migration 0008 adds the documents table; internal/storage wraps
minio-go (Hetzner Object Storage, the bucket is created in its
region when missing). Without DOCUMENTS_S3_* the routes answer 503
and the rest of the registry is unaffected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Publishing a document now mails the workspace members who may read
documents, and products can POST /v1/notifications (route group
"notify") to report new findings, which reach IT_ADMIN, OWNER, CXO
and LEGAL. Demo tenants and tenants without an organization get
nothing.
Every mail is a mail_outbox row (migration 0009), one per recipient,
idempotent per key, sent by a worker with backoff and parked with its
error after twelve attempts. Messages are rendered when sent from
embedded German and English templates in the BreakPilot layout, as
multipart text + HTML, through the SMTP relay (SMTP_*).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
CODEOWNERS rules
requested review from Benjamin_Boenisch 2026-09-23 17:45:16 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
F3 of the go-live plan, registry side. Stacked on #34 (documents) and #33.
PORTAL_URL/<slug>/documents.POST /v1/notifications(new route groupnotify, meant forpruefwerk-svc-*):{tenant_id, kind: findings.new, idempotency_key, data: {target_name, new_count, critical, high, medium, low, url}}→ mail to IT_ADMIN, OWNER, CXO, LEGAL. Inputs are clamped, and the url must be https.USERnever get mail.mail_outbox(migration 0009): one row per recipient, idempotent per key+recipient, rendered at send time. Worker every 20 s with backoff 1 m → 6 h; parked after 12 attempts with the error kept.internal/mail: SMTP with STARTTLS (587) or TLS (465).multipart/alternativetext + HTML, UTF-8 quoted-printable,Auto-Submitted. Embedded German (default) and English templates in one BreakPilot layout: table-based, inline CSS, violet button, Impressum and Datenschutz in the footer.SMTP_HOST/PORT/USER/PASSWORD,MAIL_FROM(noreply@breakpilot.com),MAIL_FROM_NAME,PORTAL_URL. WithoutSMTP_HOST, mail queues unsent.Not in this PR: per-user opt-out (every mail says why the person receives it) and the recipient's own locale (German for everyone for now).
Tests: both stores. Recipients by role, demo and org-less tenants, idempotent repeats, validation, retry after backoff, template escaping and MIME round-trip.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB