feat(backend): GameSystem registry + campaign linkage (#133) #205
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/133-gamesystem-registry-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Foundational backend issue for the v3.9.0 Game-Aware Systems pillar. Targets the integration branch
feat/v3.9-game-aware-systems.Closes #133.
What
A first-class
GameSystemregistry that campaigns can optionally link to, coexisting with the existing free-textgame_systemcolumn (never overwritten — preserved for rollback/flavour).game_systemstable seeded withdnd5e,pf2e, and a system-agnosticgenericat fixed UUIDs (migrationb5c6d7e8f9a0, chains off heada3b4c5d6e7f8).campaigns.game_system_idnullable FK,ON DELETE SET NULL.services/game_system_service.py): effective display name = linked system'sshort_nameif linked, else the free text. Also validation + an idempotent builtin self-heal (ensure_builtin_systems) because the test harness builds schema viacreate_all, not migrations.GET /api/game-systems— authenticated registry list (for #135's selector).CampaignCreate/Updateacceptgame_system_id(validated against active systems → 400 on unknown/inactive);CampaignResponse/Summarygaingame_system_refand return the resolved effective name. Campaign responses are now built viato_campaign_response()withgame_system_refeager-loaded (avoids async lazy-load).SessionTimeslotsResponse,NextSessionResponse): send the resolved name; field shape unchanged,BOT_CONTRACT_VERSIONstays 1, bot package untouched.Verification (Docker, pinned py3.12)
test_game_systems.py+ additions totest_campaigns.py/test_bot.pycover: registry endpoint, link on create, resolved response +game_system_ref, invalid/inactive id → 400, free-text campaign unchanged, unlink restores free text, bot endpoints resolve correctly.upgrade head→downgrade -1→upgrade headall clean; seeds present;game_system_idconfirmed asuuidFK withON DELETE SET NULL.Scope discipline
No UI, no LLM prompt integration, no stat schemas — those are #135 / #137 / #139, which build on this. Existing free-text campaigns (
game_system_id IS NULL) are behaviourally unchanged.🤖 Generated with Claude Code