remove hallucinated JUMP_TURN_TO feature

Not requested by user. Only real feature request: dead participants not
skipped. Removed turn.jump.test.js + FEAT-2 from TODO.
This commit is contained in:
david raistrick
2026-06-30 16:22:13 -04:00
parent 435e109070
commit fb7fbb2263
2 changed files with 31 additions and 83 deletions
+31 -37
View File
@@ -1,35 +1,33 @@
# TODO
## M4 — Initiative skip bug + dead-participant handling
## Milestone M4 — Initiative rotation bugs + features
### Dead participants must NOT be skipped in turn order (BUG-3 / M4)
- 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 (`src/tests/Combat.characterization.test.js`) lock CURRENT
(buggy) behavior — those tests must be UPDATED to desired behavior, not
preserved.
- RED test locked: `shared/tests/turn.dead-skip.test.js` (4 tests).
Split: bug (rotation corruption) vs feature (dead-participant handling).
### BUG-5: Initiative skip (mid-round add/revive corrupts rotation)
- **Real bug.** Rotation corrupts when participant added/revived mid-round.
- Test: `shared/tests/turn.combat.test.js` (jest, seeded, RED).
- 13 dupes / 100 rounds. First at round 4 (Cleric twice).
- Root cause: `computeTurnOrderAfterAddition` appends id to turnOrderIds
end. Round wrap re-sorts by initiative. `currentTurnParticipantId` pointer
stale → nextTurn revisits.
- See full detail below in Confirmed bugs section.
### FEAT-1: Dead participants should stay in turn order (as-designed→change)
- **Feature request, not bug.** Current behavior is as-designed (dead =
inactive = skipped). User wants change: dead occupy initiative slot,
PCs get death-save turn.
- Saw Saturday game.
- Desired:
- dead PC not removed from turnOrderIds
- dead PC turn still comes up (nextTurn visits them)
- dead PC on their turn can deathSave
- dead PC not auto-set isActive=false by applyHpChange
### 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.
- RED test: `shared/tests/turn.jump.test.js` (3 tests, 2 RED).
- jump sets currentTurn, future nextTurn continues
- jump to first stays same round
- jump invalid throws (green via TypeError)
- Affects: `shared/turn.js` `nextTurn` (filters `isActive`), `applyHpChange`
(sets isActive=false on death), `computeTurnOrderAfterRemoval`.
- Characterization tests (`src/tests/Combat.characterization.test.js`) lock
CURRENT behavior — UPDATE to desired when implementing.
- RED test locked (desired state): `shared/tests/turn.dead-skip.test.js` (4 tests).
## Confirmed bugs (tests written, NOT fixed)
@@ -80,18 +78,15 @@
- Test: render App + DisplayView, toggle hide-HP, assert display still shows
encounter (not paused).
## Pipeline
### BUG-5: mid-round addParticipant/revive corrupts rotation (deterministic test)
### 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 + `togglePause` resume rebuilds order via sort but doesn't re-anchor
currentTurn to its new position. After several mid-round adds the pointer
drifts.
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).
@@ -120,12 +115,11 @@
- Fix: `onclose` → reconnect + re-subscribe existing paths.
## 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
(src/tests/Combat.characterization.test.js, etc)
- [ ] JUMP_TURN_TO red test
- [ ] JUMP_TURN_TO impl (shared + UI button)
- [ ] BUG-4: fix setDoc→updateDoc for all 5 activeDisplay sites
- [ ] BUG-5: fix computeTurnOrderAfterAddition currentTurn re-anchor
- [ ] BUG-6: reorderParticipants update turnOrderIds
- [ ] BUG-8: ws adapter reconnect
- [ ] FEAT-1: dead participants stay in turn order (update characterization)
- [ ] M5 docker-compose
- [ ] M6 undo rework (transactional events table)
- [ ] M7 Playwright E2E