Skip to content

Add ci-coverage label to force LLVM coverage jobs on tests-only PRs - #117866

Merged
alexbakharew merged 3 commits into
masterfrom
abakharew/ci-coverage-force-label
Sep 3, 2026
Merged

alexbakharew merged 3 commits into
masterfrom
abakharew/ci-coverage-force-label

Conversation

@alexbakharew

@alexbakharew alexbakharew commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

The LLVM coverage family (the coverage build, the amd_llvm_coverage test shards, the excluded_from_llvm jobs, and the LLVM Coverage merge job) is skipped automatically on PRs with no build-affecting changes. The reason: the coverage of the compiled binary would be identical to master. But sometimes the author of a tests-only PR wants to run the coverage pipeline anyway, for example to see the coverage of the tests the PR adds.

This PR adds a new ci-coverage label. It overrides only the automatic skip, symmetric to the existing ci-no-coverage label. The explicit ci-no-coverage label still wins if both labels are present. The excluded_from_llvm jobs stay skipped even with the label: they run on a plain (non-instrumented) build and produce no coverage data, and their tests already run in the regular test jobs of the PR. A note about the label's effect is added to the CI report, in the same way as for the other ci-* labels.

Bypassing should_skip_job alone is not enough: the later "Filter not affected jobs" pass would still drop the coverage jobs when no changed file matches their digest_config (e.g. a docs-only PR). So this PR also adds a generic praktika mechanism: a workflow filter hook can return (False, Workflow.FILTER_HOOK_FORCE_JOB) to force-include a job. Forced jobs are treated as affected in _filter_unaffected_jobs, and their dependencies are kept alive through the usual rescue propagation. The job cache is still respected: a digest-identical coverage build is reused, not rebuilt.

Validation note: this PR cannot exercise the new branch in its own CI. Its diff touches filter_job.py, which is in _COVERAGE_PIPELINE_PATHS, so the coverage family runs here regardless of the label. The contract was validated by an offline replay of the Config Workflow decision pipeline against the real PR job graph (real should_skip_job, real digest configs, real _filter_unaffected_jobs) with a pure tests-only diff (tests/queries/0_stateless/09999_new_test.sql): without the label all 25 coverage-family jobs are filtered; with the label 23 coverage jobs run and the 2 excluded_from_llvm jobs stay skipped. After the merge, the end-to-end behavior should be confirmed once with a real tests-only PR carrying the label.

The ci-coverage label does not exist in the repository label list yet. It must be created once: gh label create ci-coverage --description "Force LLVM coverage jobs to run on a PR with no build-affecting changes (e.g. tests-only)" --color 8256D0.

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

Version info

  • Merged into: 26.9.1.633 (included in 26.9 and later)

The coverage family (the coverage build, the amd_llvm_coverage test
shards, the excluded_from_llvm jobs, and the LLVM Coverage merge job)
is auto-skipped on PRs with no build-affecting changes, because the
coverage of the compiled binary would be identical to master. The new
ci-coverage label overrides this automatic skip, so a tests-only PR
can still run the coverage pipeline on the tests it adds. The explicit
ci-no-coverage label still wins if both labels are present.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bd4a75b]

Summary: ✅


AI Review

Summary

This PR adds a ci-coverage label and a generic force-include hook so the LLVM coverage family can survive the later changed-files filter on PRs with no build-affecting changes. The implementation now covers the earlier filtering gap, but it still lands without focused regression coverage for the main contract, so I would hold it until that behavior is tested directly.

Findings

⚠️ Majors

  • [ci/jobs/scripts/workflow_hooks/filter_job.py:425, ci/praktika/native_jobs.py:653] The new contract now depends on two cooperating branches: should_skip_job must return the force sentinel for the right coverage jobs, and _filter_unaffected_jobs must keep those jobs through the later digest-based pruning pass while still letting ci-no-coverage win. This PR itself changes both paths, so its green CI does not prove the advertised "tests/docs-only PR with ci-coverage runs the coverage family" behavior. A later refactor can silently break the label again without any focused test failing.
    Suggested fix: add a small ci/tests regression around Config Workflow filtering that covers [], [ci-coverage], and [ci-coverage, ci-no-coverage], and asserts that excluded_from_llvm stays filtered while the coverage build, coverage shards, and LLVM Coverage survive the changed-files filter.
Tests
  • ⚠️ Add a focused regression test that seeds changed files outside the build digest (for example under tests/ or docs/) and checks the final filtered job set after both the workflow-hook pass and _filter_unaffected_jobs. That is the smallest proof for the new label's user-facing contract.
Final Verdict

Changes look correct after the follow-up fix, but the PR is still missing the focused regression coverage needed to prove the new ci-coverage behavior and the ci-no-coverage precedence rule.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 3, 2026
):
# The `ci-coverage` label overrides only this automatic skip: it lets
# a tests-only PR still measure the coverage of the tests it adds.
if Labels.CI_COVERAGE in _info_cache.pr_labels:

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 PR itself changes filter_job.py, it already trips _has_coverage_pipeline_changes, so the coverage family would run even if the new ci-coverage branch were dead. That leaves the main contract of the PR unproven: a pure tests-only diff on an unchanged binary.

Please add a focused regression test around the Config Workflow filtering path for at least these cases: no label, ci-coverage, and ci-coverage together with ci-no-coverage to prove the precedence rule.

The excluded_from_llvm jobs run on a plain (non-instrumented) build and
produce no coverage data. On a tests-only PR their tests already run in
the regular test jobs, so forcing them together with the coverage jobs
would only burn CI time.

Co-Authored-By: Claude Fable 5 <[email protected]>
The ci-coverage label only bypassed should_skip_job. The later 'Filter
not affected jobs' pass in native_jobs.py still dropped the coverage
family when no changed file matched the coverage jobs' digest_config
(e.g. a docs-only PR), so the label did not force the jobs across the
full 'no build-affecting changes' surface.

Add a generic mechanism to praktika: a workflow filter hook can return
(False, Workflow.FILTER_HOOK_FORCE_JOB) to force-include a job. Such
jobs are treated as affected in _filter_unaffected_jobs, and their
dependencies (the coverage build) are kept alive through the usual
rescue propagation. The ci-coverage branch of should_skip_job now
returns this sentinel.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexbakharew
alexbakharew added this pull request to the merge queue Sep 3, 2026
Merged via the queue into master with commit efada09 Sep 3, 2026
174 checks passed
@alexbakharew
alexbakharew deleted the abakharew/ci-coverage-force-label branch September 3, 2026 18:47
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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