Skip to content

CI: fix Scrutinizer coverage upload tagged to wrong commit revision#116

Closed
aik099 wants to merge 1 commit into
masterfrom
ci/fix-scrutinizer-revision-mismatch
Closed

CI: fix Scrutinizer coverage upload tagged to wrong commit revision#116
aik099 wants to merge 1 commit into
masterfrom
ci/fix-scrutinizer-revision-mismatch

Conversation

@aik099

@aik099 aik099 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Problem

After #115 fixed the dead ocular.phar download URL, coverage uploads to Scrutinizer succeed (e.g. Uploading code coverage for repository "g/aik099/CodingStandard" and revision "997bb8dd..."... Done in #114's logs), but the "Scrutinizer" GitHub status check still errors out on PRs.

Root cause: ocular.phar code-coverage:upload defaults --revision to git rev-parse HEAD. On a pull_request-triggered workflow run, actions/checkout checks out GitHub's ephemeral merge commit (combining base + head), not the PR branch's actual head commit — so the uploaded coverage gets tagged to that merge commit's SHA (997bb8dd... in the example above), which is a different SHA on every run and not the commit Scrutinizer's own inspection is tracking (the actual PR head, e.g. 2569dd9c...). Scrutinizer's inspection never finds coverage for the commit it's watching and the check errors out.

Fix

Pass --revision explicitly to both ocular.phar/ocular invocations, preferring the real PR head SHA when available:

--revision="${{ github.event.pull_request.head.sha || github.sha }}"

github.event.pull_request.head.sha is only set on pull_request events (where the mismatch happens); it falls back to github.sha for plain push runs, where git rev-parse HEAD already matched anyway.

On pull_request-triggered runs, actions/checkout checks out the ephemeral
merge commit, not the PR branch's head commit. ocular.phar defaults
--revision to `git rev-parse HEAD`, so coverage was being uploaded tagged
to that merge commit's SHA. Scrutinizer's own inspection tracks the real
PR head commit, never finds matching coverage for it, and the "Scrutinizer"
check errors out waiting for data that was uploaded under the wrong revision.

Pass --revision explicitly, preferring the PR head SHA over $GITHUB_SHA.
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.73%. Comparing base (fe2bae3) to head (4a6edfc).

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #116   +/-   ##
=========================================
  Coverage     97.73%   97.73%           
  Complexity      498      498           
=========================================
  Files            29       29           
  Lines          1460     1460           
=========================================
  Hits           1427     1427           
  Misses           33       33           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aik099

aik099 commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Closing — confirmed via Scrutinizer's own API (/api/repositories/g/aik099/CodingStandard/inspections) that the "Scrutinizer" check has been erroring in the analysis phase (not coverage) on every branch, including plain master pushes, since sometime during 2021-2025 — well before today's changes and unrelated to revision/SHA matching. This --revision fix doesn't address the actual cause, so no reason to keep it open.

@aik099 aik099 closed this Jul 23, 2026
@aik099
aik099 deleted the ci/fix-scrutinizer-revision-mismatch branch July 23, 2026 11:25
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.

1 participant