Files
atomic-design-poc/docs/project/archive/backlog/WP-48-stamdata-deletion-protection.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.1 KiB

WP-48 — Stamdata deletion protection (referential integrity)

Status: done Phase: 8 — platform/DX/showcase

Why

Deleting a stamdata row that something relies on (e.g. a professions.program a diploma maps through) would silently break behaviour. Stamdata is config-as-code (PR-applied, CI-gated), so the authoritative guard belongs at the build gate; the editor gets a fast-feedback nudge.

Decisions (locked with the user)

  • CI gate (authoritative) + editor warning (fast feedback).
  • Steer temporal rows toward expiring (set geldigTot) over hard delete.

Outcome

  • CI gate: generalized the dangling-reference test in StamdataValidationTests into a declared, extensible reference list (StamdataRef records) — "every declared reference into a stamdata key resolves against the currently-valid stamdata." Today one entry: Diploma.Opleiding → professions.program (valid today). Resolvers use the "valid today" view (Professions.ByProgram), so removing/renaming a referenced program OR expiring it while current data still references it fails the PR build; expiring once nothing current relies on it passes. Adding a future FK is one list entry.
  • Editor (fast feedback): stamdata-table-editor now confirms before delete (@@beheer.removeConfirm — warns that a referenced row fails CI and, for a dated table, to close validity instead) and, for temporal tables, adds a "Sluiten per vandaag" action that sets geldigTot to today (reusing CellEdited) — steering to expire over hard delete. CI stays the authority.

Acceptance criteria

  • A delete/expire that orphans a declared reference fails the build gate (existing seed passes).
  • Editor confirms deletes and offers expire (close validity) for temporal tables.
  • npm run ci green (backend dotnet test, localized build).

Deferred (noted)

A per-row "referenced" hint in the editor DTO (server-computed usage) — would let the editor warn on the specific referenced rows rather than a generic confirm. Not needed for the authoritative gate.