fix: harden competition migration recovery

This commit is contained in:
dahyeon committed 2026-07-13 04:33:35 +00:00
1 parent bbcb2f43dc
commit 6b1c450752
7 files changed
+1394 -129

No files matched your search

+14 -3
View File
@@ -276,8 +276,17 @@ Migration builds new collections without dual canonical writes.
- A persisted legacy round-robin `gameSchedule` is authoritative. Migration
normalizes it into explicit TeamId-based pairings on the Competition format so the
immutable Series graph reproduces the historical opponents and rounds instead of
generating a different canonical schedule. Matches without a persisted schedule
continue to use deterministic canonical round-robin generation.
generating a different canonical schedule. The persisted schedule must completely
cover every configured round and every Series in each round; incomplete schedules
are quarantined. If every round number is absent on an older schedule, migration
deterministically partitions its persisted opponent pairs into complete playable
rounds and emits a warning; mixed or unpartitionable schedules are quarantined.
Complete opponent sets use direct canonical factorization at any supported team
count. Partial opponent-only schedules use bounded reconstruction for at most 16
teams; larger or search-limit-exceeding inputs receive dedicated quarantine codes
instead of being mislabeled as invalid.
Matches without a persisted schedule continue to use deterministic canonical
round-robin generation.
- Legacy TournamentCode `gameNumber` is a global GameSlot number, not a Series
ordinal. Migration resolves it through accepted Riot evidence first, then the
persisted format topology (`gameSchedule` or double-elimination bracket layout),
@@ -286,7 +295,9 @@ Migration builds new collections without dual canonical writes.
Series/GameSlot must agree. A multi-slot Series is never assigned to its first
GameSlot as a fallback; missing, conflicting, duplicated, or out-of-range evidence
is quarantined without changing the legacy Match or TournamentCode.
- Dry-run is the default and emits machine-readable and human-readable reports.
- Dry-run is the default and emits machine-readable and human-readable reports. Every
ready/apply result includes a deterministic `planHash` over the graph, facts, and
TournamentCode targets so audits detect target changes even when counts stay equal.
- Apply is resumable, idempotent, transactionally scoped per Match, and verifies fact
replay equality after every write.
- Apply explicitly creates or verifies every Competition unique/partial index before