Skip to content

Add scheduled CoverageReport workflow publishing the master LLVM coverage report - #124765

Merged
fm4v merged 1 commit into
masterfrom
nik/coverage-report-workflow
Oct 9, 2026
Merged

fm4v merged 1 commit into
masterfrom
nik/coverage-report-workflow

Conversation

@fm4v

@fm4v fm4v commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Adds a scheduled CoverageReport workflow (ci/workflows/coverage_report.py, cron 0 */3 * * *, workflow_dispatch is added by praktika for every schedule workflow) that produces the master LLVM coverage report served at https://coverage.clickhouse.com/. The generated .github/workflows/coverage_report.yml is committed (PYTHONPATH=./ci:. python3 -m praktika yaml, no other generated file changed).

Motivation: the coverage jobs are being removed from MasterCI (separate sibling PR), so the report that the site reads needs a new producer that does not run on every master push.

Jobs. Unchanged shared configs from ci/defs/job_configs.py: build_llvm_coverage_job, unittest_llvm_coverage_job, functional_test_llvm_coverage_jobs, the S3/DBReplicated/ParallelReplicas/AsyncInsert coverage shards (they live inside functional_tests_jobs, so they are picked by amd_llvm_coverage in the job name), integration_test_llvm_coverage_jobs and llvm_coverage_job (merge, HTML report, coverage_ci.coverage_data row). 23 jobs, every shard artifact in LLVM_ARTIFACTS_LIST is provided (checked). master.py and the shared definitions are not touched.

Data compatibility. Nothing in the job code is changed. On a scheduled run Info().git_branch is master (GITHUB_REF_NAME), the PR number is 0, and llvm_coverage_job.py takes its master branch (is_master_branch) and writes the same row as today: branch = 'master', pull_request_number = 0, status of the report step, and coverage_report_url = <report_s3_base()>/llvm_coverage/generate_llvm_coverage_report/index.html. The URL and the S3 prefix come from praktika's get_s3_prefix, which includes the normalized workflow name, so the report now lives under REFs/master/<sha>/coveragereport/llvm_coverage/generate_llvm_coverage_report/ instead of .../masterci/....

Site updater. No host change is needed: the updater takes the prefix from coverage_report_url (never constructs it) and validates it against ^REFs/master/<sha>/[A-Za-z0-9_/-]+/$, which accepts the coveragereport segment. The /etc/nginx/coverage_latest.conf pointer is rewritten from the newest row. The first row from this workflow switches the site over, and the existing coverage-site-stale alarm (more than 24 hours without a row) covers a producer that stops.

Why the build is not forced to be fresh. enable_cache=True: praktika looks up a success record by job name and digest, regardless of the producing workflow. The digest of the coverage build covers only compiled sources (build_digest_config: src, contrib, cmake, base, programs, ...), so a run at a master commit that changes no compiled source reuses the newest existing coverage build, and any shard whose inputs are unchanged reuses its profile. Only the compiled sources decide whether the build is rebuilt, so commits that touch only tests, docs or CI do not rebuild it. When compiled sources changed, the build is rebuilt by this workflow itself, which is the "build only when no recent one exists" case.

I did not implement "fetch the binary of the latest master commit that has a coverage build and run on HEAD": the report maps profile counters to source lines, and the row and S3 prefix are keyed by the run's commit, so a binary from an older commit with a HEAD checkout would produce a wrong report attributed to the wrong sha. A scheduled workflow always checks out HEAD, and there is no existing praktika mechanism to pin the checkout to an older sha. The digest cache gives the same saving exactly when it is valid.

Trade-offs and risks.

  • Compiled sources change on most days, so most runs will rebuild the coverage build and re-run the shards (the same cost as one master push today, but every 3 hours at most instead of on every push). A run takes longer than a few hours, and the workflow concurrency group has no cancel, so runs queue and GitHub keeps only the newest pending one.
  • If every job is a cache hit (no compiled source or test change since the last run), the report job is also cached: no new row is written and the site keeps the previous (identical) report.
  • PR differential coverage still looks up its baseline at MasterCI (master_coverage_url in ci/jobs/llvm_coverage_job.py and generate_diff_coverage_report.sh). Once the master coverage jobs are removed, that baseline lookup needs to learn the CoverageReport path (and cope with a 3-hour cadence instead of one report per commit). This is deliberately not changed here and has to be handled together with the sibling PR.
  • The workflow runs without the store_data.py pre-hook, so llvm_coverage_job.py takes its gh api fallback for the commit list. On master that list is unused.

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):

