Files
atomic-design-poc/docs/project/archive/backlog/WP-31-shared-store-helpers.md
T
ehoandClaude Opus 5 12f17d9d73 docs: archive the finished backlogs (RD-30)
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>
2026-09-08 23:00:38 +02:00

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/SaveState defined once; both brief stores import them.
  • createHistory backs brief undo/redo (identical semantics; specs pass).
  • createDebouncedSave backs both brief stores' autosave, integrating PendingSave.
  • machineRemoteData backs the RemoteData projection in all three stores.
  • npm run ci green; all pre-existing store specs still pass (no behaviour change).

Deferred (reported, not built) — audit findings for a later WP

  • contracts/ folder inconsistency: only beheer/ + registratie/ have a contracts/ 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: ~35 parse* boundary fns repeat an array-parse-and-collect shape; a shared traverse/parseAll Result combinator would collapse the common idiom.
  • Seed { state } msg boilerplate: the Seed/return m.state pair 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).