Two backlog trees are complete: `docs/project/backlog/` (75 files, every WP done) and `docs/project/refactor-backlog-setup/` (the arc before it). Move both under `docs/project/archive/` with `git mv`, so history stays intact through `git log --follow`. `SHOWCASE-ROADMAP.md` moves with them, because it points at the now-archived backlog README. Add `docs/project/archive/README.md`. It states that these trees are historical and names the two directories that are still live. Repoint every inbound reference named in RD-30's Files table: CLAUDE.md, the root README, both backend READMEs, `LetterHtml.cs`, `a11y.mdx`, the `document-feature` and `new-ssp` skills, and the readable-codebase PLAN, README, and RD-19 ticket. Fix two upward-relative links inside the moved WP files (WP-68, WP-69) that gained a directory level and would otherwise break. Repoint `.prettierignore`'s two agent-prompt exclusions to their new path, so prettier keeps leaving those files' exact wording alone. Mark RD-30 done and check off its acceptance criteria; flip its README row to done. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
WP-31 — Shared store helpers (audit: apply high-value)
Status: done Phase: 7 — refinements
Why
A code audit found real duplication across the editor stores. This WP extracts the four
highest-value shared helpers and rewires the stores to them (behaviour unchanged), and
reports the lower-value / riskier DDD items as deferred backlog. Extracting createHistory
here also unblocks WP-32 (stamdata undo) so it needn't copy-paste the brief pattern.
Decisions (pre-made, don't relitigate)
- Extract into
shared/application/(importable by every context; must not import back). - Apply the four concrete extractions + reuse; do not chase the deferred DDD items in this phase (bound the diff). Behaviour must be identical — the existing store specs are the gate.
Files
- New (each with a co-located spec):
shared/application/action-state.ts(ActionState/SaveState),history.ts(createHistory<T>),debounced-save.ts(createDebouncedSave),machine-remote-data.ts(machineRemoteData). - Rewired:
brief/application/brief.store.ts(all four),brief/application/org-template.store.ts(types + debounced-save + remote-data),beheer/application/stamdata.store.ts(remote-data).
Acceptance criteria
ActionState/SaveStatedefined once; both brief stores import them.createHistorybacks brief undo/redo (identical semantics; specs pass).createDebouncedSavebacks both brief stores' autosave, integratingPendingSave.machineRemoteDatabacks the RemoteData projection in all three stores.npm run cigreen; all pre-existing store specs still pass (no behaviour change).
Deferred (reported, not built) — audit findings for a later WP
contracts/folder inconsistency: onlybeheer/+registratie/have acontracts/folder;brief//herregistratie//auth/declare wire DTOs inline in adapters. Decide whether inline DTOs are a sanctioned exception or should be normalized.parse*traverse combinator: ~35parse*boundary fns repeat an array-parse-and-collect shape; a sharedtraverse/parseAllResultcombinator would collapse the common idiom.Seed { state }msg boilerplate: theSeed/return m.statepair repeats in 6 machines — cheap and per-machine typed; extract only if it earns its keep.
Out of scope
- The deferred items above (this WP only applies the four extractions).
Risks
- Behaviour drift in the central stores — mitigated: the extractions are 1:1 with the originals and gated by the existing brief/org-template/stamdata specs (all green).