...


Workflow [PR]
Sync PR [sync-upstream/pr/124765]

Version info

  • Merged into: 26.10.1.1945-master (included in 26.10 and later)

…rage report

Runs the LLVM coverage build, the unit, stateless and integration coverage shards and the LLVM Coverage report job every 3 hours (and on dispatch), reusing the shared job configs. Rows in `coverage_ci.coverage_data` keep `branch = 'master'` and `pull_request_number = 0`.
@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0d1a502]

Summary: ✅


AI Review

Summary

This PR adds a scheduled CoverageReport workflow that republishes the master LLVM coverage report outside MasterCI. The overall wiring looks sensible, but there is one major issue: the workflow graph no longer matches MasterCI's post-mangle docker graph, so the shared coverage jobs do not actually reuse MasterCI's cached results as the implementation and PR description assume.

Findings

⚠️ Majors

  • [ci/workflows/coverage_report.py:49] The workflow promises cross-workflow cache reuse for the shared coverage build and shard jobs, but omitting the docker manifest job changes every shared job's post-mangle run_after, and run_after is hashed into the cache digest. In practice CoverageReport gets different digests from MasterCI for Build (llvm_coverage_build), all LLVM coverage shard jobs, and LLVM Coverage itself, so the first scheduled run after a master commit reruns the whole coverage pipeline instead of reusing the already-produced MasterCI results. Suggested fix: match MasterCI's docker-manifest settings (enable_dockers_manifest_merge=True and the matching set_latest_for_docker_merged_manifest=True), and add a regression test in the style of ci/tests/test_nightly_fuzzers_build_sharing.py.
Final Verdict

⚠️ Needs changes before merge: the current workflow does not satisfy its own cache-sharing contract with MasterCI, so it will be substantially more expensive than intended.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 8, 2026
*ArtifactConfigs.llvm_profdata_file,
ArtifactConfigs.llvm_coverage_info_file,
],
dockers=DOCKERS,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Because this workflow is supposed to reuse MasterCI's coverage jobs via enable_cache, its post-mangle docker graph has to match MasterCI's exactly. Right now CoverageReport injects only Dockers Build (amd) and Dockers Build (arm), while MasterCI also injects Dockers Build (multiplatform manifest); ci/praktika/mangle.py appends those docker job names to every coverage job's run_after, and run_after is part of the cache digest. I checked the post-mangle configs locally and, for example, Build (llvm_coverage_build) differs from MasterCI only by that missing manifest job in run_after, so it cannot hit the existing MasterCI cache entry. The result is that the first CoverageReport run after a master commit will rerun the whole coverage pipeline instead of reusing the already-produced build/shards the PR description relies on. To make the cross-workflow cache sharing real, this workflow needs the same docker-manifest settings as MasterCI (enable_dockers_manifest_merge=True, and the matching set_latest_for_docker_merged_manifest=True if the manifest job itself should share safely too), plus a regression test similar to ci/tests/test_nightly_fuzzers_build_sharing.py.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Oct 8, 2026
@fm4v
fm4v enabled auto-merge October 9, 2026 15:16
@fm4v
fm4v added this pull request to the merge queue Oct 9, 2026
Merged via the queue into master with commit b2bea5c Oct 9, 2026
163 checks passed
@fm4v
fm4v deleted the nik/coverage-report-workflow branch October 9, 2026 16:07
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 9, 2026
clickgapai pushed a commit to clickgapai/ClickHouse that referenced this pull request Oct 15, 2026
Since 2026-10-09 (PRs ClickHouse#124764 and ClickHouse#124765) master's LLVM coverage is measured by
the scheduled `CoverageReport` workflow and published under `coveragereport/`;
`MasterCI` no longer runs the coverage jobs. `master_coverage_url` still built
the `MasterCI` prefix, so the `Generate LLVM Coverage Diff Report` step of the
`LLVM Coverage` job found no baseline in any of the 100 master-track commits and
failed on every pull request that runs the coverage jobs: 1 failure on 2026-10-11,
4 on 2026-10-12, 12 on 2026-10-13, 7 on 2026-10-14, 14 on 2026-10-15 so far. The
only passes since then are incomplete measurements, which skip the diff.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants