Skip to content

Fix LLVM Coverage job failure when PR has no source code changes - #99032

Closed
alexey-milovidov wants to merge 2 commits into
masterfrom
fix-llvm-coverage-no-code-changes
Closed

alexey-milovidov wants to merge 2 commits into
masterfrom
fix-llvm-coverage-no-code-changes

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Mar 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The LLVM Coverage job fails when a PR only changes non-source files (e.g. .sh test scripts)
  • lcov --extract produces empty output for non-source files, genhtml fails on empty input (exit code 2), and then llvm_coverage_job.py crashes trying to compress the non-existent llvm_coverage_diff_html_report directory
  • Fix: early exit in generate_diff_coverage_report.sh when no coverage data exists for changed files, and guard compress/archive operations in llvm_coverage_job.py

Failing CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99018&sha=df6f0da97c5b87721cde0190e310431d826349d5&name_0=PR&name_1=LLVM%20Coverage
#99018

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

🤖 Generated with Claude Code


Note

Low Risk
Low risk CI-only change that adds guards/early-exits around diff coverage report generation to avoid failures when no source files are covered. Main risk is reduced visibility if the presence checks mis-detect and skip a diff report unexpectedly.

Overview
Prevents the LLVM Coverage CI job from failing when changed files produce no lcov coverage data (e.g. PRs that only modify scripts/tests).

generate_diff_coverage_report.sh now exits early before running genhtml if lcov --extract yields an empty .info (no SF: entries). llvm_coverage_job.py now conditionally compresses/uploads the diff HTML report and only emits diff report links/diff_url when the diff report directory/archive actually exists.

Written by Cursor Bugbot for commit 12048a5. This will update automatically on new commits. Configure here.

The job failed when a PR only changed non-source files (e.g. `.sh` test
scripts): `lcov --extract` produced empty output, `genhtml` failed on
the empty input, and then `llvm_coverage_job.py` crashed trying to
compress the non-existent `llvm_coverage_diff_html_report` directory.

Two fixes:
- In `generate_diff_coverage_report.sh`: after `lcov --extract`, check
  if the output contains any `SF:` records; exit 0 early if not.
- In `llvm_coverage_job.py`: guard compress and archive operations on
  the diff report directory actually existing.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=99018&sha=df6f0da97c5b87721cde0190e310431d826349d5&name_0=PR&name_1=LLVM%20Coverage

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [12048a5]

Summary: ❌

job_name test_name status info comment
LLVM Coverage error

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Mar 9, 2026
Comment thread ci/jobs/llvm_coverage_job.py Resolved
When changed files have no coverage data, the diff HTML report is never
created. Guard the diff URL in `coverage_comment.json` and in
`report_links` on the diff report actually existing, to avoid broken S3
links in the GitHub PR comment and job results.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

f"{_s3_base}/llvm_coverage/generate_llvm_coverage_diff_report/index_diff.html"
if _has_diff_report
else ""
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty diff URL produces broken GitHub comment link

Medium Severity

When _has_diff_report is False, _diff_url is set to "" and written into coverage_comment.json. The downstream hook in llvm_coverage_hook.py unconditionally renders f"\n[Diff coverage report]({diff_url})" (line 52), producing a broken empty markdown link [Diff coverage report]() in the GitHub PR comment. Before this change, the job would crash in this scenario so the hook never ran; now the job succeeds but the comment is malformed. The empty _diff_url case needs to be handled so the link row is omitted or shows a meaningful message.

Additional Locations (1)

Fix in Cursor Fix in Web

@alexbakharew

Copy link
Copy Markdown
Contributor

I would like to merge another version of the fix. In current PR we deal with results which are empty. In my version all not related to coverage files will be simply excluded

@alexey-milovidov

Copy link
Copy Markdown
Member Author

@alexbakharew, Ok. Just don't forget to update all the affected PRs.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants