feat: phase (a) part 2 - templates, branding, PHI rules, home #7

Merged
KofTwentyTwo merged 7 commits from feature/phase-a-templates into develop 2026-10-14 12:34:04 +00:00
KofTwentyTwo commented 2026-10-14 02:07:04 +00:00 (Migrated from github.com)

Phase (a) part 2 of docs/DESIGN.md (sections 2.1, 5, 7, 10). Stacked on #6 (its commits show until #6 merges).

  • Variable engine: {{name}}, dotted paths, always escaped; {{#if}}, {{#each}} with {{this}}/{{@index}}; {{name|fallback}}; parse errors with line numbers; unknown variables fail activation.
  • Schemas: typed variables with classification and optional table/field binding; built-ins (brand.*, message.id, unsubscribe_url, now).
  • Rendering: commonmark (GFM tables, autolink, raw HTML escaped), {.button} bulletproof buttons, a table-based responsive layout with color-scheme, dark-mode media query and Outlook selectors, dark logo, footer rules per category; WCAG AA contrast checks in light and dark; generated plain text. HTML and MJML kinds (MJML through MjmlCompilerInterface / CliMjmlCompiler, stdin/stdout only).
  • Versions: ACTIVE/RETIRED are read-only; New Version, Activate Version (schema, sample render, PHI, MJML, contrast) and Approve For PHI (admin, bound to the approved version) record actions; per-template edit permission.
  • Templated sends: locale and brand resolution; withRecordVariable reads as the sending user.
  • PHI: classification stand-in EmailClassifications (STAND-IN core #1142); PII/PHI refused unless approved; approved templates refuse MARKETING, tracking and non-phi_allowed providers; built-in email_secure_message; snapshots tokenized with EmailValueTokens (STAND-IN core #1161, secured-data §14.5 bindings); PHI subjects and bodies AES-256-GCM encrypted and shown as [encrypted].
  • Canary-PHI egress test over EmailService, the process, the bridge, retry, dead letter, queries, the home and captured logs.
  • Preview widget on versions (inline light and dark samples and plain text; Next strips iframes). The /qqq/v1/qbit/email/preview endpoint waits for RC.6.
  • Home: standard widgets with real counts (24 h/7 d), sends per hour, suppression growth, provider health, recent messages with masked recipients.
  • Contingent possible values: template → active version and message template → version, tested.

Tests: 71 in total with #6, all green; Checkstyle clean; JaCoCo above the gate (part 2 alone reported 92.3% instructions / 100% classes).

🤖 Generated with Claude Code

Phase (a) part 2 of `docs/DESIGN.md` (sections 2.1, 5, 7, 10). Stacked on #6 (its commits show until #6 merges). - **Variable engine:** `{{name}}`, dotted paths, always escaped; `{{#if}}`, `{{#each}}` with `{{this}}`/`{{@index}}`; `{{name|fallback}}`; parse errors with line numbers; unknown variables fail activation. - **Schemas:** typed variables with classification and optional table/field binding; built-ins (`brand.*`, `message.id`, `unsubscribe_url`, `now`). - **Rendering:** commonmark (GFM tables, autolink, raw HTML escaped), `{.button}` bulletproof buttons, a table-based responsive layout with `color-scheme`, dark-mode media query and Outlook selectors, dark logo, footer rules per category; WCAG AA contrast checks in light and dark; generated plain text. HTML and MJML kinds (MJML through `MjmlCompilerInterface` / `CliMjmlCompiler`, stdin/stdout only). - **Versions:** ACTIVE/RETIRED are read-only; New Version, Activate Version (schema, sample render, PHI, MJML, contrast) and Approve For PHI (admin, bound to the approved version) record actions; per-template edit permission. - **Templated sends:** locale and brand resolution; `withRecordVariable` reads as the sending user. - **PHI:** classification stand-in `EmailClassifications` (STAND-IN core #1142); PII/PHI refused unless approved; approved templates refuse MARKETING, tracking and non-`phi_allowed` providers; built-in `email_secure_message`; snapshots tokenized with `EmailValueTokens` (STAND-IN core #1161, secured-data §14.5 bindings); PHI subjects and bodies AES-256-GCM encrypted and shown as `[encrypted]`. - **Canary-PHI egress test** over EmailService, the process, the bridge, retry, dead letter, queries, the home and captured logs. - **Preview widget** on versions (inline light and dark samples and plain text; Next strips iframes). The `/qqq/v1/qbit/email/preview` endpoint waits for RC.6. - **Home:** standard widgets with real counts (24 h/7 d), sends per hour, suppression growth, provider health, recent messages with masked recipients. - **Contingent possible values:** template → active version and message template → version, tested. Tests: 71 in total with #6, all green; Checkstyle clean; JaCoCo above the gate (part 2 alone reported 92.3% instructions / 100% classes). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.