Skip to content

Update runs#468

Merged
S1ro1 merged 4 commits into
mainfrom
auth-runs
Mar 14, 2026
Merged

Update runs#468
S1ro1 merged 4 commits into
mainfrom
auth-runs

Conversation

@S1ro1

@S1ro1 S1ro1 commented Mar 13, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 13, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces “closed” leaderboard visibility and an invite-code system (including multi-leaderboard invites) to gate access to leaderboards and related API resources.

Changes:

  • Add visibility to leaderboards and enforce access checks for closed leaderboards (API + submission pipeline).
  • Implement invite-code lifecycle: generate, claim, list, revoke; and migrate schema to support one code covering multiple leaderboards.
  • Extend admin tooling/tests to cover new endpoints and behaviors.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/migrations/20260311_01_closed-leaderboard-visibility.py Adds leaderboard.visibility and initial leaderboard_invite table.
src/migrations/20260313_01_invite-multi-leaderboard.py Converts invites to multi-leaderboard via leaderboard_invite_scope junction table.
src/libkernelbot/leaderboard_db.py Adds visibility field reads/writes + invite-code DB methods.
src/libkernelbot/db_types.py Extends LeaderboardItem TypedDict with visibility.
src/libkernelbot/submission.py Enforces closed-leaderboard submission restrictions (CLI-only + invite check).
src/libkernelbot/problem_sync.py Adds visibility option when creating leaderboards during sync.
src/libkernelbot/task.py Ensures gpus is removed from YAML before LeaderboardTask.from_dict.
src/kernelbot/api/main.py Adds optional auth for read endpoints, closed-leaderboard gating, and invite/admin endpoints.
src/kernelbot/api/api_utils.py Passes identity type into SubmissionRequest to support CLI-only enforcement.
src/kernelbot/cogs/leaderboard_cog.py Tags Discord submissions with identity_type="discord".
src/kernelbot/cogs/admin_cog.py Adds “closed” creation/sync options and passes visibility through creation paths.
tests/conftest.py Updates DB truncation list to include new invite tables.
tests/test_leaderboard_db.py Adds DB-level tests for visibility and invite behavior.
tests/test_admin_api.py Adds API tests for invite/admin endpoints and closed leaderboard access behavior.
Comments suppressed due to low confidence (1)

src/libkernelbot/problem_sync.py:234

  • sync_problems adds a new visibility parameter but the docstring’s Args section doesn’t mention it, which makes the public API misleading. Update the docstring to describe what visibility affects (create-only vs also update) and the accepted values.
def sync_problems(  # noqa: C901
    db_context,
    repository: str = "gpu-mode/reference-kernels",
    problem_set: Optional[str] = None,
    branch: str = "main",
    force: bool = False,
    creator_id: int = 0,
    forum_id: int = -1,
    visibility: str = "public",
) -> SyncResult:
    """Sync problems from a GitHub repository.

    Downloads the repository, parses competition YAML files, and creates/updates leaderboards.

    Args:
        db_context: Database context manager
        repository: Repository in "owner/repo" format
        problem_set: Specific problem set to sync, or None for all
        branch: Branch to download
        force: If True, allow significant task changes
        creator_id: ID of the creator (0 for API)
        forum_id: Discord forum ID (-1 for API)

    Returns:
        SyncResult with created, updated, skipped, and errors lists
    """

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/libkernelbot/leaderboard_db.py Outdated
Comment on lines +772 to +782
lb_id = self.get_leaderboard_id(leaderboard_name)
self.cursor.execute(
"""
UPDATE leaderboard.leaderboard
SET visibility = %s
WHERE id = %s
""",
(visibility, lb_id),
)
self.connection.commit()

Comment thread src/migrations/20260313_01_invite-multi-leaderboard.py
Comment thread src/kernelbot/api/main.py
Comment thread src/libkernelbot/submission.py
Comment thread src/libkernelbot/leaderboard_db.py Outdated
Comment thread tests/test_admin_api.py
Comment thread src/kernelbot/api/main.py
Comment thread src/libkernelbot/leaderboard_db.py Outdated
Comment thread src/libkernelbot/leaderboard_db.py Outdated
@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  src/libkernelbot
  db_types.py
  leaderboard_db.py 631, 678-679, 730, 765-766, 777-792, 811-812
  problem_sync.py 289
  submission.py 67-72
  task.py 167
  utils.py
Project Total  

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

@S1ro1 S1ro1 merged commit b06c760 into main Mar 14, 2026
4 checks passed
SinatrasC pushed a commit to SinatrasC/kernelbot that referenced this pull request Jun 17, 2026
* Update runs

* Cleanup

* Defaults
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.

3 participants