feat: add immutable level template lifecycle

This commit is contained in:
2026-08-14 14:17:54 +02:00
parent 5599d330d8
commit c8a870549d
10 changed files with 386 additions and 26 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ This is the ordered implementation roadmap following the accepted exhibit model.
- [x] Add boards, exhibits, exhibit types, subtype tables, immutable template versions, and mutable levels.
- [x] Cut over the explicitly disposable POC database directly; no transitional data existed to backfill or compare.
- [ ] Implement template instantiation and “save level as template” as transactional clone operations.
- [x] Implement template instantiation, version selection, reset, and “save level as template” as transactional clone operations.
- [x] Introduce a server-side repository/service boundary so SQL and cloning transactions do not live in Express route handlers.
- [ ] Move the frontend to an exhibit/widget registry backed by the normalized API.
- [x] Remove transitional `widgets`, `widget_relations`, and `playthrough_*` tables in the canonical cutover migration.
+2 -10
View File
@@ -317,14 +317,6 @@ The following are computed and must not become duplicate source-of-truth tables:
`save_level_as_template(level_id)` runs the same clone operation into a new immutable template-version board.
## Migration direction
## Implemented cutover
The current `widgets`, `widget_relations`, and `playthrough_*` tables are transitional. The cutover should:
1. Introduce boards, exhibit tables, subtype tables, templates, and typed metadata.
2. Convert existing authored widgets to exhibits.
3. Materialize each existing playthrough as its own cloned mutable level.
4. Move document layout from relation JSON into document exhibit coordinates.
5. Convert `contains` relations to folder memberships and generic connections to exhibit connections.
6. Update the API to read and write exhibits directly.
7. Remove the transitional widget/playthrough tables only after data equivalence checks pass.
Migration 006 made this the sole persistence model. Because the POC database contained no canonical or legacy content worth preserving, the cutover intentionally dropped the JSON case store, `widgets`, `widget_relations`, and `playthrough_*` tables without a backfill period. Template save, version selection, instantiation, and reset now use one transactional board-cloning service. The remaining architectural work is the frontend exhibit/widget registry and the planned exhibit families.