Skip to content

fix: treat unverifiable submitter access as warning instead of error#452

Merged
jwm4 merged 2 commits into
mainfrom
fix/leaderboard-submitter-access-check
May 20, 2026
Merged

fix: treat unverifiable submitter access as warning instead of error#452
jwm4 merged 2 commits into
mainfrom
fix/leaderboard-submitter-access-check

Conversation

@jwm4
Copy link
Copy Markdown
Contributor

@jwm4 jwm4 commented May 20, 2026

Summary

  • The leaderboard validation workflow's "Verify submitter has access" step calls the GitHub collaborator API, which requires admin access on the target repo. The Actions token never has this for external repos, so the check always fails with a 403, blocking legitimate submissions.
  • Changed the failure path to emit a warning for manual review instead of hard-failing CI, matching the existing behavior for non-GitHub repos.

Fixes CI for #448.

Test plan

Generated with assistance from Claude Code by Bill Murdock.

Summary by CodeRabbit

  • Bug Fixes
    • Improved submitter access verification in CI: when verification cannot be completed (including API errors like 403), the workflow now emits a clear warning and allows the case to proceed for manual maintainer review instead of failing immediately.

The collaborator API requires admin access on the target repo, which the
Actions token never has for external repos. This caused all leaderboard
submissions for org-owned repos to fail CI with a false "no access" error.

Align the GitHub path with the non-GitHub fallback: warn maintainers to
verify manually rather than blocking the PR.

Fixes CI for #448.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

The leaderboard GitHub Actions workflow changes the submitter access check to call gh api silently (stderr suppressed) and, on non-confirmation or API errors, emit warnings asking maintainers to manually review instead of failing the workflow.

Changes

Leaderboard Submission Access Handling

Layer / File(s) Summary
Submitter access verification fallback
.github/workflows/leaderboard.yml
The workflow now calls gh api with --silent and 2>/dev/null; if collaborator/owner status can't be confirmed (including API 403), it logs warnings for manual maintainer review instead of exiting with an error.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits format with 'fix' type and clearly describes the main change: treating unverifiable submitter access as a warning instead of an error in the leaderboard workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/leaderboard-submitter-access-check
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/leaderboard-submitter-access-check

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/leaderboard.yml:
- Around line 158-165: The script incorrectly treats HTTP_CODE as an HTTP status
and assumes a 403; rename the variable (e.g., HTTP_CODE -> API_EXIT or
EXIT_CODE) to reflect it holds gh api's exit code, and update the conditional
logic/messages around the gh api "/repos/$ORG_REPO/collaborators/$SUBMITTER"
call and the else branch to not assert a specific status; instead emit a generic
warning that the API check failed (include EXIT_CODE value) and that manual
verification is required. Ensure you update references to HTTP_CODE everywhere
in this block (the gh api invocation, subsequent if/elif/else checks and the
echo warning lines) and keep the existing owner check using gh api
"/repos/$ORG_REPO" -q '.owner.login' unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 4cc2d39b-2c15-4d0a-a8b8-d69a83b9507b

📥 Commits

Reviewing files that changed from the base of the PR and between b1d60ad and 246fde3.

📒 Files selected for processing (1)
  • .github/workflows/leaderboard.yml

Comment thread .github/workflows/leaderboard.yml Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

📈 Test Coverage Report

Branch Coverage
This PR 73.7%
Main 73.7%
Diff ✅ +0%

Coverage calculated from unit tests only

Copy link
Copy Markdown
Contributor Author

@jwm4 jwm4 left a comment

Choose a reason for hiding this comment

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

Review

Overall: Looks good, with a couple of minor nits.

The problem is well-understood: the /repos/{owner}/{repo}/collaborators/{user} endpoint requires admin access, which GITHUB_TOKEN never has for external repos. This means every leaderboard submission for org-owned repos fails CI with a false negative. Converting the hard error to a warning for manual review is the right fix, and it mirrors the existing non-GitHub fallback at line 168.

Nits

  1. Misleading variable name. HTTP_CODE captures the process exit code ($?), not an HTTP status code. Calling it EXIT_CODE or RC would be more accurate.

  2. Warning message hardcodes "403". The else branch triggers for any API failure (network errors, 404, 500, etc.), but the message says (API returned 403). Something like (API check failed) would be more accurate.

  3. Unnecessary refactor of the if condition. The original if gh api ... 2>/dev/null; then already checks the exit code. You can just add --silent inline and only change the else branch:

    if gh api "/repos/$ORG_REPO/collaborators/$SUBMITTER" --silent 2>/dev/null; then
      echo "$SUBMITTER is a collaborator on $ORG_REPO"
    elif ...
      ...
    else
      echo "::warning::Cannot verify submitter access for $ORG_REPO (API check failed). Manual review required."
      echo "⚠️ Submitter access must be verified manually by maintainers."
    fi

    This is a smaller diff, easier to read, and avoids the misleading HTTP_CODE variable entirely.

