testsAndMisc/docs/superpowers/contracts/poker-stakes-file-length-2026-08-16.json
Krzysztof kuhy Rudnicki 73b85f5326 Split poker-stakes' four oversized files under the 250-line cap
useGame.test.tsx (494) splits by describe-block into reducer/session/debt
files; handEval.test.ts (269) splits at the evaluate7 boundary; useGame.ts
(268) sheds its state and reducer into gameState.ts; handFlow.ts (252) sheds
its betting-state helpers into handFlowBetting.ts.

useGame.ts and handFlow.ts re-export what they moved, so no importer changed.

The shared test helpers live in src/test/ rather than beside the source they
exercise. That is load-bearing: vite.config.ts already excludes src/test/ from
coverage, so no new exclusion entry was needed. Putting them next to the source
first dropped coverage to 98.57% because v8 counted the fixtures' unused
branches as production code -- fixed by moving them, not by excluding them.

Verified: 220 tests still pass, coverage back to 100% on statements, branches,
functions and lines, and npm run build succeeds. poker-stakes violations 4 -> 0;
repo total 196 -> 192.

invariants.test.ts hit its 5s timeout once mid-work. It passes standalone in
2.56s and on re-run, so it is a pre-existing contention flake under parallel
coverage load rather than a regression here -- noted, not papered over.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-16 15:26:18 +02:00

19 lines
1.3 KiB
JSON

{
"title": "Split poker-stakes' four over-250-line files",
"objective": "Bring every file in poker-stakes under the shared 250-line cap by extracting cohesive units, without weakening the 100% coverage gate or changing application behaviour.",
"acceptance_criteria": [
"No file under poker-stakes/ exceeds 250 lines.",
"npm run check passes: typecheck, eslint --max-warnings 0, and vitest at the configured 100% thresholds for statements, branches, functions and lines.",
"All 220 tests still pass; no test is deleted, skipped or weakened.",
"npm run build succeeds, proving the module graph still resolves after the extractions.",
"useGame.ts keeps its public API by re-exporting GameState, HandPhase, gameReducer and hasOutstandingDebt, so no importer changes.",
"No coverage-exclusion entry is added to vite.config.ts."
],
"out_of_scope": [
"Any change to poker-stakes application behaviour, engine logic or UI.",
"The pre-existing 5s-timeout flake in invariants.test.ts under parallel coverage load.",
"File-length violations outside poker-stakes/."
],
"verifier": "cd poker-stakes && npm run check (exit 0, 220 tests, 100% on all four metrics) && npm run build (exit 0); bash ~/utils/scripts/check_file_length.sh --all | grep -c poker-stakes returns 0."
}