Repository navigation
Skip CI batches when only test files changed and none fall in the batch - #109668
Merged
Merged
Conversation
Contributor
|
Workflow [PR], commit [e33ad46] Summary: ✅ AI ReviewSummaryThis PR teaches the stateless and integration runners to skip shards when a PR only changes tests, and it skips the final Findings
Tests
Final Verdict
|
functional_tests.py and integration_test_job.py already split the full test suite across parallel N/M batches. When a PR only touches test files (no production or CI-job code), most batches would produce results identical to master, since only the batch(es) containing the actually changed tests can differ. Both jobs now check Info().get_changed_files() (populated by the CI store_data.py pre-hook) and, when every changed file is a recognized tests/queries/0_stateless or tests/integration/test_* test file (or a change under ci/jobs/), skip a batch outright if none of the changed tests are assigned to it - reusing clickhouse-test's own crc32(filename) % total_batches hashing for functional tests and the existing get_optimal_test_batch module assignment for integration tests. The shared file-classification and hash-bucket-resolution helpers are added as static/class methods on Targeting (ci/jobs/scripts/find_tests.py) so both job scripts and the existing changed_test_modules logic reuse the same predicates instead of duplicating them. Also fixes a handful of unrelated grammar typos in test file comments, used to validate the new logic end-to-end against a real test-only diff.
maxknv
force-pushed
the
ci-skip-batches-test-only-changes
branch
from
July 7, 2026 19:02
7f0e3cf to
515118b
Compare
Coverage numbers only move when the compiled binary changes, so a PR that only touches tests, docs, or CI scripts produces a merge report identical to master. `should_skip_job` now skips `JobNames.LLVM_COVERAGE` on PRs whenever none of the changed files fall under `build_digest_config`'s include paths (the same paths that gate the build job's own cache digest in `ci/defs/job_configs.py`), via a new `_has_build_digest_changes` helper. This supersedes the narrower "only ci/*.py changed" special case that previously gated this job: that check also incorrectly skipped coverage when `ci/jobs/build_clickhouse.py` or `build_profile_hook.py` changed even though those files are themselves part of the build digest.
`parallel`/`sequential` is a second, independent sharding dimension used by some stateless test job flavors (e.g. `amd_tsan, parallel, 1/2` vs `amd_tsan, sequential, 1/2`): each flavor hashes and batches its own subset of tests (`--no-sequential`/`--no-parallel`), and a test tagged `no-parallel` or `sequential` never runs under the "parallel" flavor (and vice versa), regardless of batch number. The batch-skip check added in the previous commit ignored this and only looked at the crc32 hash bucket, so a changed test could be judged "in this batch" for a job flavor that would never even select it. Add `Targeting.is_sequential_functional_test` (mirrors `clickhouse-test`'s own `Tags:`-based `is_sequential_test` classification) and use it to restrict the changed-file set to what the current job's parallel/sequential flavor would actually run before doing the hash-bucket check. Also stop gating the whole check on `total_batches > 1`: some parallel/ sequential flavors have no batch number at all (e.g. `amd_debug, parallel`), but the flavor-applicability check (skip the whole job if none of the changed tests apply to this flavor) is still valid without batching. Only the crc32 hash-bucket sub-check needs `batch_num and total_batches > 1` (also avoids a `% 0` when there is no "N/M" token).
The batch-skip check excluded is_llvm_coverage runs, but coverage numbers for a batch are just as unaffected by a test-only change as any other batch: if no production code changed, a skipped llvm_coverage batch is identical to master's, and the final merge job already knows to supplement missing profdata from master (see the coverage sub-job skipping logic in filter_job.py). Drop the exclusion in both functional_tests.py and integration_test_job.py so coverage batches benefit from the same skip.
maxknv
force-pushed
the
ci-skip-batches-test-only-changes
branch
from
July 8, 2026 09:58
cd8261a to
a0e2d74
Compare
Member
Author
|
requires #109250 |
clickhouse-test only treats files directly inside the suite root as test cases for --run-by-hash-* bucketing (is_test_from_dir/get_selected_tests use os.listdir, not recursive). A nested file like tests/queries/0_stateless/helpers/httpclient.py or tests/queries/0_stateless/data_avro/generate_avro.sh previously resolved to a fabricated hash-batch identity based on its basename, letting a helper- or fixture-only change skip most batches while real dependent tests went unrun. Require the parent directory to be exactly the suite root before attempting direct-hit or sibling-test resolution; otherwise return None so the caller conservatively runs the batch. Reported by review on #109668: #109668 (comment)
…stead of just checking membership Move the batch-skip check to after the is_sequential/is_parallel handling so it operates on the modules this job invocation will actually run, not the pre-flavor-filter set. Most real integration test job configs run parallel_test_modules and sequential_test_modules together in one invocation (no explicit parallel/sequential option). For those, checking mere set membership only let us skip the whole batch when neither side contained a changed module. Now, when only one side contains a changed module, drop the other side entirely (it would produce results identical to master) instead of running it anyway - a real time saving even when the batch itself is not skipped. Addresses review comment on #109668: #109668 (comment)
Bartok9
pushed a commit
to Bartok9/ClickHouse
that referenced
this pull request
Jul 27, 2026
…merge job `should_skip_job` already skipped the `LLVM_COVERAGE` merge job when a PR had no build-digest-affecting changes, but the `amd_llvm_coverage` test-shard batches and the coverage build still ran - burning CI time producing profdata that the (already-skipped) merge job would never consume. ClickHouse#109668 made this worse by also skipping only some batches within those jobs based on a per-batch hash-bucket check, so a tests-only PR ended up with an inconsistent mix of some batches running and others skipped. Extend the existing `ci-no-coverage` label condition (which already skips the build, all `amd_llvm_coverage` shards, `excluded_from_llvm` jobs, and the merge job together) to also fire automatically whenever the PR has no build-digest changes. This makes the skip consistent (the whole family or none of it) and removes the now-dead single-test-type sub-job skip block and the standalone merge-job-only skip, both superseded by the broader check. Also drop the `is_llvm_coverage` batch-skip in `functional_tests.py` / `integration_test_job.py` back to excluded, since coverage jobs are now filtered out entirely at config time before any batch is scheduled - the in-job per-batch skip is unreachable for them and only added maintenance surface. PRs touching production code are unaffected: `_has_build_digest_changes` returns True for them, so the coverage family runs exactly as before - degradation check, LBC cross-validation, and master's own baseline publication are untouched.
scanhex12
pushed a commit
to scanhex12/ClickHouse
that referenced
this pull request
Jul 29, 2026
…merge job `should_skip_job` already skipped the `LLVM_COVERAGE` merge job when a PR had no build-digest-affecting changes, but the `amd_llvm_coverage` test-shard batches and the coverage build still ran - burning CI time producing profdata that the (already-skipped) merge job would never consume. ClickHouse#109668 made this worse by also skipping only some batches within those jobs based on a per-batch hash-bucket check, so a tests-only PR ended up with an inconsistent mix of some batches running and others skipped. Extend the existing `ci-no-coverage` label condition (which already skips the build, all `amd_llvm_coverage` shards, `excluded_from_llvm` jobs, and the merge job together) to also fire automatically whenever the PR has no build-digest changes. This makes the skip consistent (the whole family or none of it) and removes the now-dead single-test-type sub-job skip block and the standalone merge-job-only skip, both superseded by the broader check. Also drop the `is_llvm_coverage` batch-skip in `functional_tests.py` / `integration_test_job.py` back to excluded, since coverage jobs are now filtered out entirely at config time before any batch is scheduled - the in-job per-batch skip is unreachable for them and only added maintenance surface. PRs touching production code are unaffected: `_has_build_digest_changes` returns True for them, so the coverage family runs exactly as before - degradation check, LBC cross-validation, and master's own baseline publication are untouched.
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
clickhouse-test only treats files directly inside the suite root as test cases for --run-by-hash-* bucketing (is_test_from_dir/get_selected_tests use os.listdir, not recursive). A nested file like tests/queries/0_stateless/helpers/httpclient.py or tests/queries/0_stateless/data_avro/generate_avro.sh previously resolved to a fabricated hash-batch identity based on its basename, letting a helper- or fixture-only change skip most batches while real dependent tests went unrun. Require the parent directory to be exactly the suite root before attempting direct-hit or sibling-test resolution; otherwise return None so the caller conservatively runs the batch. Reported by review on ClickHouse#109668: ClickHouse#109668 (comment)
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…stead of just checking membership Move the batch-skip check to after the is_sequential/is_parallel handling so it operates on the modules this job invocation will actually run, not the pre-flavor-filter set. Most real integration test job configs run parallel_test_modules and sequential_test_modules together in one invocation (no explicit parallel/sequential option). For those, checking mere set membership only let us skip the whole batch when neither side contained a changed module. Now, when only one side contains a changed module, drop the other side entirely (it would produce results identical to master) instead of running it anyway - a real time saving even when the batch itself is not skipped. Addresses review comment on ClickHouse#109668: ClickHouse#109668 (comment)
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…test-only-changes Skip CI batches when only test files changed and none fall in the batch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
functional_tests.pyandintegration_test_job.pyalready split the full test suite across parallelN/Mbatches. When a PR only touches test files (no production or CI-job code), most batches would produce results identical tomaster, since only the batch(es) containing the actually changed tests can differ.Both jobs now check
Info().get_changed_files()(populated by the CIstore_data.pypre-hook) and, when every changed file is a recognizedtests/queries/0_statelessortests/integration/test_*test file (or a change underci/jobs/), skip a batch outright if none of the changed tests are assigned to it:crc32(filename) % total_batcheshash-batching formula thatclickhouse-testitself uses;get_optimal_test_batchmodule assignment for the current batch.If none of the batches contain a changed test at all (e.g. only test files of the other job type changed), the job is skipped entirely.
The shared file-classification and hash-bucket-resolution helpers are added as static/class methods on
Targeting(ci/jobs/scripts/find_tests.py) so both job scripts and the pre-existingchanged_test_moduleslogic inintegration_test_job.pyreuse the same predicates instead of duplicating them.Also includes a handful of unrelated grammar fixes in test file comments, used to produce a real test-only diff to validate the new logic end-to-end.
Version info
26.7.1.708(included in26.7and later)