Skip to content

ci: Add Codecov coverage for cluster simulator groups - #5974

Open
wazir-ahmed wants to merge 3 commits into
v3.0from
ci/simulator-codecov
Open

ci: Add Codecov coverage for cluster simulator groups#5974
wazir-ahmed wants to merge 3 commits into
v3.0from
ci/simulator-codecov

Conversation

@wazir-ahmed

@wazir-ahmed wazir-ahmed commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Build the shared cluster simulator runtime with GCOV instrumentation
  • Cache the GCOV metadata required to generate coverage in the simulator test jobs
  • Upload coverage from all six simulator groups under the shared simulation-tests Codecov flag

Context

PR #5861 added CI execution for all registered cluster_sim_* groups, but
their coverage was not included in Codecov. This follow-up adds the missing
coverage upload.

Related PRs

Summary by CodeRabbit

Summary by CodeRabbit

  • Tests

    • Improved automated test coverage across cluster simulation and TAP test suites.
    • Enhanced coverage artifact collection for more complete reporting.
  • Chores

    • Updated continuous integration to use the Ubuntu 24 build environment.
    • Added reliable, non-blocking coverage reporting for each test configuration.
    • Refreshed build caching to improve CI consistency.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 44f8b2d0-63b5-4317-a888-4fa3d5bb8930

📥 Commits

Reviewing files that changed from the base of the PR and between 811bedb and 759df72.

📒 Files selected for processing (2)
  • .github/workflows/CI-cluster-simulator.yml
  • test/infra/control/cluster-simulator-ci.bash
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/CI-cluster-simulator.yml
  • test/infra/control/cluster-simulator-ci.bash
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Gitar

📝 Walkthrough

Walkthrough

The cluster simulator CI now uses Ubuntu 24 builds, enables gcov coverage, stages coverage artifacts, and conditionally uploads per-matrix reports to Codecov using OIDC.

Changes

Cluster simulator coverage

Layer / File(s) Summary
Generate and stage coverage artifacts
test/infra/control/cluster-simulator-ci.bash
The simulator uses the Ubuntu 24 packaging target, enables gcov instrumentation for build and TAP targets, and stages .gcno files.
Publish matrix coverage
.github/workflows/CI-cluster-simulator.yml
The workflow updates its cache key and OIDC permissions, enables coverage for matrix jobs, and conditionally uploads per-matrix reports to Codecov.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 759df

This PR adds coverage collection for the cluster simulator CI jobs without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Build as cluster-simulator-ci.bash
  participant Stage as Staging payload
  participant CI as CI matrix job
  participant Codecov
  Build->>Build: Run builds with WITHGCOV=1
  Build->>Stage: Stage .gcno coverage artifacts
  Stage->>CI: Provide coverage inputs
  CI->>Codecov: Upload per-matrix .info report via OIDC
Loading

Possibly related PRs

Suggested reviewers: renecannao

Poem

A rabbit watched the gcov files grow,
Then staged their hops in Ubuntu’s glow.
Matrix reports flew through the night,
OIDC guided each one right.
“To Codecov!” cried the bunny below.

🚥 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 clearly and concisely describes the main change: adding Codecov coverage collection for cluster simulator groups.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/simulator-codecov

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/CI-cluster-simulator.yml:
- Line 21: Move id-token: write from the workflow-level permissions to the test
job’s permissions, leaving only contents: read at the top level so checkout
continues to work. Ensure the test job retains both contents: read and id-token:
write, while other jobs do not receive OIDC permission.
- Line 128: Update the Codecov action reference in the workflow step from the
mutable v4 tag to the verified 40-character commit SHA for the intended v4
release, preserving the trailing comment “# Codecov Action v4”.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2066968e-b613-4de2-968a-fa41ff3c2a36

📥 Commits

Reviewing files that changed from the base of the PR and between b3dd57d and 5fb969d.

📒 Files selected for processing (2)
  • .github/workflows/CI-cluster-simulator.yml
  • test/infra/control/cluster-simulator-ci.bash
📜 Review details
⏰ Context from checks skipped due to timeout. (6)
  • GitHub Check: CI-builds / builds (debian12,-dbg)
  • GitHub Check: CI-builds / builds (ubuntu22,-tap-mysqlx)
  • GitHub Check: CI-builds / builds (ubuntu22,-tap)
  • GitHub Check: CI-builds / builds (ubuntu24,-tap-genai-gcov)
  • GitHub Check: run / trigger
  • GitHub Check: build
