tests: turn.combat.test.js (deterministic RED for BUG-5), deprecate audits
REAL test audit should have been. jest, seeded RNG, mirrors replay-combat.js op sequence exactly. Asserts per-round invariants: rotation-dupe, turnOrder dup-id, currentTurn valid+active, HP bounds. Result: 13 rotation-dupes / 100 rounds. First at round 4 (Cleric twice). Deterministic, reproducible every run. BUG-5 locked. Deprecate tests/audit/*.js: random sim gave false 0-violations while this exact test reproduces bug. Commented early-return. Kept for reference, delete later when log analyzer + unit tests cover ground. TODO: BUG-5 added (mid-round addParticipant/revive corrupts rotation). Root cause hypothesis: computeTurnOrderAfterAddition appends id to turnOrderIds end. Round wrap re-sorts by initiative. currentTurn pointer stale after sort → drifts → nextTurn revisits. Test RED by design (documents live bug). Pre-push will block on push.
This commit is contained in:
@@ -1,4 +1,19 @@
|
||||
// scripts/audit-rotation.js
|
||||
// DEPRECATED — DO NOT USE.
|
||||
// Random simulation gave false 0-violations while replay (exact ops)
|
||||
// reproduced real bugs. Replay-mirror approach = duplicate work.
|
||||
// Kept for now in case parts reusable. Will delete once log analyzer
|
||||
// (scratch/) + unit tests cover the ground.
|
||||
//
|
||||
// Prefer: replay-combat.js dumps turnOrderIds per turn, log analyzer
|
||||
// finds dupes/skips from real run. Unit tests lock confirmed bugs.
|
||||
//
|
||||
// To revive: delete this early-return block below.
|
||||
if (require.main === module) {
|
||||
console.error('audit-rotation.js DEPRECATED. See header comment.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// === original (below) — exploratory rotation audit, kept for reference ===
|
||||
// Pure turn.js simulation of replay op sequence. Detects first round where
|
||||
// rotation breaks (skip or dupe). Prints minimal repro + preceding ops.
|
||||
// No backend, no WS, no sleep. Fast.
|
||||
|
||||
Reference in New Issue
Block a user