fix(multiplayer): reconcile authoritative initial connections

This commit is contained in:
Josh Creek
2026-09-03 00:02:04 +01:00
parent 781cbc35aa
commit aa446cfbfe
40 changed files with 809 additions and 87 deletions
@@ -0,0 +1,13 @@
ALTER TABLE matches
ADD COLUMN initial_connect_ready_at TIMESTAMPTZ;
-- Existing in-flight matches receive a fresh, fair connection window when
-- this migration is deployed. Future rows are stamped by the transition to
-- ASSIGNMENT_READY, not by match creation or provider allocation.
UPDATE matches
SET initial_connect_ready_at = now()
WHERE state IN ('ASSIGNMENT_READY', 'ASSIGNED', 'CONNECTING');
ALTER TABLE matches
ADD CONSTRAINT matches_initial_connect_ready_at
CHECK (state NOT IN ('ASSIGNMENT_READY', 'ASSIGNED', 'CONNECTING') OR initial_connect_ready_at IS NOT NULL) NOT VALID;