docs(35-04): complete unit tests and phase gate plan

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-13 14:31:02 +01:00
parent ed696bc74e
commit fd51f1f523

View File

@@ -0,0 +1,169 @@
---
phase: 35-mail-templates-and-layouts-editor
plan: 04
subsystem: testing
tags: [postcard, cabana, surf, vitest, check-phase35, nyquist]
requires:
- phase: 35-01
provides: postcard override/partial/brand/editor smoke and DB helpers
- phase: 35-02
provides: cabana mail admin API and newMailScreensEnv harness
- phase: 35-03
provides: SPA mail fields, codeeditor, boardwalk dist
provides:
- scripts/check-phase35.sh fail-closed phase gate
- postcard/pact/attach unit tests for D-21 override/fallback/partials/samples/brand/sync
- cabana/surf unit tests for permissions, save, drift, reset, layout delete, test-send, Attempter
- SPA unit and browser tests for mail editor fields
- filled 35-VALIDATION.md (nyquist_compliant: true)
affects: [msd-verify-work, phase-35-complete]
actuals:
tokens: 45000
tasks: 4
commits: 11
plan_head_before: 95eed7ad9814004c6c894e659b45bb74c65801b4
plan_head_after: c7e7fcc6a0edb5f3157643f4024d96dca5530d2a
tech-stack:
added: []
patterns:
- "check-phase35.sh stages mirror check-phase34 (self-test/go/docker/consumers/admin/docs/marker/additive)"
- "mailEnv drift via second process keep:true + changed MapFS"
- "MailPreviewField IntersectionObserver gates preview POSTs on inactive tabs"
key-files:
created:
- scripts/check-phase35.sh
- modules/postcard/override_test.go
- modules/postcard/partials_test.go
- modules/postcard/samples_test.go
- modules/postcard/editor_test.go
- modules/postcard/brand_test.go
- modules/postcard/store_postgres_test.go
- modules/cabana/mail_permissions_postgres_test.go
- modules/cabana/mail_lifecycle_postgres_test.go
- modules/cabana/mail_test_send_postgres_test.go
- modules/cabana/mail_unit_test.go
- modules/cabana/field_mail_test.go
- admin/tests/form/CodeEditorField.test.ts
- admin/tests/form/MailPreviewField.test.ts
- admin/tests/form/insertImage.test.ts
- admin/tests/form/MailImagePicker.test.ts
- admin/tests/form/ColorPickerField.test.ts
- admin/tests/form/MailImageField.test.ts
- admin/tests/form/FormViewMail.test.ts
- admin/tests/browser/codeeditor.test.ts
modified:
- modules/pact/capabilities_test.go
- modules/lagoon/attach/absolute_test.go
- modules/surf/store_lookup_test.go
- admin/tests/list/RowStateBadges.test.ts
- admin/tests/views/SettingsFormView.test.ts
- admin/src/components/mail/insertImage.ts
- admin/src/components/form/fields/MailPreviewField.vue
- modules/boardwalk/dist
- .planning/phases/35-mail-templates-and-layouts-editor/35-VALIDATION.md
key-decisions:
- "Consumer mail tests run as package `.` (not `./...`) so detect_go sees named tests"
- "Inactive-tab preview uses IntersectionObserver; document.hidden is not the signal"
patterns-established:
- "Phase gate consumers stage is read-only against sibling plugin checkouts"
- "Deviation fixes for SPA defects found by unit tests get their own fix(...) commits before the test commit"
requirements-completed: [D-21, D-03, D-06, D-07, D-11, D-12, D-13, D-14, D-15, D-17, D-23]
coverage:
- id: D1
description: "fail-closed check-phase35.sh covering framework, admin, docs, consumers"
requirement: D-21
verification:
- kind: other
ref: "bash scripts/check-phase35.sh --all"
status: pass
human_judgment: false
- id: D2
description: "postcard override/fallback/partial/sample/brand/store/sync unit tests"
requirement: D-21
verification:
- kind: unit
ref: "go test ./modules/postcard -run 'TestOverride|TestFallback|TestPartial|TestSample|TestValidateDraft|TestBrand|TestStore|TestSync'"
status: pass
human_judgment: false
- id: D3
description: "cabana permission/save/drift/reset/layout-delete/test-send and surf Attempter"
requirement: D-21
verification:
- kind: unit
ref: "go test ./modules/cabana -run 'TestMailPermissions|TestMailSave|TestMailDrift|TestMailReset|TestMailLayoutDelete|TestMailBrand|TestMailTestSend'"
status: pass
- kind: unit
ref: "go test -short ./modules/surf -run TestInstallCoolerPublishesAttempter"
status: pass
human_judgment: false
- id: D4
description: "SPA mail editor unit and browser tests; filled validation map"
requirement: D-21
verification:
- kind: automated_ui
ref: "npm --prefix admin run test / test:browser"
status: pass
- kind: other
ref: ".planning/phases/35-mail-templates-and-layouts-editor/35-VALIDATION.md nyquist_compliant: true"
status: pass
human_judgment: false
duration: ~90min
completed: 2026-11-13
status: complete
---
# Phase 35 Plan 04: Unit tests and phase gate
**D-21 coverage and `scripts/check-phase35.sh --all` are green**, including sibling sm-user and sm-paymentgateway mail tests against this checkout.
## Performance
- **Duration:** ~90 min
- **Tasks:** 4
- **Commits:** 11 (gate, postcard, cabana, three admin fixes + dist, SPA tests, two validation docs)
## Accomplishments
- Fail-closed `scripts/check-phase35.sh` with self-test, go, docker, consumers, admin, docs, marker, additive stages
- Postcard/pact/attach unit tests for override precedence, fallback, partials, samples, validation, branding, sync
- Cabana/surf unit tests for permission split, save 422s, drift, reset, layout delete, test-send limits, Attempter publish
- SPA unit + browser tests for codeeditor, mailpreview, insertImage, picker, color/mailimage, FormView reset/deletable, badges
- `35-VALIDATION.md` filled; `nyquist_compliant: true`, `wave_0_complete: true`
## Deviations from plan
| Commit | Why |
|--------|-----|
| `e81cfde7` fix(admin): restore suite after colorpicker and codeeditor registration | Task 1/2 gate `--admin` failed on existing suite after Phase 35 field registration |
| `1df2e31d` fix(admin): isolate CodeMirror load for chunk-failure tests | Chunk-failure mock needed `codeeditor/load.ts` indirection |
| `275e70b4` fix(admin): encode parentheses in markdown mail image URLs | `encodeURIComponent` leaves `()`; UI-SPEC C4 / insertImage tests required `%28`/`%29` |
| `52e854a1` + `45017039` fix(admin): skip off-screen preview + rebuild dist | Inactive-tab rule (UI-SPEC C10) was missing; IntersectionObserver added |
## Task commits
1. `5f62cd6b` test(35): phase gate script check-phase35.sh
2. `659969b9` test(postcard): unit tests for overrides, fallback, partials, samples, validation, sync and branding
3. `cd20540f` test(cabana): unit tests for mail permissions, save validation, drift, reset, layout delete and test send
4. `1ae1a955` test(admin): unit and browser tests for the mail editor fields
5. `31d019fc` docs(35): fill the validation map (+ `ed696bc7` status-key cleanup)
## Gate result
`bash scripts/check-phase35.sh --all` → **Phase 35 gate passed** (Docker host available; `PHASE35_ALLOW_NO_DOCKER` unset).
## Self-Check: PASSED
- Acceptance greps for Task 1–4 subjects and artifacts
- `--all` green including consumers and docker stages
- No sibling repository dirty from consumers stage
- Nothing pushed or tagged