docs: mark M4 BUG-5 done, move M6 undo to TODO backlog

REWORK_PLAN: M4 →  (slot-array + DRY core, 500 rounds clean). M6 undo
moved to TODO (feature work, not infra). M5 docker: nginx → Caddy
(simpler WS config). Milestone numbering clarified.

TODO: BUG-5 → FIXED. Added FEAT-M6 (transactional undo from plan),
BUG-10 (deact+reactivate double-act, distinct from BUG-5), BUG-11
(FE Combat.scenario pre-existing crash). Pipeline updated.
This commit is contained in:
david raistrick
2026-07-01 14:33:00 -04:00
parent 494327ff17
commit 5521a2f6c6
2 changed files with 51 additions and 34 deletions
+33 -13
View File
@@ -5,6 +5,15 @@ REWORK_PLAN.md.
## Feature backlog
### FEAT-M6: Transactional undo (moved from REWORK_PLAN)
- Every mutating action writes event: `(type, payload, undo_payload, undone, ts)`.
- Undo = apply `undo_payload` in same SQLite tx, flip `undone`. Transactional,
no stale clobber.
- Replaces fragile `/logs` snapshot-write undo.
- Migration: keep old undo working for existing entries until cleared; new
format for new entries.
- Related: BUG-7 (reorder no undo).
### FEAT-1: Dead participants stay in turn order — DONE
- Fixed: `applyHpChange` no longer flips `isActive` or touches `turnOrderIds`
on death/revive. Dead stay in rotation, `nextTurn` visits them, PCs get
@@ -78,18 +87,10 @@ REWORK_PLAN.md.
- Test: render App + DisplayView, toggle hide-HP, assert display still shows
encounter (not paused).
### BUG-5: mid-round addParticipant/revive corrupts rotation
- Test: `shared/tests/turn.combat.test.js` (jest, seeded RNG, RED).
- 13 rotation-dupes / 100 rounds. First at round 4 (Cleric twice).
- Pattern: Reinforce/Summon added mid-round → appears in rotation same round
→ round wrap re-sorts by initiative → currentTurnParticipantId pointer
stale → nextTurn revisits.
- Root cause: `computeTurnOrderAfterAddition` appends id to turnOrderIds
end. Round wrap re-sorts by initiative. currentTurn pointer stale after
sort → drifts → nextTurn revisits.
- This is the test audit should have been. Mirrors replay-combat.js op
sequence exactly (damage, heal, conditions, toggleActive, deathSave,
remove, add, edit, pause/resume, reorder, revive-between-rounds).
### BUG-5: mid-round addParticipant/revive corrupts rotation — FIXED
- Fixed (commit `494327f`). Slot-array turn order + DRY advance core
`nextActiveAfter`. Both nextTurn + computeTurnOrderAfterRemoval delegate.
- 500-round replay: 0 skips, 0 double-acts.
### BUG-6: reorderParticipants doesn't update turnOrderIds
- Test: `shared/tests/turn.reorder.test.js` 'reorder updates turnOrderIds' (RED).
@@ -114,8 +115,27 @@ REWORK_PLAN.md.
- Display frozen until full reload.
- Fix: `onclose` → reconnect + re-subscribe existing paths.
### BUG-10: deact+reactivate same round double-acts participant
- Discovered in 500-round replay (3 occurrences). DISTINCT from BUG-5.
- Pattern: participant acts → DM deactivates them → DM reactivates them
same round → `computeTurnOrderAfterAddition` re-inserts by initiative
(front) → acts AGAIN before round ends.
- No "acted-this-round" guard. Slot-array model has no per-round-acted set.
- Edge case (DM deact+reactivate same participant same round).
- Fix candidate: track actedThisRound set, skip re-acted; OR insertion
places reactivate AFTER current position (not by initiative).
- Parser now discounts deact-current advances, so this surfaced real.
### BUG-11: FE Combat.scenario test crashes (pre-existing)
- `src/tests/Combat.scenario.test.js:254` deathSave query helper throws
(button not found).
- Baseline (my changes removed) also exit=1. Pre-existing, not regression.
- Crashes whole FE test run (process dies).
## Pipeline (bugs only --- milestones live in REWORK_PLAN.md)
- [ ] BUG-4: fix setDoc→updateDoc for all 5 activeDisplay sites
- [ ] BUG-5: fix computeTurnOrderAfterAddition currentTurn re-anchor
- [x] BUG-5: fixed (commit 494327f)
- [ ] BUG-6: reorderParticipants update turnOrderIds
- [ ] BUG-8: ws adapter reconnect
- [ ] BUG-10: deact+reactivate double-act
- [ ] BUG-11: FE Combat.scenario crash