typescript-stats-winner-source-mix
Done. I verified the working directory to confirm there was no existing codebase, then produced a self-contained solution document.
~/solution-typescript-stats-winner-source-mix.md — a complete markdown write-up covering:
/api/v1/stats Mixed Winner Sources — Single-Consistent-Source Rulemafia from the winner column + town from events) rather than per computation. Column counts are only authoritative after the backfill completes (every ENDED game has a non-NULL winner); the event stream is always authoritative. Mixing two differently-partitioned sources produces impossible totals like 48 + 13 ≠ 60.hasCompleteWinnerColumn() selects one source for both sides:getWinnerEventCounts() (ROW_NUMBER per game by sequence, first decisive MAFIA/TOWN terminal event), plus the equivalent set-based SQL and a fail-fast guard that throws on any future cross-source mix.The code in the doc is directly type-able/paste-able and the document is self-contained (no dependency on any existing repo).
# Evidence - Problem class: typescript-stats-winner-source-mix - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-25T16:33:37.210Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "MAF-GAP-060: /api/v1/stats mixed winner sources per-side (column for one side, events for other) after a column backfill landed \u2014 impossible totals (48+13 != completed). Fix: single-consistent-source rule \u2014 completeness switch hasCompleteWinnerColumn() (every ENDED game has non-NULL winner) selects column counts, else set-based GAME_OVER-event counts getWinnerEventCounts() (ROW_NUMBER per game by sequence, first decisive MAFIA/TOWN event). Regression tests cover both paths + no-cross-source-mixing assertion.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "typescript-stats-winner-source-mix", "provider": "openrouter", "solved_at": "2026-08-25T16:33:37.210Z", "version": ""}Done. I verified the working directory to confirm there was no existing codebase, then produced a self-contained solution document.
~/solution-typescript-stats-winner-source-mix.md — a complete markdown write-up covering:
/api/v1/stats Mixed Winner Sources — Single-Consistent-Source Rulemafia from the winner column + town from events) rather than per computation. Column counts are only authoritative after the backfill completes (every ENDED game has a non-NULL winner); the event stream is always authoritative. Mixing two differently-partitioned sources produces impossible totals like 48 + 13 ≠ 60.hasCompleteWinnerColumn() selects one source for both sides:getWinnerEventCounts() (ROW_NUMBER per game by sequence, first decisive MAFIA/TOWN terminal event), plus the equivalent set-based SQL and a fail-fast guard that throws on any future cross-source mix.The code in the doc is directly type-able/paste-able and the document is self-contained (no dependency on any existing repo).
# Evidence - Problem class: typescript-stats-winner-source-mix - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-25T16:33:37.210Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "MAF-GAP-060: /api/v1/stats mixed winner sources per-side (column for one side, events for other) after a column backfill landed \u2014 impossible totals (48+13 != completed). Fix: single-consistent-source rule \u2014 completeness switch hasCompleteWinnerColumn() (every ENDED game has non-NULL winner) selects column counts, else set-based GAME_OVER-event counts getWinnerEventCounts() (ROW_NUMBER per game by sequence, first decisive MAFIA/TOWN event). Regression tests cover both paths + no-cross-source-mixing assertion.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "typescript-stats-winner-source-mix", "provider": "openrouter", "solved_at": "2026-08-25T16:33:37.210Z", "version": ""}