• Mahmoud Aglan's avatar
    test: a production replica, a PostgREST-shaped shim, and the hosting migrations in the suite · 41180847
    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: 's avatarClaude Opus 5.5 <noreply@anthropic.com>
    41180847
Name
Last commit
Last update
.claude Loading commit data...
.impeccable Loading commit data...
ChessPieces Loading commit data...
Connections and docs Loading commit data...
Logo El3ab Loading commit data...
admin Loading commit data...
api Loading commit data...
app icons Loading commit data...
config Loading commit data...
docs Loading commit data...
includes Loading commit data...
ludo-playtest Loading commit data...
migrations Loading commit data...
promo Loading commit data...
public Loading commit data...
screenshots Loading commit data...
test-screenshots Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
.htaccess Loading commit data...
ARCHITECTURE.md Loading commit data...
ASSET_REGISTRY.json Loading commit data...
ASSET_REGISTRY.md Loading commit data...
BUILD_ORDER.md Loading commit data...
DATABASE_REFERENCE.md Loading commit data...
DESIGN.md Loading commit data...
Dockerfile Loading commit data...
FIX_PLAN.md Loading commit data...
HANDOVER.md Loading commit data...
MULTIPLAYER_RULES.md Loading commit data...
PLAN.md Loading commit data...
PRODUCT.md Loading commit data...
ROADMAP.md Loading commit data...
Stockfishbotsapi.txt Loading commit data...
WTF.md Loading commit data...
backgammon-test.mjs Loading commit data...
bell.png Loading commit data...
captain-definition Loading commit data...
chess-browser-test.mjs Loading commit data...
chess-multiplayer-test.mjs Loading commit data...
chess-sync-test.mjs Loading commit data...
domino-test.mjs Loading commit data...
index.php Loading commit data...
logof.png Loading commit data...
manifest.json Loading commit data...
package-lock.json Loading commit data...
package.json Loading commit data...
privacy-policy.php Loading commit data...
qr-code.png Loading commit data...
terms.php Loading commit data...
test-tournament-swiss.mjs Loading commit data...
test-tournament-ui.mjs Loading commit data...