[Game Systems] Inline stat-value editing during draft review (convert_stats / generate_statblock) #213
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Motivation/Context
v3.9.0 follow-up (flagged in #142 and #145). The schema-targeted
generate_statblock(#142) and theconvert_statsconversion wizard (#145) both stage a structuredstatsenvelope on the draft (LoreEntryDraft.current_stats, withcurrent_stats_notesprovenance for convert). The draft-review page (WikiDraftReview.jsx) renders those proposed values read-only — the GM can only approve them as-is, iterate (re-run the LLM), or discard.draft_service.patch_draft/ thePATCH …/drafts/{id}endpoint currently accepts inline edits tocurrent_title/current_body/current_sidebar_fields, but notcurrent_stats. So a GM who spots one wrong mapped value (e.g. AC 15 should be 17) can't just fix it before approving — they have to iterate or edit manually after approval via the #140 stat-block editor.Approach
Backend — extend
LoreDraftPatch+patch_draft(services/draft_service.py,routers/campaigns.py) to accept an optionalcurrent_statsvalue edit forgenerate_statblock/convert_statsdrafts:valuesagainst the entry's linked active schema viagame_system_service.validate_entry_stats(re-stampingsystem/schema_version,visibilitydefaultgm); reject invalid edits with 400, same as the create/approve paths.draft.current_stats. Leavecurrent_stats_notesas-is (provenance for the LLM's original mapping); a GM-edited field's note simply becomes advisory.Frontend — in
WikiDraftReview.jsx, forgenerate_statblock/convert_statsdrafts, make the proposed stat block editable (reuse #140'sStatBlockEditorfield inputs / type-aware widgets) rather than read-only, autosaving edits throughpatchLoreDraft(mirror the existing debounced body autosave). Approve then writes the possibly-editedcurrent_stats(the approval path already readsdraft.current_stats). Keep the confidence/source annotations visible for convert drafts.Out of scope
current_stats_notesthemselves (provenance is informational).current_statsalready exists (#142).Acceptance criteria
generate_statblockorconvert_statsdraft can edit a proposed stat value; the edit is validated server-side (bad type/range/enum/unknown field → 400 surfaced inline).statsreflects the GM's edits (not just the LLM's original values); the version snapshot captures it.Picking this up as part of the v3.9.1 patch (with #214), on
fix/v3.9.1-game-aware-followups→ PR tomain. Extendspatch_draft/LoreDraftPatchto accept validatedcurrent_statsedits and makes the proposed stat block editable inWikiDraftReviewforgenerate_statblock/convert_statsdrafts (reusing #140's inputs, autosave viapatchLoreDraft).statsenvelope through campaign export/import #214