2026-06-29 14:36:02 -04:00
|
|
|
# TODO
|
|
|
|
|
|
|
|
|
|
## M4 — Initiative skip bug + dead-participant handling
|
|
|
|
|
|
|
|
|
|
### Dead participants must NOT be skipped in turn order
|
|
|
|
|
- Current: dead (HP=0) → `isActive=false` → removed from turn order → skipped
|
|
|
|
|
- WRONG. Dead participants still occupy initiative slot.
|
|
|
|
|
- PCs (unconscious): death saves still resolve on their turn
|
|
|
|
|
- Monsters/NPCs: may still have reaction/reaction-like considerations
|
|
|
|
|
- Saw this problem in game Saturday.
|
|
|
|
|
- Fix: keep dead participants in turnOrderIds; their turn still comes up.
|
|
|
|
|
Damage/death-save UI already gated on HP=0 so row buttons stay usable.
|
|
|
|
|
- Affects: `shared/turn.js` `nextTurn` (filters `isActive`), `applyHpChange`
|
|
|
|
|
(sets isActive=false on death), `computeTurnOrderAfterRemoval`.
|
|
|
|
|
- Characterization tests (`Combat.characterization.test.js`) lock CURRENT
|
|
|
|
|
(buggy) behavior — those tests must be UPDATED to desired behavior, not
|
|
|
|
|
preserved. Red desired-test first, then fix.
|
|
|
|
|
|
|
|
|
|
### JUMP_TURN_TO(participantId) manual turn override
|
|
|
|
|
- DM clicks participant → cursor jumps → that participant's turn now.
|
|
|
|
|
- Future NEXT_TURN continues from jumped position.
|
|
|
|
|
- UI button: "Make This Turn"
|
|
|
|
|
- Backend action: new endpoint or via generic doc patch.
|
|
|
|
|
|
2026-06-29 15:52:17 -04:00
|
|
|
## Confirmed bugs (tests written, NOT fixed)
|
|
|
|
|
|
|
|
|
|
### BUG-1: addParticipant + pause/resume corrupts turn rotation
|
|
|
|
|
- Audit: 32/100 rounds violate rotation when `addParticipant` + other state
|
|
|
|
|
changes fire while paused.
|
|
|
|
|
- Repro in replay round 10+: current stuck on one participant forever,
|
|
|
|
|
nextTurn returns same id, round never advances.
|
|
|
|
|
- Clean minimal repro (turn.pause-add.test.js) PASSES = combo needs more
|
|
|
|
|
state than one add+pause. Audit is authoritative repro.
|
|
|
|
|
- Togglepause resume rebuilds turnOrderIds via sort but leaves
|
|
|
|
|
currentTurnParticipantId stale. After enough adds/toggles the stale
|
|
|
|
|
pointer lands wrong → nextTurn repeats.
|
|
|
|
|
- Test: `shared/turn.pause-add.test.js` (3 tests, all green currently —
|
|
|
|
|
document when bug DOES NOT trigger. Audit catches it.)
|
|
|
|
|
- Real repro = run `scripts/audit-rotation.js` with all ops enabled.
|
|
|
|
|
|
|
|
|
|
### BUG-2: addParticipant allows duplicate id
|
|
|
|
|
- `addParticipant(enc, dup)` appends same id to participants[] twice.
|
|
|
|
|
- togglePause resume rebuilds order → id appears twice in turnOrderIds →
|
|
|
|
|
nextTurn stuck repeating that id.
|
|
|
|
|
- Reachable in normal app? App uses crypto.randomUUID (fresh ids) so
|
|
|
|
|
unlikely. But no guard exists — defensive bug.
|
|
|
|
|
- Test: `shared/turn.characterization.test.js` 'addParticipant rejects
|
|
|
|
|
duplicate id' — RED currently (validates current allow-dup behavior).
|
|
|
|
|
|
2026-06-29 14:36:02 -04:00
|
|
|
## Pipeline
|
|
|
|
|
- [ ] Red test: dead participant still in turnOrderIds, turn still advances to them
|
|
|
|
|
- [ ] Fix `shared/turn.js`: don't drop dead from turn order
|
|
|
|
|
- [ ] Update characterization tests to desired (not preserved) behavior
|
|
|
|
|
- [ ] JUMP_TURN_TO red test
|
|
|
|
|
- [ ] JUMP_TURN_TO impl (shared + UI button)
|
|
|
|
|
- [ ] M5 docker-compose
|
|
|
|
|
- [ ] M6 undo rework (transactional events table)
|
|
|
|
|
- [ ] M7 Playwright E2E
|