Skip to content

fix(ci): use a colon-prefixed branch for fork tokenless Codecov uploads - #2363

Merged
JSONbored merged 1 commit into
mainfrom
fix/codecov-tokenless-branch-format
Jul 1, 2026
Merged

fix(ci): use a colon-prefixed branch for fork tokenless Codecov uploads#2363
JSONbored merged 1 commit into
mainfrom
fix/codecov-tokenless-branch-format

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Fixes a live CI failure hit on a real fork PR rebase: the fork-tokenless Codecov upload steps (added in fix(ci): close the fork-PR codecov/patch silent-pass gap #2273) started failing with Upload queued for processing failed: {"message":"Token required because branch is protected"}.
  • Root cause: override_branch was set to the bare fork branch name (e.g. feat/mcp-block-explorer-feed-filters). Per Codecov's own docs, only a branch string with a colon-separated prefix (e.g. forkname:branch) is recognized as "unprotected" and eligible for a tokenless upload — a bare name looks like it could be a real (possibly protected) branch on the base repo and gets rejected, even with zero token configuration anywhere. Confirmed directly in codecov-cli's source (services/commit/__init__.py): if branch and ":" in branch: ... elif token is None: # protected, warns/rejects. codecov-cli's own auto-detection never adds this prefix either (checked helpers/ci_adapters/github_actions.py_get_branch() returns the bare GITHUB_HEAD_REF), so it has to be supplied explicitly by the caller.
  • Fix: prefix override_branch with the fork owner (${{ github.event.pull_request.head.repo.owner.login }}:${{ github.event.pull_request.head.ref }}) on both fork-tokenless upload steps. override_commit/override_pr are untouched — the protected-branch check only inspects the branch string.

Why

Follow-up to #2273. The prior fix correctly attributed fork-tokenless uploads to the real PR head sha (closing a misattribution gap flagged by the gate's own AI review), but didn't account for Codecov's separate "is this branch protected" check, which is evaluated purely on the branch string format. This is a live, user-reported failure on an actual contributor PR rebase, not a theoretical concern.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused (CI workflow only).
  • This follows CONTRIBUTING.md.
  • No issue linked — direct follow-up fix for a live CI failure discovered and diagnosed in this session.

Validation

  • git diff --check
  • npm run actionlint
  • npm run test:coverage locally (no src/** lines changed; test/unit/codecov-policy.test.ts updated with assertions for the colon-prefixed branch format)
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • test/unit/codecov-policy.test.ts extended to assert the fork-tokenless steps' override_branch contains a colon and matches the owner:branch format

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise.
  • Auth/CORS/session negative-path tests — N/A, no such change.
  • API/OpenAPI/MCP behavior — N/A.
  • UI changes — N/A, CI-only change.
  • Public docs/changelogs — N/A.

A real fork PR rebase (gittensory#2496-equivalent traffic) hit "Token
required because branch is protected" on the tokenless upload. Per
Codecov's own docs, only a branch string with a colon-separated prefix
(e.g. forkname:branch) is recognized as unprotected/tokenless-eligible;
a bare branch name looks like it could be a real branch on the base repo
and gets rejected even with no token configured anywhere. codecov-cli's
own auto-detection never adds this prefix (confirmed in its source), so
override_branch must supply it explicitly. override_commit/override_pr
are unaffected -- the protected-branch check only inspects the branch
string.
@loopover-orb

loopover-orb Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Important

🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪

🔍 Gittensory is reviewing…

AI analysis is in progress. This comment will update when the review is complete.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing

@JSONbored
JSONbored merged commit 859f8ef into main Jul 1, 2026
9 checks passed
@JSONbored
JSONbored deleted the fix/codecov-tokenless-branch-format branch July 1, 2026 12:18
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jul 1, 2026
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.71%. Comparing base (ec131cf) to head (dd70688).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2363   +/-   ##
=======================================
  Coverage   95.71%   95.71%           
=======================================
  Files         222      222           
  Lines       24655    24655           
  Branches     8946     8946           
=======================================
  Hits        23599    23599           
  Misses        433      433           
  Partials      623      623           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant