Skip to content

Add canonical leaderboard rankings API#493

Merged
msaroufim merged 1 commit into
mainfrom
leaderboard-rankings-api
Jun 17, 2026
Merged

Add canonical leaderboard rankings API#493
msaroufim merged 1 commit into
mainfrom
leaderboard-rankings-api

Conversation

@msaroufim

Copy link
Copy Markdown
Member

Summary

  • add GET /leaderboard/{leaderboard_id}/rankings as the canonical all-GPU leaderboard ranking payload for kernelboard
  • return leaderboard metadata plus per-GPU ranked entries using kernelbot's existing get_leaderboard_submissions path
  • include submission_count in ranked entries so kernelboard can preserve its current display data
  • add a DB helper to resolve leaderboards by id

Why

Kernelboard still has direct SQL for ranking pages. That duplicates rank eligibility semantics outside kernelbot, which is how failed secret runs could still render after kernelbot's API filtering was fixed. This endpoint gives kernelboard a single canonical read path for the main leaderboard page.

Validation

  • uv run pytest -q tests/test_admin_api.py::TestClosedLeaderboardAccess::test_public_leaderboard_rankings_no_auth tests/test_admin_api.py::TestClosedLeaderboardAccess::test_missing_leaderboard_rankings_returns_404 tests/test_leaderboard_db.py::test_failed_secret_benchmark_hides_public_leaderboard_score tests/test_leaderboard_db.py::test_leaderboard_submission_count
  • uv run python -m py_compile src/kernelbot/api/main.py src/libkernelbot/leaderboard_db.py src/libkernelbot/db_types.py tests/test_admin_api.py tests/test_leaderboard_db.py
  • git diff --check

Note: full-file ruff check on the touched kernelbot files is currently noisy with pre-existing import/line-length issues outside this change.

@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/libkernelbot
  leaderboard_db.py 658-684
  utils.py
Project Total  

This report was generated by python-coverage-comment-action

@msaroufim msaroufim merged commit 1ed0734 into main Jun 17, 2026
4 checks passed
msaroufim added a commit that referenced this pull request Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant