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>
39 lines
2.1 KiB
Markdown
39 lines
2.1 KiB
Markdown
# WP-47 — Runtime feature flags (catalog-in-code, admin-toggled)
|
|
|
|
Status: done
|
|
Phase: 8 — platform/DX/showcase
|
|
|
|
## Why
|
|
|
|
Ops needs to turn features on/off at runtime without a deploy. Mirrors the two house templates: the
|
|
capability spine (server-resolved, FE reads) and the org-template runtime-SQLite config (admin edits
|
|
at runtime). Per ADR-0004 the **catalog** (which flags exist + defaults) is config-as-code; only the
|
|
**on/off state** is runtime.
|
|
|
|
## Decisions (locked with the user)
|
|
|
|
- Catalog in code (typed, build-validated); on/off state in SQLite; admin toggles at runtime.
|
|
- **FE + backend enforcement** — the FE hides the surface AND the server enforces (a flag can guard
|
|
a real feature, not just UI).
|
|
|
|
## Outcome
|
|
|
|
- Backend: `Domain/Features/FeatureFlags.cs` (catalog: one flag `inschrijving-open`, default on) +
|
|
`Data/FeatureFlagStore.cs` (`FeatureFlagEntity` in SQLite + migration; `All()` merges catalog
|
|
defaults with overrides, `IsEnabled`, `Set` rejects unknown keys). `GET /flags` (readable, drives
|
|
FE gating) + `PUT /admin/flags/{key}` (gated by new `flags:manage` cap + `FlagsAdmin`). Enforced
|
|
end-to-end: `POST /applications` for a `registratie` returns 403 when `inschrijving-open` is off.
|
|
- FE: `shared/domain/feature-flag.ts` + `feature-flags.adapter.ts` (parse boundary) +
|
|
`shared/application/feature-flags.store.ts` (root singleton, `enabled(key)` deny-by-default,
|
|
`set`). Capability `flags:manage` (union + me.adapter + role.interceptor `/api/v1/admin/flags`).
|
|
The "Inschrijven" nav item + dashboard action hide when the flag is off. Admin toggle page
|
|
`beheer/ui/feature-flags.page.ts` at `/beheer/functies`, in `ADMIN_LINKS`.
|
|
- Tests: catalog-unique + endpoint (admin-only toggle, 404 unknown key, close→403 / reopen→201).
|
|
`/me` cap-list test updated. Backend 136; typed client regenerated.
|
|
|
|
## Acceptance criteria
|
|
|
|
- [x] Admin toggles a flag at runtime; state persists (SQLite) and the whole app reads it.
|
|
- [x] FE hides the flagged feature AND the backend enforces it (registration close → 403).
|
|
- [x] `npm run ci` green (dep:check, localized build, backend `dotnet test`, drift clean after commit).
|