🧰 Additional context used
🪛 GitHub Check: SonarCloud Code Analysis
.github/workflows/CI-cluster-simulator.yml

[warning] 21-21: Move this write permission from workflow level to job level.

See more on https://sonarcloud.io/project/issues?id=sysown_proxysql&issues=AZ-zwi53zvf-vBpBW9t3&open=AZ-zwi53zvf-vBpBW9t3&pullRequest=5974


[failure] 128-128: Use full commit SHA hash for this dependency.

See more on https://sonarcloud.io/project/issues?id=sysown_proxysql&issues=AZ-zwi53zvf-vBpBW9t2&open=AZ-zwi53zvf-vBpBW9t2&pullRequest=5974

🪛 zizmor (1.28.0)
.github/workflows/CI-cluster-simulator.yml

[error] 21-21: overly broad permissions (excessive-permissions): id-token: write is overly broad at the workflow level

(excessive-permissions)

🔇 Additional comments (3)
test/infra/control/cluster-simulator-ci.bash (2)

207-210: LGTM!


262-268: LGTM!

.github/workflows/CI-cluster-simulator.yml (1)

89-89: LGTM!

Comment thread .github/workflows/CI-cluster-simulator.yml Outdated
Comment thread .github/workflows/CI-cluster-simulator.yml Outdated
@wazir-ahmed
wazir-ahmed force-pushed the ci/simulator-codecov branch from 5fb969d to c4f8599 Compare July 30, 2026 16:15
@wazir-ahmed
wazir-ahmed marked this pull request as ready for review July 30, 2026 16:16
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

- Build the shared simulator runtime with GCOV instrumentation
- Cache the GCOV metadata required to generate coverage in the simulator test jobs
- Upload simulator coverage under a shared Codecov flag

Signed-off-by: Wazir Ahmed <wazir@proxysql.com>
@wazir-ahmed
wazir-ahmed force-pushed the ci/simulator-codecov branch from c4f8599 to a058387 Compare July 30, 2026 17:15
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.60%. Comparing base (811bedb) to head (759df72).
⚠️ Report is 41 commits behind head on v3.0.

Additional details and impacted files
@@            Coverage Diff             @@
##             v3.0    #5974      +/-   ##
==========================================
+ Coverage   49.83%   53.60%   +3.77%     
==========================================
  Files         386      504     +118     
  Lines      121339   148005   +26666     
  Branches    31988    37488    +5500     
==========================================
+ Hits        60472    79344   +18872     
- Misses      47385    51120    +3735     
- Partials    13482    17541    +4059     
Flag Coverage Δ
integration-tests 49.40% <ø> (+5.08%) ⬆️
unit-tests 16.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Scope OIDC permissions to simulator test jobs and pin the Codecov action to the reviewed v4.6.0 commit.

Signed-off-by: Wazir Ahmed <wazir@proxysql.com>
@wazir-ahmed
wazir-ahmed requested a review from renecannao July 31, 2026 05:16
Signed-off-by: Wazir Ahmed <wazir@proxysql.com>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

Comment on lines +264 to +270
install -d \
"${STAGE_TEMP_DIR}/lib/obj" \
"${STAGE_TEMP_DIR}/src/obj"
cp -a "${REPO_ROOT}"/lib/obj/*.gcno \
"${STAGE_TEMP_DIR}/lib/obj/"
cp -a "${REPO_ROOT}"/src/obj/*.gcno \
"${STAGE_TEMP_DIR}/src/obj/"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Edge Case: Unguarded .gcno glob can hard-fail the whole build job

In handle_stage, cp -a "${REPO_ROOT}"/lib/obj/*.gcno ... and the src/obj equivalent run under set -euo pipefail without nullglob. If either directory contains no .gcno files (e.g. a build variant that doesn't instrument that tree, or WITHGCOV not taking effect), the glob stays literal, cp fails, and the entire staging step—and thus the ~90-minute build job with no cache saved—fails. Consider guarding the copy so missing coverage metadata degrades gracefully rather than aborting the build.

Use nullglob so empty matches are skipped instead of aborting under set -e.:

install -d \
    "${STAGE_TEMP_DIR}/lib/obj" \
    "${STAGE_TEMP_DIR}/src/obj"
shopt -s nullglob
for gcno in "${REPO_ROOT}"/lib/obj/*.gcno; do
    cp -a "${gcno}" "${STAGE_TEMP_DIR}/lib/obj/"
done
for gcno in "${REPO_ROOT}"/src/obj/*.gcno; do
    cp -a "${gcno}" "${STAGE_TEMP_DIR}/src/obj/"
done
shopt -u nullglob
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown
CI failed: Build failure in the cluster simulator test suite due to missing coverage library linkage flags (-lgcov / --coverage) causing undefined gcov references.

Overview

1 log analyzed showing a build/linking failure during cluster simulator unit tests introduced in the Codecov CI integration changes.

Failures

Cluster Simulator Linker Error (confidence: high)

  • Type: build
  • Affected jobs: 94507828146
  • Related to change: yes
  • Root cause: Undefined references to __gcov_init, __gcov_exit, and __gcov_merge_add when linking test binaries like common_utils_unit-t in test/deps/cluster_simulator, because coverage instrumentation is enabled without proper -lgcov linkage flags in the Makefile.
  • Suggested fix: Update the Makefile in test/deps/cluster_simulator to include -lgcov or --coverage when linking test binaries.

Summary

  • Change-related failures: 1 build error related to missing code coverage library linkage in the new cluster simulator codecov workflow.
  • Infrastructure/flaky failures: None
  • Recommended action: Update the test Makefile in test/deps/cluster_simulator to correctly link -lgcov for targets compiled with code coverage.
Code Review 👍 Approved with suggestions 0 resolved / 1 findings

Adds Codecov coverage reporting and GCOV instrumentation for cluster simulator test groups. Consider guarding the .gcno file globbing pattern in handle_stage to prevent hard failures if no matching files are found.

💡 Edge Case: Unguarded .gcno glob can hard-fail the whole build job

📄 test/infra/control/cluster-simulator-ci.bash:264-270

In handle_stage, cp -a "${REPO_ROOT}"/lib/obj/*.gcno ... and the src/obj equivalent run under set -euo pipefail without nullglob. If either directory contains no .gcno files (e.g. a build variant that doesn't instrument that tree, or WITHGCOV not taking effect), the glob stays literal, cp fails, and the entire staging step—and thus the ~90-minute build job with no cache saved—fails. Consider guarding the copy so missing coverage metadata degrades gracefully rather than aborting the build.

Use nullglob so empty matches are skipped instead of aborting under set -e.
install -d \
    "${STAGE_TEMP_DIR}/lib/obj" \
    "${STAGE_TEMP_DIR}/src/obj"
shopt -s nullglob
for gcno in "${REPO_ROOT}"/lib/obj/*.gcno; do
    cp -a "${gcno}" "${STAGE_TEMP_DIR}/lib/obj/"
done
for gcno in "${REPO_ROOT}"/src/obj/*.gcno; do
    cp -a "${gcno}" "${STAGE_TEMP_DIR}/src/obj/"
done
shopt -u nullglob
🤖 Prompt for agents
Code Review: Adds Codecov coverage reporting and GCOV instrumentation for cluster simulator test groups. Consider guarding the .gcno file globbing pattern in handle_stage to prevent hard failures if no matching files are found.

1. 💡 Edge Case: Unguarded .gcno glob can hard-fail the whole build job
   Files: test/infra/control/cluster-simulator-ci.bash:264-270

   In handle_stage, `cp -a "${REPO_ROOT}"/lib/obj/*.gcno ...` and the src/obj equivalent run under `set -euo pipefail` without nullglob. If either directory contains no `.gcno` files (e.g. a build variant that doesn't instrument that tree, or WITHGCOV not taking effect), the glob stays literal, `cp` fails, and the entire staging step—and thus the ~90-minute build job with no cache saved—fails. Consider guarding the copy so missing coverage metadata degrades gracefully rather than aborting the build.

   Fix (Use nullglob so empty matches are skipped instead of aborting under set -e.):
   install -d \
       "${STAGE_TEMP_DIR}/lib/obj" \
       "${STAGE_TEMP_DIR}/src/obj"
   shopt -s nullglob
   for gcno in "${REPO_ROOT}"/lib/obj/*.gcno; do
       cp -a "${gcno}" "${STAGE_TEMP_DIR}/lib/obj/"
   done
   for gcno in "${REPO_ROOT}"/src/obj/*.gcno; do
       cp -a "${gcno}" "${STAGE_TEMP_DIR}/src/obj/"
   done
   shopt -u nullglob

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

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