`; verbatim in text); `body` stays Markdown. Default and system layouts call `partial "footer" "text" $copy` (four calls). +- Copy key: `mail.brand.site_name_unsafe` (`backend::lang.mail.brand.site_name_unsafe`), en and pl +- Smoke subtests: `TestMailSafetySmoke/{prose_site_name,encoded_scheme,unsafe_site_name,inline_unsafe_output,literal_footer}`; `TestMailBrandSiteName/unsafe_name_refused` +- Removed subtest: `TestMailBrandSiteName/unsafe_name_current_behaviour` (pinned the old behaviour) +- Fixtures changed in Task 1, and why (each pinned prose as unsafe, which is no longer refused): + - editor_smoke_test.go: the "See the metadata: field." body moved to the valid drafts; the "body scheme" row became "layout scheme" (`href="javascript:alert(1)"` in a layout draft, field `content_html`, rule `unsafe`, message holds the encoded href) + - override_test.go `TestFallback/unsafe_override`: a template override selecting a layout override with the entity-encoded href + - partials_smoke_test.go `TestMailPartialsSmoke/errors` `unsafe_html`: a registered plugin partial `acme.blog::mail.partials.link` whose HTML holds the entity-encoded href + - override_smoke_test.go `TestMailOverrideSmoke/fallback` `unsafe`: body "Click the button onclick= to continue." (fails the unchanged handler regex; goldmark cannot produce a markup-level URL from a body) + +## Files Created/Modified + +- `modules/postcard/safety.go`: tokenizer-based markup check, `UnsafeText` +- `modules/postcard/templates.go`: `validateHTML` delegates schemes to `unsafeMarkup`; `inlineHTML` falls back on a failing post-inline check +- `modules/postcard/editor.go`: draft CSS checked as a style element; `renderBrand` uses `layoutSiteName` +- `modules/postcard/mailer.go`: `siteNameFrom`, `layoutSiteName`, `options` uses it +- `modules/postcard/assets/{partials/footer.htm,default.htm,system.htm}`: footer `text` argument +- `modules/cabana/mail_admin.go`: site_name refusal; `modules/cabana/settings.go`: BeforeValidate refusal localized +- `modules/phrasebook/backend/lang/{en,pl}/lang.yaml`: `mail.brand.site_name_unsafe` +- `modules/postcard/safety_smoke_test.go` (new) and the four fixture files above; `modules/cabana/mail_brand_layout_postgres_test.go` +- `modules/postcard/README.md`, `modules/cabana/README.md`, `docs/services/mail.md`, `.planning/notes/2026-11-14-mail-url-scheme-check.md`, `35-UI-SPEC.md` + +## Decisions Made + +As recorded in the plan's planner decisions and the decision note; no new ones beyond the deviation below. + +## Deviations from Plan + +### Auto-fixed Issues + +**1. [Rule 1 - Bug] Settings Put returned a BeforeValidate refusal with raw phrase keys** +- **Found during:** Task 2 (`TestMailBrandSiteName/unsafe_name_refused`) +- **Issue:** `SettingsService.Put` returned the `*ValidationError` from `BeforeValidate` without localizing it, so the 422 listed `backend::lang.mail.brand.site_name_unsafe` instead of the text (the existing colour and logo refusals had the same problem). The plan assumed crud.go's `localizeDetails` applied; it only does on controller saves. The `SettingsService.Tr` doc comment already promised localized 422 messages. +- **Fix:** wrap the hook error in `localizeControllerError(ctx, s.Tr, err)` in modules/cabana/settings.go (texts without `::` pass through unchanged). +- **Files modified:** modules/cabana/settings.go +- **Verification:** `TestMailBrandSiteName/unsafe_name_refused` passes; full cabana suite (Docker) green +- **Committed in:** `3a725469` + +**2. [Note] RED runs without separate commits** +- As the plan directs (CLAUDE.md forbids failing commits), each RED was run and recorded but landed with its fix. RED evidence was verified `RED_EVIDENCE_OK` with `msd-tools check tdd-red-evidence` for `TestMailSafetySmoke/prose_site_name` (templates.go at HEAD), `/unsafe_site_name`, `/inline_unsafe_output` and `/literal_footer`. go test -v output was converted line by line to Surefire XML for the checker, which reads only TAP or Surefire. + +**3. [Note] layouts_test.go and inline_test.go unchanged** +- Listed in files_modified "only where an assertion depended on the Markdown-rendered footer markup". No assertion did (`
...
` is the same paragraph), so neither file changed. + +--- + +**Total deviations:** 1 auto-fixed (1 bug), 2 notes +**Impact on plan:** The settings fix was needed for the planned translated 422 and also translates the existing colour and logo refusals. No API change. + +## Issues Encountered + +- `gofmt -l` reports modules/cabana/mail_routes.go and modules/postcard/store_postgres_test.go. Both predate this plan, so they were left alone. + +## Verification + +- `go vet ./...`, `go test -short ./...`, `go test ./modules/postcard ./modules/cabana` (Docker) and `cd examples/hello && go test ./...` were green after every code commit. +- `scripts/check-phase35.sh --consumers` passed, and both sibling trees stayed clean. `--additive` passed: `UnsafeText` is the only exported addition. +- `TestCommandsDocumented|TestDocsTree` and `summer docs:build --check` passed. +- go.mod, go.sum, modules/pact, admin/ and modules/boardwalk/dist have no commits since 0aa38db8. Nothing was pushed or tagged. + +## User Setup Required + +None. + +## Next Phase Readiness + +- 35-09 is next: regression and unit tests for the names above, the new names required in `scripts/check-phase35.sh`, and 35-VALIDATION.md rows. + +--- +*Phase: 35-mail-templates-and-layouts-editor* +*Completed: 2026-11-14* + +## Self-Check: PASSED