docs: reorg TODO — merge FEAT-2+M6 into FEAT-LOG, add undo/redo UI + Is NPC clarify

This commit is contained in:
david raistrick
2026-07-04 22:36:15 -04:00
parent 6fe2b762ab
commit ed1783e419
+21 -19
View File
@@ -4,26 +4,28 @@ Backlog of bugs + long-term items. Milestones live in REWORK_PLAN.md.
## Open ## Open
### FEAT-2: structured combat logs (parseable) ### FEAT: clarify "Is NPC" in add-participant
- Goal: logs in storage carry enough state to run skip/rotation analysis - Ambiguous label. May expand work based on what NPC means here (ally? monster?
on ANY historic round --- not just replay stdout. display-only? skip in turn order?). Clarify intent before UX changes.
- Current: `{timestamp, message, encounterName, undo}`. Parser guesses
roster from message strings. Brittle.
- Upgrade: structured fields at turn-state mutation log sites in App.js
(startEncounter, toggleActive, addParticipant, removeParticipant,
applyHpChange death/revive, togglePause, nextTurn):
```
turnSnapshot: { round, currentTurnParticipantId, turnOrderIds, activeIds }
```
- Then `scripts/analyze-turns.js` ingests app logs directly. Works on real
game sessions, any round, deterministic.
### FEAT-M6: transactional undo ### FEAT: first-class undo/redo UI buttons (B — do now)
- Every mutating action writes event: `(type, payload, undo_payload, undone, ts)`. - Toolbar buttons ↶/↷ in AdminView header, not buried in /logs.
- Undo = apply `undo_payload` in same SQLite tx, flip `undone`. Transactional, - Undo = revert latest non-undone log. Redo = re-apply latest undone.
no stale clobber. - Uses current 2-write undo (non-tx). Race safety = log refactor later.
- Replaces fragile `/logs` snapshot-write undo. - Disabled when stack empty. Keyboard shortcuts (cmd+z / cmd+shift+z).
- Migration: keep old undo for existing entries; new format for new.
### FEAT-LOG: unified log refactor (was FEAT-2 + M6, batched)
- Single event schema, one source of truth:
`{ ts, type, payload, undo_payload, undone, encounterId,
snapshot:{ round, currentTurnParticipantId, turnOrderIds, activeIds } }`
- Common format consumed by: UI log view, download/copy export,
replay-combat, analyze-turns. One shape, four consumers.
- Transactional undo: server endpoint `POST /api/undo/:eventId`. Single
SQLite tx applies undo_payload + flips `undone`. Replaces fragile 2-write
(log update + encounter update as separate calls).
- Download/copy: exports event stream as JSON for offline analysis.
- replay-combat + analyze-turns rewritten to emit/consume same event shape.
- Migration: keep old log entries readable; new format for new writes.
## Done (history) ## Done (history)