Packs / leaderboards-public
run-a-score-leaderboard-with-seasons
Run a leaderboard: ingest signed scores, rank them (competition or dense ranking), reset per season and export CSV
Install
logicpacks pack use leaderboards-public/run-a-score-leaderboard-with-seasonsget_pack leaderboards-public/run-a-score-leaderboard-with-seasonsThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
- LB_HMAC_SECRET
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
stdlib-sqlitevalkey-sorted-sets - Checks: 2 in
outcome/checks.yaml - Code:
leaderboard.py - Tools: python3
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Run a leaderboard: ingest signed scores, rank them (competition or dense ranking), reset per season and export CSV
Goal
Players see a correct ranked board per season, ties handled (1,2,2,4), and the board exports to CSV.
Steps
- Pick the board and season keys (e.g. board=game, season=2026-12).
- Clients submit {board, season, player, score, ts, nonce, sig} with sig = HMAC(LB_HMAC_SECRET, fields) computed server-side by the game server.
leaderboard.py ingest scores.jsonlthentop --board B --season S [--mode dense] --csv.- New season = new season key; old seasons stay queryable.
Edge cases
- Equal scores: competition ranking (1,2,2,4) by default; dense (1,2,2,3) on request.
- Best score per player counts (max); change to sum for cumulative boards.
Don'ts
- Don't sign scores in the browser (the secret would leak).
- Don't delete old seasons.