2026-06-29 14:36:02 -04:00
|
|
|
# TODO
|
|
|
|
|
|
2026-06-30 16:28:18 -04:00
|
|
|
Backlog of bugs + long-term items, from user. Milestones live in
|
|
|
|
|
REWORK_PLAN.md.
|
2026-06-29 14:36:02 -04:00
|
|
|
|
2026-06-30 16:33:02 -04:00
|
|
|
## Feature backlog
|
|
|
|
|
|
|
|
|
|
### FEAT-1: Dead participants stay in turn order
|
|
|
|
|
- From user (Saturday game). Moved out of REWORK_PLAN (not milestone).
|
|
|
|
|
- Dead (HP=0) participants must NOT be skipped.
|
|
|
|
|
- Current: dead → `isActive=false` → removed from turn order → skipped.
|
|
|
|
|
- Desired: dead occupy initiative slot, turn still comes up. PCs get
|
|
|
|
|
death-save turn.
|
|
|
|
|
- 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`.
|
|
|
|
|
|
2026-06-29 15:52:17 -04:00
|
|
|
## Confirmed bugs (tests written, NOT fixed)
|
|
|
|
|
|
|
|
|
|
### BUG-1: addParticipant + pause/resume corrupts turn rotation
|
2026-06-29 16:36:43 -04:00
|
|
|
- **RESOLVED** as side effect of BUG-2 fix (dup-id rejection broke chain).
|
|
|
|
|
- Audit: 0 violations / 100 rounds after BUG-2 fix.
|
|
|
|
|
- Replay: 10 rounds clean, no skip/dupe.
|
2026-06-29 16:22:38 -04:00
|
|
|
- Audit: 128 violations / 100 rounds, 4 symptom faces.
|
|
|
|
|
- Symptom chain (one bug family):
|
|
|
|
|
1. pause blocks nextTurn advance → totalTurns stays frozen (e.g. 120)
|
|
|
|
|
2. addParticipant re-adds same `r${totalTurns}` id (BUG-2: no dedup)
|
|
|
|
|
3. togglePause resume rebuilds turnOrderIds → dup id appears x2
|
|
|
|
|
4. nextTurn gets stuck on dup id → rotation breaks
|
|
|
|
|
5. eventually nextTurn throws 'Encounter not running'
|
|
|
|
|
- Symptom counts (audit-state.js, 100 rounds):
|
|
|
|
|
62x turnOrder-no-dup, 52x rotation-dupes, 14x nextTurn-throws
|
2026-06-29 15:52:17 -04:00
|
|
|
- Repro in replay round 10+: current stuck on one participant forever,
|
|
|
|
|
nextTurn returns same id, round never advances.
|
2026-06-29 16:22:38 -04:00
|
|
|
- Clean minimal repro (shared/tests/turn.pause-add.test.js) PASSES = combo
|
|
|
|
|
needs more state than single add+pause. Audit authoritative repro.
|
|
|
|
|
- Clean subsystems (zero violations): HP bounds, isActive, deathSave
|
|
|
|
|
range, conditions, removeParticipant orphans.
|
|
|
|
|
- Real repro = `node scripts/audit-state.js` (or audit-rotation.js).
|
2026-06-29 15:52:17 -04:00
|
|
|
|
|
|
|
|
### BUG-2: addParticipant allows duplicate id
|
2026-06-29 16:36:43 -04:00
|
|
|
- **FIXED** (commit: addParticipant throws on dup id).
|
2026-06-29 16:22:38 -04:00
|
|
|
- Test: `shared/tests/turn.characterization.test.js` 'addParticipant rejects
|
2026-06-30 16:30:26 -04:00
|
|
|
duplicate id' --- GREEN.
|
|
|
|
|
|
|
|
|
|
### bug-3 was a halucination has been removed
|
2026-06-29 15:52:17 -04:00
|
|
|
|
2026-06-29 17:12:22 -04:00
|
|
|
### BUG-4: hide-player-HP breaks display view (preexisting)
|
2026-06-30 14:02:32 -04:00
|
|
|
- **Broader than hide-HP**: ALL 5 `storage.setDoc(getPath.activeDisplay(), ...)` calls
|
|
|
|
|
use `{merge:true}` which is IGNORED (setDoc = replace per contract).
|
|
|
|
|
Each write clobbers other fields on activeDisplay/status doc.
|
|
|
|
|
- line 1619: hide-HP toggle → clobbers campaignId+encounterId (display paused)
|
|
|
|
|
- line 1648: start combat → clobbers hidePlayerHp
|
|
|
|
|
- line 1779: end combat → clobbers hidePlayerHp
|
|
|
|
|
- line 1997: deactivate → clobbers hidePlayerHp
|
|
|
|
|
- line 2002: activate → clobbers hidePlayerHp
|
2026-06-29 17:12:22 -04:00
|
|
|
- Toggle "hide player HP" in admin → display view flips to "Game Session Paused".
|
|
|
|
|
- Toggling back does NOT recover. Must re-activate encounter in encounters
|
|
|
|
|
panel to restore display.
|
|
|
|
|
- Expected: hide-HP toggle updates one field on activeDisplay/status doc,
|
|
|
|
|
display stays live on current encounter.
|
|
|
|
|
- Likely cause: toggle writes to wrong path, or clobbers activeCampaignId/
|
|
|
|
|
activeEncounterId with null (setDoc replace vs updateDoc patch).
|
|
|
|
|
- Fix: use updateDoc (patch) not setDoc (replace); or include all existing
|
|
|
|
|
fields when writing.
|
|
|
|
|
- Test: render App + DisplayView, toggle hide-HP, assert display still shows
|
|
|
|
|
encounter (not paused).
|
|
|
|
|
|
2026-06-30 16:22:13 -04:00
|
|
|
### BUG-5: mid-round addParticipant/revive corrupts rotation
|
2026-06-30 12:33:56 -04:00
|
|
|
- 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
|
2026-06-30 16:22:13 -04:00
|
|
|
end. Round wrap re-sorts by initiative. currentTurn pointer stale after
|
|
|
|
|
sort → drifts → nextTurn revisits.
|
2026-06-30 12:33:56 -04:00
|
|
|
- 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).
|
|
|
|
|
|
2026-06-30 13:49:38 -04:00
|
|
|
### BUG-6: reorderParticipants doesn't update turnOrderIds
|
|
|
|
|
- Test: `shared/tests/turn.reorder.test.js` 'reorder updates turnOrderIds' (RED).
|
|
|
|
|
- `reorderParticipants(enc, draggedId, targetId)` swaps two same-initiative
|
|
|
|
|
participants in `participants[]` array but leaves `turnOrderIds` unchanged.
|
|
|
|
|
- nextTurn rotates via `turnOrderIds` only → reorder has NO effect on combat
|
|
|
|
|
rotation. Mid-encounter drag-drop = pointless.
|
|
|
|
|
- replay-combat.js calls reorderParticipants with WRONG signature
|
2026-06-30 16:30:26 -04:00
|
|
|
`(enc, reorderedArray)` --- swallowed by try/catch, silent no-op. So
|
2026-06-30 13:49:38 -04:00
|
|
|
replay never exercised real path either.
|
|
|
|
|
- Fix: reorder must also update turnOrderIds to match new participant order
|
|
|
|
|
(within same-initiative tie).
|
|
|
|
|
|
2026-06-30 13:59:58 -04:00
|
|
|
### BUG-7: reorderParticipants has no undo
|
|
|
|
|
- Test: `shared/tests/turn.undo.test.js` 'reorderParticipants has no undo' (GREEN doc).
|
|
|
|
|
- `reorderParticipants` returns `log: null`. Other ops return `log.undo`.
|
|
|
|
|
- Cannot undo drag-drop. Candidate for undo system (M6).
|
|
|
|
|
|
|
|
|
|
### BUG-8: ws adapter has no reconnect
|
|
|
|
|
- Test: `server/tests/ws-reconnect.test.js` (RED).
|
|
|
|
|
- WS dies (idle/error/close) → `wsReady=null`, subscribers dead forever.
|
|
|
|
|
- Display frozen until full reload.
|
|
|
|
|
- Fix: `onclose` → reconnect + re-subscribe existing paths.
|
|
|
|
|
|
2026-06-30 16:30:26 -04:00
|
|
|
## Pipeline (bugs only --- milestones live in REWORK_PLAN.md)
|
2026-06-30 16:22:13 -04:00
|
|
|
- [ ] 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
|