Skip to content

CI: skip stress tests, fuzzers and SQL suites in PRs with fewer than 100 lines of product code changed - #120996

Merged
fm4v merged 10 commits into
masterfrom
nik/skip-stress-fuzzers-small-prs
Sep 21, 2026
Merged

fm4v merged 10 commits into
masterfrom
nik/skip-stress-fuzzers-small-prs

Conversation

@fm4v

@fm4v fm4v commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Skips the Stress test, AST fuzzer, BuzzHouse, SQLLogic test and SQLStorm test jobs 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:

Job family Runs Avg minutes Runner hours Failed runs
Stress test 84847 56 81850 2.6%
AST fuzzer 57915 43 42549 1.6%
BuzzHouse 31921 44 24377 0.3%
SQLLogic test 7653 108 14269 0.3% (all Start ClickHouse infra failures)
SQLStorm test 8161 19 2618 0.1% (Start ClickHouse, Download dataset)

Of the 100 most recently merged PRs, 79 change fewer than 100 lines of product code.

How it works:

  • The store_data.py pre-hook stores product_changed_lines, summed from GitHub's per-file changes counter in pulls/{pr}/files over PRODUCT_CODE_PATHS (src/, base/, programs/, rust/, cmake/, CMakeLists.txt, PreLoad.cmake), matching either side of a rename.
  • The should_skip_job filter hook skips the five job families when the count is below SMALL_PR_CHANGED_LINES = 100, in the PR workflow only.

What still runs on a small PR:

  • The targeted AST fuzzer variants (they fuzz the tests exercising the PR's changed symbols, which is exactly what a small PR needs).
  • Everything, when the PR touches a build-digest input whose diff size says nothing about the binary (contrib/, .gitmodules, ci/jobs/build_clickhouse.py, packages/, ...).
  • Everything, when the PR touches the machinery of the skipped jobs: their digest inputs (job scripts, ci/jobs/scripts/{stress,fuzzer}/, docker images, tests/config, tests/*.txt, tests/sqllogic/, tests/sqlstorm/, ...) except tests/queries/0_stateless/, plus src/Client/BuzzHouse/, src/Common/QueryFuzzer*, ci/defs/, ci/workflows/pull_request.py, ci/praktika/ and the two hooks.
  • Everything, when the ci-force-all label is set (praktika bypasses all filter hooks for it); the skip reason in the report points to that label.
  • Everything, when the line count could not be fetched: a missing count runs the jobs instead of skipping them.

BackportPR, master and release workflows are unaffected.

Changelog category (leave one):

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

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

Version info

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

…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.
@clickhouse-gh

clickhouse-gh Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [772942b]

Summary: ✅


AI Review

Summary

This PR teaches filter_job.py to skip Stress test, AST fuzzer, BuzzHouse, SQLLogic test, and SQLStorm test on pull requests with fewer than 100 changed lines of product code, while exempting build-affecting and harness-affecting paths. The remaining issue is that the exemption logic still ignores docker-image dependency changes that Praktika already treats as affecting these jobs, so a small mixed PR can skip exactly the suites whose runtime environment or produced binaries changed.

Findings
  • ⚠️ [ci/jobs/scripts/workflow_hooks/filter_job.py:223] _stress_and_fuzzer_paths only follows job.digest_config.include_paths, so a PR changing ci/docker/stateless-test/... or ci/docker/test-base/... plus a small src/ edit still leaves _has_stress_or_fuzzer_changes false. Praktika would otherwise mark Stress test, AST fuzzer, BuzzHouse, SQLLogic test, and SQLStorm test affected through Docker.find_affected_docker_images, but this hook runs first and skips them.
    Suggested fix: derive an additional exemption from the docker dependency closure of the skipped jobs' run_in_docker images.
  • ⚠️ [ci/jobs/scripts/workflow_hooks/filter_job.py:246] _uncounted_build_paths still ignores the build docker images. A PR changing ci/docker/binary-builder/... or its base ci/docker/fasttest/... plus a few product lines leaves both _has_uncounted_build_changes and _has_stress_or_fuzzer_changes false, even though every required Build job reruns in a different toolchain container and can produce different binaries for the skipped suites.
    Suggested fix: treat the build jobs' docker image dependency closure as uncounted build changes too.
Final Verdict

⚠️ Needs fixes before merge: the small-PR skip rule still misses docker-image changes in both the skipped jobs' runtime and the build toolchain.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 19, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 19, 2026
@alexey-milovidov alexey-milovidov self-assigned this Sep 19, 2026
alexey-milovidov and others added 3 commits September 19, 2026 17:06
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]>
alexey-milovidov and others added 2 commits September 19, 2026 18:26
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.
@fm4v fm4v changed the title CI: skip stress tests and fuzzers in PRs with fewer than 100 lines changed under src/ CI: skip stress tests, fuzzers and SQL suites in PRs with fewer than 100 lines of product code changed Sep 19, 2026
JobConfigs.sqllogic_test_master_job,
JobConfigs.sqlstorm_test_job,
):
for path in job.digest_config.include_paths:

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.

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

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.

_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.

@fm4v
fm4v added this pull request to the merge queue Sep 21, 2026
Merged via the queue into master with commit 0e9582d Sep 21, 2026
176 checks passed
@fm4v
fm4v deleted the nik/skip-stress-fuzzers-small-prs branch September 21, 2026 08:17
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 21, 2026
PedroTadim added a commit that referenced this pull request Sep 21, 2026
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]>
balx pushed a commit to balx/ClickHouse that referenced this pull request Oct 11, 2026
…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.
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.

3 participants