Fix double elimination with byes never finishing; hand-built brackets

Byes now cascade through the whole bracket (a slot nobody can fill is a bye or
a void), re-run on server start so stuck tournaments recover. New manual
bracket builder on the desk: pick round-1 pairings per match. Tests at 5-23
teams for both bracket types. Release 0.5.0.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MB7nCCAscYsb3zzkT6LHZi
This commit is contained in:
bkvargyasandClaude Fable 5.1 committed 2026-09-05 15:33:36 +00:00
1 parent a5222953dd
commit a4bee22d96
13 files changed
+214 -25

No files matched your search

+8
View File
@@ -16,6 +16,14 @@ export class Registry {
t.slug = row.slug;
const engine = row.engine ? CourtEngine.fromJSON(t, row.engine) : new CourtEngine(t, { courtCount: t.courtCount });
this._attach(row.slug, t, engine);
// Re-run bye settling on load: a tournament saved by an older version may have bracket slots
// that could never be filled (the 18-team double-elim case). Cheap and idempotent.
if (t.matches.some(m => m.stage !== 'pool') && t.phase !== 'final') {
const before = JSON.stringify(t.matches.map(m => [m.status, m.teamA, m.teamB]));
t.settleByes(); t._checkComplete();
if (t.phase === 'live') engine.tick();
if (before !== JSON.stringify(t.matches.map(m => [m.status, m.teamA, m.teamB]))) { console.log(`[load] ${row.slug}: settled bracket byes`); this.persist(row.slug); }
}
}
}