• Mahmoud Aglan's avatar
    fix: a stale queue claim must not drop a player into a dead match · 16a760f7
    Mahmoud Aglan authored
    Production carries seven matchmaking_queue rows marked `matched` from May and
    June, each pointing at a game that finished months ago. The previous commit
    started honouring `matched` rows so the hand-off survives a re-queue — which,
    without this, would have sent those players straight into a three-month-old
    finished match.
    
    liveClaimedMatch() now verifies the referenced match is real, still playable,
    and actually belongs to the caller before acting on it, and deletes the row on
    the spot when it is not. Self-healing, so the existing rows need no manual
    cleanup. handleStatus also deletes only the row it consumed rather than every
    row for that player, and returns opponent_id alongside the colour.
    
    Covered by e2e section 17: a stale claim is refused and cleared, queueing past
    one works normally, and a genuinely live claim is still delivered with the
    correct opposite colour.
    Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
    16a760f7
matchmaking.php 11.1 KB