Skip to content

Upload coverage for merge queue commits so Codecov compares against the right base - #4403

Draft
DonOmalVindula wants to merge 1 commit into
thunder-id:mainfrom
DonOmalVindula:ci/codecov-main-reports
Draft

Upload coverage for merge queue commits so Codecov compares against the right base#4403
DonOmalVindula wants to merge 1 commit into
thunder-id:mainfrom
DonOmalVindula:ci/codecov-main-reports

Conversation

@DonOmalVindula

Copy link
Copy Markdown
Contributor

Purpose

Make Codecov's own patch coverage number correct, so the patch coverage gate can rely on it instead of computing patch coverage locally.

Refs #4268.

Codecov's patch total currently describes a wider range of commits than the pull request. On #4397, a CI-only change, Codecov reported 100% patch coverage: it compared head 7e9cb078 against base ddfe60e0 instead of the branch point 586dc497, and the two covered lines it counted came from backend/internal/idp/{constants,utils}.go in an unrelated commit. Across the open pull requests where the base can be checked, Codecov's comparison base matched the branch point in 0 of 6, with the same stale base reused across unrelated pull requests (54a48822 for #4398 and #4358, 08795e4e for #4390 and #4380).

Root cause

All four Codecov uploads were skipped on merge_group, and pr-builder.yml is the only workflow that uploads coverage, so no coverage was ever uploaded for a main commit:

  • The merge queue commit is what lands on main. Confirmed on recent queue runs: their head commits are ancestors of main.
  • Skipping the upload there left main commits without a coverage report.
  • Codecov needs a base that has a report, so for each pull request it walked back from the branch point to whichever older main commit still had one.
  • Its patch total then spans that older base to the head, sweeping in unrelated commits.

So the wrong numbers were not a Codecov defect and not a flaw in the local computation; they were caused by our own pipeline never giving Codecov a report for main.

Approach

The if: github.event_name != 'merge_group' guard is removed from the four upload steps (backend unit, console, gate, and the integration matrix). A merge queue run already executes all of those jobs, so it now produces the same six uploads a pull request does, matching after_n_builds: 6 in codecov.yml. Every commit that lands on main gets a complete report, and Codecov's base for later pull requests becomes the branch point.

codecov-merge-queue-status stays. Its purpose narrows to what it actually guards: Codecov not reporting a status back on a queue commit in time. The comment is updated accordingly, since its previous wording implied queue commits cannot carry coverage data at all.

Effect

Once main commits carry reports, Codecov compares each pull request against its branch point, its patch total describes that pull request's diff, and the gate's Codecov path becomes authoritative. The base check added in #4397 then passes instead of handing over to the local computation, so the local path returns to being a fallback for when Codecov is unavailable. This is also the precondition for retiring the custom gate entirely.

The effect is not retroactive: bases correct themselves as commits land on main with reports.

Risk

With a real report present, Codecov may begin posting statuses on queue commits, which could race the codecov-merge-queue-status stamp if it later reports a different result. codecov/patch is currently not a required check and is not posting at all, so this is theoretical today, but it is worth watching on the first few queue entries after this merges.

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
    • Ran Vale and fixed all errors and warnings
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@DonOmalVindula, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 8 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d08adad-6d83-4db1-b8a3-a72ad903aa46

📥 Commits

Reviewing files that changed from the base of the PR and between bb3ee16 and 2fbc9a1.

📒 Files selected for processing (1)
  • .github/workflows/pr-builder.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@DonOmalVindula DonOmalVindula added Type/Improvement trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes labels Jul 28, 2026
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@DonOmalVindula
DonOmalVindula marked this pull request as draft July 30, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trigger-pr-builder Add when the PR is ready for CI; starts the PR Builder for this and all later pushes Type/Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant