Add admin after-deadline submission endpoint#506
Merged
Conversation
Add POST /admin/submission/{leaderboard}/{gpu}/{mode}, which lets an
authenticated user's submission bypass a leaderboard's deadline, gated by
the admin token. A keyword-only allow_after_deadline flag is threaded
through prepare_submission so that only the deadline check is skipped; ban,
rate-limit, closed-leaderboard access, and GPU-availability checks all
still apply.
Also harden require_admin to compare the bearer token on bytes, avoiding a
TypeError (500) on malformed non-ASCII Authorization headers.
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
msaroufim
approved these changes
Jul 1, 2026
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
Adds an admin-gated endpoint to queue a submission for a leaderboard whose deadline has already passed.
POST /admin/submission/{leaderboard_name}/{gpu_type}/{submission_mode}— requires both the admin token (Authorization: Bearer …) and a valid user auth header (X-Popcorn-Cli-Id/X-Web-Auth-Id). The submission is attributed to the authenticated user and runs the requested mode (test/benchmark/profile/leaderboard).allow_after_deadlineflag toprepare_submission. When set, only the deadline check is skipped; ban checks, rate limits, closed-leaderboard access, and GPU-availability validation all still apply. The three existing callers are unaffected.require_adminnow compares the bearer token on bytes (constant-time), avoiding aTypeError/500 on malformed non-ASCIIAuthorizationheaders.Testing
uv run pytest tests/test_admin_api.py tests/test_submission.py— 69 passeduv run ruff check . --exclude examples/ --line-length 120— clean