Repository navigation
CI: skip stress tests, fuzzers and SQL suites in PRs with fewer than 100 lines of product code changed - #120996
Conversation
…anged under src/ The `store_data.py` pre-hook stores `src_changed_lines`, the sum of GitHub's per-file `changes` counter over the PR's files under `src/`. The `should_skip_job` filter hook then skips `Stress test`, `AST fuzzer` and `BuzzHouse` jobs when that count is below 100. The targeted AST fuzzer variants keep running, as does every job when the PR touches the stress or fuzzer machinery itself (job scripts, docker images, `stress.py`, `run-fuzzer.sh`, BuzzHouse and `QueryFuzzer` sources). A missing count (API failure) runs the jobs rather than skipping them. The `ci-force-all` label bypasses all filter hooks, so it re-enables these jobs on a small PR.
|
Workflow [PR], commit [772942b] Summary: ✅ AI ReviewSummaryThis PR teaches Findings
Final Verdict |
The counter behind the stress/fuzzer skip only looked at `src/`, but the built server also changes when a pull request touches `base/`, `programs/`, `rust/`, `cmake/`, `CMakeLists.txt` or `PreLoad.cmake` - all of them are `build_digest_config.include_paths`. Such a pull request got a count of `0`, so a 200-line change to the parser drivers in `programs/` was treated as small and skipped the jobs. Count the whole product-code part of the build digest instead (`PRODUCT_CODE_PATHS`), and rename the stored key to `product_changed_lines`. `contrib/` and `.gitmodules` stay out of the count and are handled separately by `_has_submodule_changes`: a submodule bump is two lines in the diff and an arbitrary amount of new code in the binary, so its line count means nothing and such a pull request is never small. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`BackportPR` is a `pull_request` workflow too, and it runs the same `should_skip_job` hook, so the `pr_number` gate alone let the new rule drop the `Stress test` job from small backport pull requests - which the pull request description said would not happen. A backport also has the weakest safety net: it lands in a release branch, which `ClickGap` (it fuzzes every commit merged into master) never fuzzes afterwards. Gate the rule on the workflow name instead, the way `check_backport_branch.py` already distinguishes the two workflows. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The hand-written allowlist missed shared harness files the `Stress test`, `AST fuzzer` and `BuzzHouse` jobs already consume - `clickhouse_proc.py`, `log_export.py`, `log_cluster.py`, `log_parser.py`, `setup_log_cluster.sh`, `tests/clickhouse-test` - so a one-line pull request changing the harness of these jobs skipped the very jobs it changed. Build the exemption from the digest `include_paths` of the jobs the rule can skip, minus the broad test paths (`tests/queries/0_stateless/`, `tests/config`, `tests/*.txt`) that almost every pull request touches and that would make the rule never fire. An input added to one of those jobs then keeps its exemption without a second edit here. `_EXTRA_STRESS_AND_FUZZER_PATHS` keeps what is not a digest input of those jobs but still decides what they do: the fuzzers' own code in `src/`, this hook, and `store_data.py`, which computes the line count the hook reads. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`PRODUCT_CODE_PATHS` is what the counter counts, but the build digest has more inputs than that: `ci/jobs/build_clickhouse.py`, `build_profile_hook.py`, `log_cluster.py`, `packages`, `utils/list-licenses`, `utils/self-extracting-executable`, `utils/prepare-time-trace`. A pull request changing a compiler flag in `build_clickhouse.py` produced a count of `0` and skipped the stress tests and fuzzers, although every binary they run had changed. Counting their lines would not help - one line of a compiler flag rebuilds everything - so take the pull request out of the rule instead, the way a submodule bump already was. `_has_uncounted_build_changes` derives that set as `build_digest_config.include_paths` minus the counted product paths, which also subsumes `contrib/` and `.gitmodules` and gives the invariant that every input of the build digest either counts towards the threshold or disables the skip. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The exemption covered the jobs' digest inputs and their runtime harness, but not the files that define and schedule the jobs: `ci/defs/job_configs.py` (commands, parameters, runners, timeouts, digests), `ci/defs/defs.py` and `ci/workflows/pull_request.py`. A pull request that rewrites a stress job and changes a few lines of `src/` on top counted as small and skipped the very job it had just redefined - the build it requires still runs, so praktika schedules the job and only this rule dropped it. `_COVERAGE_PIPELINE_PATHS` treats `ci/defs/job_configs.py` and `ci/defs/defs.py` as control plane for the coverage family in the same way. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`tests/config` was carved out of the exemption together with the stateless suite, but the two are not comparable. The stress and fuzzer runners install their server configuration from that tree - `run-fuzzer.sh` copies `listen.xml`, `clusters.xml`, `secure_ports.xml`, `ssl_certs.xml`, `server.crt` and `server.key`, `stress.py` installs `cannot_allocate_thread_injection.xml` - so a pull request changing one of them plus a few lines of `src/` skipped the jobs whose runtime configuration it had just changed. The carve-out exists so that a path almost every pull request touches cannot disable the rule, and only the stateless suite is such a path: over the last 14 days of master, 900 of 4529 commits changed `tests/queries/0_stateless/` and 11 changed `tests/config`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The exemption is derived from the jobs' digest `include_paths`, but it compared them with `str.startswith` while praktika matches them as globs. The glob entries therefore covered nothing at all: no file name starts with the literal `tests/*.txt`, so the blacklists `tests/clickhouse-test` reads to decide which tests run (`analyzer_tech_debt.txt`, `parallel_replicas_blacklist.txt`, `async_insert_blacklist.txt`) were outside the exemption, and a pull request changing one of them plus a few lines of `src/` skipped the `Stress test` job whose test selection it had just changed. `_matches_digest_path` now mirrors `Job.is_affected_by`: a pattern is a directory prefix, an exact path, or a glob. With that, `tests/*.txt` leaves `_COMMON_TEST_PATHS` and means what it says, and `src/Common/QueryFuzzer*` becomes a glob rather than a prefix. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two holes of the same kind: `get_product_changed_lines` looked at `.filename` only, so a file moved out of `src/` and edited on the way counted as nothing - the new path no longer matches, although the product code lost or changed a file. Both sides of the rename are now matched; an entry matching both is still counted once. The exemption covered what defines these jobs, but not `ci/praktika/`, which decides how any job is scheduled and run. A pull request changing the scheduler plus a few lines of `src/` could skip the jobs whose scheduling had changed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Both run fixed third-party SQL suites unrelated to the change. In the 30 days before 2026-09-19 they consumed 14269 and 2618 runner hours in PRs (108 and 19 minutes per run) and their only PR failures were infrastructure (`Start ClickHouse`, `Download dataset`). Their digest inputs (`tests/sqllogic/`, `tests/sqlstorm/`, job scripts) join the exemption set, so a PR changing the suites themselves still runs them.
| JobConfigs.sqllogic_test_master_job, | ||
| JobConfigs.sqlstorm_test_job, | ||
| ): | ||
| for path in job.digest_config.include_paths: |
There was a problem hiding this comment.
_stress_and_fuzzer_paths only walks job.digest_config.include_paths, but these jobs are also treated as affected when their run_in_docker image or one of its base images changes. With the current code, a PR that changes ci/docker/stateless-test/... or ci/docker/test-base/... plus a 5-line src/ edit still leaves _has_stress_or_fuzzer_changes == False, so this hook skips Stress test, SQLLogic test, and SQLStorm test before Praktika's changed-file filtering can rescue them; ci/docker/test-base also affects AST fuzzer and BuzzHouse.
I think this exemption needs the docker dependency closure of the skipped jobs, not just their digest include_paths.
| return tuple( | ||
| sorted( | ||
| path | ||
| for path in (p.removeprefix("./") for p in build_digest_config.include_paths) |
There was a problem hiding this comment.
_uncounted_build_paths only mirrors build_digest_config.include_paths, but the binaries these jobs consume also change when the build image changes. Build jobs run in clickhouse/binary-builder, which is affected by ci/docker/binary-builder/... and by its base image ci/docker/fasttest/...; today both paths leave _has_uncounted_build_changes == False.
That means a PR touching ci/docker/fasttest plus a few lines of product code still qualifies as "small" and can skip Stress test, AST fuzzer, BuzzHouse, SQLLogic test, and SQLStorm test, even though every required build reran in a different toolchain container. I think the "uncounted build changes" set needs the builder docker dependency closure as well.
Master's small-PR skip rule (#120996) added two references to the BuzzHouse job under its master names, and this branch renamed both. The merge is textually clean, so nothing flagged it and the Config Workflow instead died at import with AttributeError: type object 'JobNames' has no attribute 'BUZZHOUSE' which skipped all 171 downstream jobs. Point both at the branch's names: `JobNames.BUZZHOUSE` -> `JobNames.LACASADELDOLOR` and `JobConfigs.buzz_fuzzer_jobs` -> `JobConfigs.lacasadeldolor_jobs`. Failing run: https://github.com/ClickHouse/ClickHouse/actions/runs/35577894292/job/106263771583 Also restores ci/tests/test_lacasadeldolor_job.py, which was left untracked and lost before 2d5096d. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ct code The small-PR rule from ClickHouse#120996 skipped every untargeted stress test and fuzzer on a PR with fewer than 100 lines of product code. ClickHouse#125033 (60 lines in `src/`) passed its targeted fuzzers and introduced the exception `Cannot call function A because is has B arguments but C columns were captured` (STID 2458-4cb4), which `AST fuzzer (amd_msan)` and `Stress test (amd_tsan)` found on master a few hours after the merge. Keep `AST fuzzer (amd_debug)` and `Stress test (amd_tsan)` for small PRs that change at least one line of product code. PRs that change only tests, docs or CI scripts keep skipping all of them.
Skips the
Stress test,AST fuzzer,BuzzHouse,SQLLogic testandSQLStorm testjobs in pull requests that change fewer than 100 lines (additions + deletions) of product code. Per the decision with Alexey: these jobs take up to 1-3 hours each (21 jobs per PR) and rarely catch anything a change of that size introduces; ClickGap also fuzzes every merged PR once more on master. Tests, docs and CI scripts do not count towards the threshold.Runner hours these jobs consumed in PRs over the 30 days before 2026-09-19 (CI DB), and how often they failed:
Stress testAST fuzzerBuzzHouseSQLLogic testStart ClickHouseinfra failures)SQLStorm testStart ClickHouse,Download dataset)Of the 100 most recently merged PRs, 79 change fewer than 100 lines of product code.
How it works:
store_data.pypre-hook storesproduct_changed_lines, summed from GitHub's per-filechangescounter inpulls/{pr}/filesoverPRODUCT_CODE_PATHS(src/,base/,programs/,rust/,cmake/,CMakeLists.txt,PreLoad.cmake), matching either side of a rename.should_skip_jobfilter hook skips the five job families when the count is belowSMALL_PR_CHANGED_LINES = 100, in thePRworkflow only.What still runs on a small PR:
targetedAST fuzzer variants (they fuzz the tests exercising the PR's changed symbols, which is exactly what a small PR needs).contrib/,.gitmodules,ci/jobs/build_clickhouse.py,packages/, ...).ci/jobs/scripts/{stress,fuzzer}/, docker images,tests/config,tests/*.txt,tests/sqllogic/,tests/sqlstorm/, ...) excepttests/queries/0_stateless/, plussrc/Client/BuzzHouse/,src/Common/QueryFuzzer*,ci/defs/,ci/workflows/pull_request.py,ci/praktika/and the two hooks.ci-force-alllabel is set (praktika bypasses all filter hooks for it); the skip reason in the report points to that label.BackportPR, master and release workflows are unaffected.Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/120996]
Version info
26.10.1.330-master(included in26.10and later)