~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Each email with an HTML part in the pages' look

Merged
Merged chadtmiller.com asked to merge into web/monolith-look from chadtmiller.com/monolith:email/html

Every email the server sends now carries an HTML part in the pages' Monolith look beside its plain text, from one template in web/ built with the pages' tokens. just look email <kind> draws it as the server sent it.

Claude Opus 5.5 · high

What changes

Spec. spec/EMAIL.md gains "The message": each email is multipart/alternative, text/plain then text/html. The HTML part holds the server's host (PDS_HOSTNAME), the kind's heading (a table of six), the token and the 15-minute note; nothing from the account or its request; every value escaped; it loads nothing. "How it is checked" names the new SMTP checks. spec/OAUTH-PAGES.md says the build also writes web/dist/email.html.

web. web/src/email/email.html: a table-laid template, styles on the elements, var(--x) and dark(--x) token references that a small Vite plugin in vite.config.ts writes in as values (rem as px) into web/dist/email.html. Dark through prefers-color-scheme with !important class rules; a phone size through max-width: 640px; Outlook conditional comments for a fixed column width and fallback fonts; detected links in the host drawn as plain text. One new token, --tracking-code. @types/node added as a dev dependency for the config's node:fs.

pds-server. build.rs embeds web/dist/email.html as TEMPLATE (a build without it fails, as without the rest of web/dist). email.rs: Purpose::heading, lead, html (slots filled, each value escaped); Smtp keeps PDS_HOSTNAME; send builds MultiPart::alternative_plain_html. Text part unchanged.

harness. lib/smtp.mjs partsOf; lib/mail.mjs holds each SMTP message to "The message": its type and parts' order, the token in each part, the host and heading in the HTML part's text, and no src, href or url(. lib/env.mjs exports HOSTNAME. look.mjs email <kind> starts an SMTP catcher, asks for the kind as alice would (confirming her email first for updateEmail and signInAuthFactor), and draws the HTML part.

Docs. web/AGENTS.md, the ui skill and the Justfile's look line.

Why

The emails were plain text, the one surface of the server not in its look. One hand-written template over Svelte SSR or MJML: page components do not carry into mail clients, and only the tokens need sharing, which the build does. The plain text part stays for clients that want it.

How it was checked

  • cargo test -p pds-server --lib email::tests::: 14 pass, among them smtp (now asserts multipart/alternative, text before HTML) and a new html (escaping, slots filled, none left).
  • node compare.mjs --steps 40 --seed 1 --only requestEmailConfirmation,passwordReset,emailFactor,requestEmailUpdate: passes. Planted bug: the HTML part filled with an empty host; the same run fails at step 1 with html.host: false against true. Put back.
  • npm run check 0/0; contrast.mjs 40 pairs ≥ 4.5:1; layers.mjs ok.
  • just look email <kind> for all six kinds; pictures below. A fresh-eye critique's findings were fixed (Outlook width and fonts, auto-linked host, the code wrapping and off centre, host size and gap, phone heading size, lead size, <h1>).

Shortcomings

  • Drawn in Chromium, not in mail clients: Outlook's conditional parts and Gmail's handling are from what those clients are known to do, not seen.
  • Dark reaches only clients that honour prefers-color-scheme (Apple Mail and few others); the rest show light or invert it themselves.
  • Typefaces are not loaded (by design): clients draw their system fonts.
  • The subjects stay the reference's title case ("Password Reset Requested"), as the spec holds them; the heading inside is sentence case.

Review

Stacked on the web/monolith-look pull; lands with the Monolith pulls. Start with spec/EMAIL.md, "The message", then web/src/email/email.html.

The reset-password email, desktop, light: host, heading, lead, the code in a panel, the note

The reset-password email on a phone in dark

The sign-in code email on a phone in light

Approved

This gives every email a text/html part after its text/plain one, as multipart/alternative, from one template built in web/. I read email.rs, build.rs, harness/lib/mail.mjs, spec/EMAIL.md and email.html. I did not read the rest of the diff: vite.config.ts, the other harness files (smtp.mjs, env.mjs, look.mjs), the web/ docs and skill, and OAUTH-PAGES.md. I ran nothing and did not check the runs.

  • Spec: spec/EMAIL.md ("The message", the heading table, the new SMTP checks) matches the code and the harness. HEADING in mail.mjs matches Purpose::heading.
  • Escaping: escape covers & < > " '. Slots hold only the host, fixed strings and the token, so nothing from the account or its request is drawn.
  • Loading: the template has no src, href or url(, so it passes the harness check.
  • Harness: the new check is stricter. It sets the text part against the HTML part and tests the token, host, heading and loaded resources.
  • Server code: no new crates, and nothing is taken from the reference or an SDK.
  • conformance.yaml: untouched.

Minor point, no change needed: html fills slots one after another, so a PDS_HOSTNAME that contained {{code}} would be re-filled. It is operator-set and harmless.

Approved

I read what changed since the approved commit. It adds just look email all, plus a just look-emails recipe that runs it, and updates the ui skill to match. look.mjs runs each kind in a child process, so each has its own server, and exits non-zero if any kind failed. spawn was already imported. set positional-arguments makes "$@" work in the look recipe. This touches nothing in server behaviour, spec/, or conformance.yaml, and no harness check is loosened. My earlier approval stands. I ran nothing.

Approved

Carried forward: the change this pull makes at c63bb23d0519e2605c221c35d2d147757eff08aa is the one reviewed at 4d8d914b69af2c428b1e342122a9277d5038a68a, so that review stands. What is new comes from its base.

Approved

Carried forward: the change this pull makes at acec0db21c3df5eeb65c2cc6cbd98520070748e8 is the one reviewed at c63bb23d0519e2605c221c35d2d147757eff08aa, so that review stands. What is new comes from its base.

Approved

Carried forward: the change this pull makes at 1e23cad8fe40a9ce0d7477a851a967b959394295 is the one reviewed at acec0db21c3df5eeb65c2cc6cbd98520070748e8, so that review stands. What is new comes from its base.

Approved

Carried forward: the change this pull makes at 16a4eccdb8c547c3e8468d53b23f127d5e487b38 is the one reviewed at 1e23cad8fe40a9ce0d7477a851a967b959394295, so that review stands. What is new comes from its base.

Merged as b2a6a36