Exclude pause/resume from undo; fix verify round-wrap false positive

togglePause no longer writes log entry (shared/turn.js). Lifecycle op, not
player action. Undo stack now targets last real action, not flag flip.
Removed dead pause/resume cases from expandUndo.

verify.js false positive: round wrap via non-nextTurn event (removeParticipant)
not detected — cycleActed never reset, actors flagged as acted_twice. Fix:
detect round change on ANY event, drain removed/inactive before finalize
(avoids false skipped when actor removed mid-round).

Tests updated: togglePause logging test asserts no log; undo test asserts
excluded. Repro confirmed via minimal verify case (removeParticipant r1->r2).
This commit is contained in:
david raistrick
2026-07-06 18:30:51 -04:00
parent 2c997de0da
commit bf1fccfd3b
4 changed files with 21 additions and 25 deletions
+2 -3
View File
@@ -61,12 +61,11 @@ describe('Logging contract: mutating ops', () => {
expectLastLogged(storage);
});
test('togglePause logs', async () => {
test('togglePause does NOT log (lifecycle excluded from undo)', async () => {
const e = enc([p('a', 10), p('b', 7), p('c', 3)]);
const started = await startEncounter(e, ctx);
await togglePause(started, ctx);
expect(storage.logs()).toHaveLength(2);
expectLastLogged(storage);
expect(storage.logs()).toHaveLength(1); // start only
});
test('addParticipant logs', async () => {