-
Mahmoud Aglan authored
tests/schema.sql is now generated from read-only dumps of production: the 35 tables the tournament system touches, with their checks, keys, indexes, RLS, policies and grants, and the production functions the hosting packages build on (tournament_register, _withdraw, _refund_entry, _refund_due, _settle, _redeem_tournament, redeem_fold, complete_match, award_coins). It used to be a hand-written subset without any of those functions. tests/run.sh loads it strictly, applies every 2026-10-27-hosting-*.sql (the schema file first), proves a second run leaves the schema identical and that the hosting tables stay locked to the service role, then runs every tests/test_hosting_*.php after the existing suites. PgShim now behaves like PostgREST where the engine relies on it: rpc() runs the real SQL function with named arguments and the client's return shapes, upsert() exists, jsonb, arrays and numerics come back typed, and a PHP list written to an array column becomes a Postgres array. The test router's supabaseRpc() goes through it. The suite was red before this (3 passed, 2 failed): registration and settlement are SQL functions now, and the shim answered every rpc with []. The end-to-end test also crashed at section 9, so sections 9 to 21 never ran; its heartbeat checks still looked in game_state, while heartbeats moved to match_presence. Now: 8 passed, 0 failed. Co-Authored-By:Claude Opus 5.5 <noreply@anthropic.com>
41180847