Commit 1b6fe1dc authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix(online): matchmaking for ludo, domino and backgammon actually matches

Found by the gameplay pass, verified against production with throwaway
accounts (31/31 checks):

- ludo: the queue filtered and ordered on created_at, a column ludo_queue does
  not have, so no two players were ever matched; five stale rows from July to
  September were also deleted.
- domino and ludo status/get decoded jsonb columns that already arrive as
  arrays: a PHP 8 TypeError, so the waiting player never learned of the match
  and every live poll failed.
- all three: the zero-UUID claim placeholder was reported as a found match and
  its row deleted; failed inserts were reported as success; domino hands were
  renumbered by array_merge; complete passed p_winners as a string (the RPC
  refused it) and could pay twice. Complete now pays once, to seated players.
- engine.js loads each game module independently, so one module failing to
  load can no longer stop the whole app from booting.
Co-Authored-By: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
parent 6746a37a
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -131,20 +131,13 @@ function onLogout() {
}
async function loadModules() {
await import('./modules/auth/mod.js');
await import('./modules/play/mod.js');
await import('./modules/chess/mod.js');
await import('./modules/domino/mod.js');
await import('./modules/ludo/mod.js');
await import('./modules/backgammon/mod.js');
await import('./modules/rank/mod.js');
await import('./modules/social/mod.js');
await import('./modules/tournaments/mod.js');
await import('./modules/profile/mod.js');
await import('./modules/rewards/mod.js');
await import('./modules/shop/mod.js');
await import('./modules/puzzles/mod.js');
await import('./modules/org/mod.js');
// One game failing to load must never take the whole app down with it: each
// module is loaded on its own and a failure is logged, not thrown.
const mods = ['auth', 'play', 'chess', 'domino', 'ludo', 'backgammon', 'rank', 'social',
'tournaments', 'profile', 'rewards', 'shop', 'puzzles', 'org'];
await Promise.all(mods.map(m => import(`./modules/${m}/mod.js`).catch(e => {
console.error(`[boot] module ${m} failed to load:`, e);
})));
}
boot();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment