Skip to content

Add admin after-deadline submission endpoint#506

Merged
msaroufim merged 1 commit into
mainfrom
admin-after-deadline-submit
Jul 1, 2026
Merged

Add admin after-deadline submission endpoint#506
msaroufim merged 1 commit into
mainfrom
admin-after-deadline-submit

Conversation

@SinatrasC

Copy link
Copy Markdown
Contributor

Summary

Adds an admin-gated endpoint to queue a submission for a leaderboard whose deadline has already passed.

  • New endpoint 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).
  • Scoped deadline bypass — adds a keyword-only allow_after_deadline flag to prepare_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.
  • Hardeningrequire_admin now compares the bearer token on bytes (constant-time), avoiding a TypeError/500 on malformed non-ASCII Authorization headers.

Testing

  • uv run pytest tests/test_admin_api.py tests/test_submission.py — 69 passed
  • uv run ruff check . --exclude examples/ --line-length 120 — clean

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.
@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/libkernelbot
  submission.py
  utils.py
Project Total  

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

@msaroufim msaroufim merged commit 2c37531 into main Jul 1, 2026
4 checks passed
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.

2 participants