Turns the prior roadmap sketch into ordered, gated work packages (enforcement gates, FP/DDD consistency, CIBG fidelity, Storybook curriculum, a11y) from the 2026-07-02 showcase-hardening audit.
3.0 KiB
3.0 KiB
WP-09 — Pure-logic closure: dates + missing command specs
Status: todo Phase: 1 — FP/DDD core
Why
Three hand-rolled copies of the same nl-NL {day: numeric, month: long, year: numeric}
formatter exist with divergent signatures, while other components use the Angular date
pipe — two mechanisms plus drift risk. And two application commands with real logic have
no spec despite "domain and pure logic must have a spec" (CLAUDE.md §5).
Read first
src/app/registratie/domain/tasks.ts(~line 15,formatNL(d: Date))src/app/registratie/ui/aanvraag-block/aanvraag-block.component.ts(~line 96,formatNL(iso?: string))src/app/brief/ui/letter-preview/letter-preview.component.ts(~line 96, inline copy)src/app/registratie/application/draft-sync.ts(debounce logic)src/app/registratie/application/submit-change-request.tssrc/app/app.config.ts(LOCALE_IDnlis already set)
Decisions (pre-made, don't relitigate)
- Templates use
DatePipe; pure TS uses oneformatDatumNlinsrc/app/shared/kernel/datum.ts(Intl.DateTimeFormat, accepts ISO string | Date, empty-safe). Rule goes into CLAUDE.md conventions. - Kernel naming is Dutch (
datum.ts) — it formats for the Dutch UI; if that clashes with the "shared = English" rule during implementation,format-date-nl.tsis the alternative — pick one and note it here.
Files
- New
src/app/shared/kernel/datum.ts+datum.spec.ts - The three formatter copies (delete, redirect to pipe or kernel fn)
- New
src/app/registratie/application/draft-sync.spec.ts - New
src/app/registratie/application/submit-change-request.spec.ts CLAUDE.mdconventions (one line: DatePipe in templates,formatDatumNlin pure TS)
Steps
- Write
formatDatumNl+ spec (pin exact expected strings, e.g.2 juli 2026; undefined/empty →''). - Replace the three copies; templates that can use the pipe use the pipe.
draft-sync.spec.tswith vitest fake timers: coalescing (n rapid changes → 1 sync), trailing call, flush-on-submit if applicable.submit-change-request.spec.ts: ok path, error path (stubbed client), Result shape.- Also sweep the tiny dead exports flagged in the audit: remove unused
map3fromshared/kernel/fp.ts(verify unused first) and the never-setvariantinput onconfirmation.component.ts.
Acceptance criteria
- Exactly one hand-written date formatter in the repo;
grep -rn "toLocaleDateString" src/apphits onlydatum.ts. - Both command specs exist; debounce coalescing + error path covered.
map3/ unusedvariantinput removed (or a note here why kept).- CLAUDE.md rule added.
Verification
GREEN + npm run test-storybook:ci.
Out of scope
Result combinators (map/andThen/fold) — nice-to-have from the old roadmap, not in this
backlog.
Risks
Node ICU vs browser locale output differences — the spec pins strings; if CI's Node lacks
full ICU (it shouldn't on Node 24), pin via Intl.DateTimeFormat('nl-NL', …) explicitly.