What looks good

  • Correctly scoped fix: only changes the failure path, leaves the success and owner-check paths untouched
  • The elif branch (owner check via /repos/{owner}/{repo}) uses a public endpoint, so it will still work for public repos even when the collaborators check 403s
  • PR description clearly explains the root cause and links to #448
  • Aligns behavior: GitHub path now matches the non-GitHub fallback pattern

Verdict

The logic is correct and the fix addresses the real problem. The three nits above are all cosmetic. I'd suggest the simplified approach from nit #3 since it shrinks the diff and avoids the naming issue, but the current code works fine functionally.

-- Bill Murdock with assistance from Claude Code

Drop the intermediate HTTP_CODE variable and restore the original
inline `if gh api ...; then` pattern. Replace the hardcoded "403"
in the warning message with the generic "API check failed".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/leaderboard.yml:
- Around line 158-164: The workflow currently treats any non-success outcome as
"unverifiable" and warns; change the logic to three outcomes: if gh api
"/repos/$ORG_REPO/collaborators/$SUBMITTER" succeeds -> collaborator ✅; else if
gh api "/repos/$ORG_REPO" succeeds (repo exists) and the owner check (gh api
"/repos/$ORG_REPO" -q '.owner.login' == "$SUBMITTER") is false -> definitive
no-access ❌ (echo a failure message and exit 1); otherwise (any gh api call for
the repo fails) -> API-unverifiable ⚠️ (emit the warning but do not fail). Use
the existing gh api calls ("/repos/$ORG_REPO/collaborators/$SUBMITTER" and
"/repos/$ORG_REPO") and the owner check to distinguish repo-exists vs API-error
cases and ensure only the definitive no-access path fails the job.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: d1823fc0-bcca-48aa-849b-a27a0b861ac8

📥 Commits

Reviewing files that changed from the base of the PR and between 246fde3 and 10309b2.

📒 Files selected for processing (1)
  • .github/workflows/leaderboard.yml

Comment on lines +158 to +164
if gh api "/repos/$ORG_REPO/collaborators/$SUBMITTER" --silent 2>/dev/null; then
echo "✅ $SUBMITTER is a collaborator on $ORG_REPO"
elif [ "$(gh api "/repos/$ORG_REPO" -q '.owner.login')" == "$SUBMITTER" ]; then
echo "✅ $SUBMITTER is the owner of $ORG_REPO"
else
echo "::error::$SUBMITTER does not have commit access to $ORG_REPO"
exit 1
echo "::warning::Cannot verify submitter access for $ORG_REPO (API check failed). Manual review required."
echo "⚠️ Submitter access must be verified manually by maintainers."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Scope warning fallback to unverifiable cases only

This branch now warns on all non-success outcomes, so a submitter without verified access is no longer blocked. That broadens behavior beyond “unverifiable only” and weakens the gate.

Use a three-way outcome: collaborator/owner ✅, definitive no-access ❌ (fail), API-unverifiable ⚠️ (warn).

Suggested patch
-            if gh api "/repos/$ORG_REPO/collaborators/$SUBMITTER" --silent 2>/dev/null; then
+            COLLAB_STATUS="$(gh api -i "/repos/$ORG_REPO/collaborators/$SUBMITTER" 2>/dev/null || true)"
+            COLLAB_HTTP="$(printf '%s\n' "$COLLAB_STATUS" | awk 'NR==1 {print $2}')"
+            if [ "$COLLAB_HTTP" = "204" ]; then
               echo "✅ $SUBMITTER is a collaborator on $ORG_REPO"
             elif [ "$(gh api "/repos/$ORG_REPO" -q '.owner.login')" == "$SUBMITTER" ]; then
               echo "✅ $SUBMITTER is the owner of $ORG_REPO"
+            elif [ "$COLLAB_HTTP" = "404" ]; then
+              echo "::error::$SUBMITTER does not appear to have access to $ORG_REPO."
+              exit 1
             else
               echo "::warning::Cannot verify submitter access for $ORG_REPO (API check failed). Manual review required."
               echo "⚠️ Submitter access must be verified manually by maintainers."
             fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/leaderboard.yml around lines 158 - 164, The workflow
currently treats any non-success outcome as "unverifiable" and warns; change the
logic to three outcomes: if gh api "/repos/$ORG_REPO/collaborators/$SUBMITTER"
succeeds -> collaborator ✅; else if gh api "/repos/$ORG_REPO" succeeds (repo
exists) and the owner check (gh api "/repos/$ORG_REPO" -q '.owner.login' ==
"$SUBMITTER") is false -> definitive no-access ❌ (echo a failure message and
exit 1); otherwise (any gh api call for the repo fails) -> API-unverifiable ⚠️
(emit the warning but do not fail). Use the existing gh api calls
("/repos/$ORG_REPO/collaborators/$SUBMITTER" and "/repos/$ORG_REPO") and the
owner check to distinguish repo-exists vs API-error cases and ensure only the
definitive no-access path fails the job.

@jwm4 jwm4 merged commit 6302112 into main May 20, 2026
9 checks passed
@jwm4 jwm4 deleted the fix/leaderboard-submitter-access-check branch May 20, 2026 16:12
@github-actions
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.39.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant