Repository navigation
Fix LLVM Coverage job - skip non-C++ files - #99103
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the LLVM differential coverage CI job to ignore PRs that don’t touch C/C++ sources, preventing failures on non-C++-only changes.
Changes:
- Add a stateless SQL test to represent a “non-C++ only” PR change set.
- Filter changed files down to C/C++ extensions before running
lcov --extract, and skip the report when none match. - Harden the coverage-report script with
set -euo pipefailand required env var validation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/queries/0_stateless/04032_test_non_cpp_coverage.sql | Adds a minimal SQL query so a PR can consist only of non-C++ changes. |
| tests/queries/0_stateless/04032_test_non_cpp_coverage.reference | Adds the expected output for the new stateless test. |
| ci/jobs/scripts/generate_diff_coverage_report.sh | Filters changed files to C/C++ and conditionally skips coverage extraction/report generation. |
| CMakeLists.txt | Adds a comment clarifying CI behavior for differential coverage. |
Comments suppressed due to low confidence (1)
ci/jobs/scripts/generate_diff_coverage_report.sh:1
- With
set -uenabled, referencing${PR_NUMBER}will terminate the script ifPR_NUMBERis unset. Use a default expansion (e.g.,${PR_NUMBER:-}) in the conditional and when interpolating to keepPR_NUMBERoptional.
#!/bin/bash
| lcov --extract llvm_coverage.info "${patterns[@]}" \ | ||
| --ignore-errors inconsistent,corrupt \ | ||
| --quiet \ | ||
| -o current.changed.info 2>/dev/null | ||
| -o current.changed.info | ||
|
|
||
| lcov --extract base_llvm_coverage.info "${patterns[@]}" \ | ||
| --ignore-errors inconsistent,corrupt \ | ||
| --quiet \ | ||
| -o baseline.changed.info 2>/dev/null | ||
| -o baseline.changed.info |
There was a problem hiding this comment.
With set -e enabled, lcov --extract returning a non-zero exit (e.g., when patterns match no entries in the .info) will abort the whole script. To keep “no coverage entries for changed files” from becoming a job failure, handle these calls explicitly (e.g., tolerate specific non-zero outcomes and/or check whether the output .info contains any records before proceeding).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| Shell.get_output( | ||
| "gh pr view --json number -q .number", verbose=True | ||
| ).strip() | ||
| or 0 |
There was a problem hiding this comment.
Removing or 0 fallback crashes job on master branch
High Severity
The or 0 fallback was removed from the pr_number resolution in get_git_info(). On master/push events, info.pr_number is 0 (confirmed in _environment.py line 106), so the else branch executes gh pr view --json number -q .number. On master there is no associated PR, so this command returns an empty string. int("".strip()) raises a ValueError, crashing the entire coverage job. The or 0 was the safety net for this exact scenario.
| _comment_data = { | ||
| # GitHub comment fields | ||
| "b_line_cov": b_line_cov, | ||
| "c_line_cov": c_line_cov, |
There was a problem hiding this comment.
Non-existent log file appended when diff skipped
Low Severity
When _diff_inputs_exist is False, the tee command that creates the log file at _print_log is never executed, yet print_res.files.append(_print_log) runs unconditionally on line 272. This adds a reference to a non-existent file, which triggers a warning during upload and sets a misleading "file not found" info message on the result. The append of _print_log needs to be inside the if _diff_inputs_exist block or guarded by a file-existence check.


Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Note
Medium Risk
Touches CI coverage gating and artifact-upload conditions; main risk is silently skipping expected diff reports or changing failure behavior in coverage-related jobs.
Overview
Fixes LLVM differential coverage reporting to only run when C/C++ sources changed and to avoid producing misleading/empty artifacts.
The diff-generation script now filters changed files by C/C++ extensions, validates required env vars, fails fast on missing baseline/inputs, and exits cleanly when no relevant files changed. The Python coverage job then treats the presence of the diff report directory as the signal that the diff actually ran, gating HTML uploads, uncovered-code analysis, and GitHub/CIDB comment generation accordingly.
Additionally, functional and integration LLVM coverage jobs now attach the merged
.profdatato the CI Result so it uploads even on test failure, and the runner now uploads provided artifacts even when a job is marked non-blocking viado_not_block_pipeline_on_failure.Written by Cursor Bugbot for commit 157faca. This will update automatically on new commits. Configure here.
Version info
26.3.1.545