November 10, 2026 · In War Zone
The win that didn't count
War Zone's online leaderboard sat at zero even though people were playing. The leaderboard was fine: the host rewrote who was seated every time someone left, and if the rival quit before the end there was no match left to count.
In War Zone the host of a room writes down in its record who is seated and on which team. When the match ends, each phone asks the database to register the result, and the function only counts it if the room has two or more seats and the caller holds one of them. It's a sensible rule: nobody gets to claim a win in a room they didn't play in.
The bug was one step earlier. Up to version 1.0.26, the host rewrote the seats every time someone came in or left, mid-match included. If the rival closed the app or lost signal, the record was left with a single seat and the function answered no, without an error: winning because the other player left simply didn't exist. And since that same record decides who may join the room's private channel, anyone whose network dropped for a moment was no longer let back in.
Neither a test nor a report found it. It came out of writing a document of the game as it is, taken from the code and not from memory: what each mode does, what travels between phones, who writes what. Describing forces you to read every line asking whether it's still true, and that reading turned up three bugs. The other two: with four teams and three or four people, a seat clean-up from the days of two teams sent green and yellow to blue; and the end-of-match stats counted the blue team's, not those of whoever was holding the phone.
The fix has two halves. The app and the web now only write the seats in the waiting room. And the database stopped trusting that they will:
-- Disparador de la tabla de salas. Con la partida empezada, lo que decide
-- el resultado se queda como estaba al arrancar, lo mande quien lo mande.
if old.estado <> 'abierta' then
new.asientos := old.asientos; new.modo := old.modo; new.seed := old.seed;
if new.estado = 'abierta' then new.estado := old.estado; end if;
end if;The second half is the one that matters. A new version takes days to reach every phone, and meanwhile the older ones keep rewriting the seats. With the rule in the database, that write no longer changes anything: the fix works from the minute it's applied, even for people who haven't updated.
The four-team bug called for a different decision. In a deterministic online game, where every phone simulates the match and only the moves travel, the usual tool is bumping the simulation version, and that locks everyone who hasn't updated out of online play. But the simulation hadn't changed: only how seats are dealt at the start. So a protocol number now travels with each player's presence, and only the case that needs it demands it: four teams with three or four people. One on one, two on two and four teams between two people still play across the new version, the previous one and the web.
The room tests gained cases (the rival who vanishes mid-match; four teams as host, as guest and with an older app in the room), and all of them fail against the old code. That's the condition: a new test that also passes without the fix isn't testing the fix.