Repository navigation
feat(leaderboard): per-account and per-model leaderboard (Phase 12) - #22
Merged
Merged
Conversation
RoomSeat is already each finished game's durable participant record (a room plays exactly one game for its whole lifetime), so app.leaderboard just joins game_record to room_seat on room_id -- no new snapshot table. Two aggregate views (leaderboard_by_account, leaderboard_by_model), an optional per-game filter, a new leaderboard:view permission granted to every default role, and a /leaderboard page with an Accounts/Models tab split. Claude-Session: https://claude.ai/code/session_01UbiPa1rKCyqhqufgwJWkeW
…d on a fresh DB a1b2c3d4e5f6 (Phase 6's seed migration) imports ALL_PERMISSIONS/ DEFAULT_ROLES live from permissions.py, so on any fresh database it already seeds leaderboard:view itself before 30c74160ca50 runs -- a plain bulk_insert then collided on the unique constraint (real CI failure on PR #22, never reproduced locally since the dev DB predates this permission). Switched both inserts to ON CONFLICT DO NOTHING; verified against two throwaway Postgres containers covering both a fresh DB and one migrated before this permission existed. Claude-Session: https://claude.ai/code/session_01UbiPa1rKCyqhqufgwJWkeW
- leaderboard.tsx: add aria-label to the game filter, distinguish loading/error from a genuine empty result (shared LeaderboardTable) - leaderboard.py: correct docstring overclaiming finished games always have a winner_seat - persistence.md: document the RBAC-seed-migration trap this PR hit, so future phases don't rediscover it Claude-Session: https://claude.ai/code/session_01UbiPa1rKCyqhqufgwJWkeW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
app.leaderboardjoinsgame_recordtoroom_seatonroom_id-- a room plays exactly one game for its whole lifetime (RoomService.start()refuses anything but"waiting", and nothing ever reopens one), soroom_seatalready is that game's durable participant record. No new snapshot table needed. Onlyoutcome == "finished"games count.GET /leaderboard/accounts?game=,GET /leaderboard/models?game=, both gated by a newleaderboard:viewpermission granted to every default role (admin/player/spectator) -- a leaderboard is meant to be seen, not admin-only./leaderboardpage: Accounts/Models tabs sharing one column set, plus a game filter. ExtractedCreateRoomDialog's hardcoded game catalog intolib/games.tsso the filter could reuse it.RoomService.start()(persisting a resolved default model back onto an agent seat) after empirically verifyingRoomService.create()already does this at seat-creation time -- the bug doesn't exist. Seedocs/leaderboard.mdand PROGRESS.md's Phase 12 section for the full account.30c74160ca50) seeding the new permission, since the original Phase 6 seed migration's own constants are live and re-running it would collide.Test plan
uv run pytest tests)prek run --all-filesclean (ruff, mypy, ty, biome)bun run build/bun run lintcleanClaude-Session: https://claude.ai/code/session_01UbiPa1rKCyqhqufgwJWkeW