Skip to content

CI: run only the selected tests in the sanitizer functional tests in PRs - #114730

Merged
alexey-milovidov merged 20 commits into
masterfrom
ci-trim-sanitizer-functional-tests
Aug 18, 2026
Merged

alexey-milovidov merged 20 commits into
masterfrom
ci-trim-sanitizer-functional-tests

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

The sanitizer flavors of Stateless tests ran the whole suite in every pull request: 17 jobs for the ASan/UBSan, TSan and MSan builds. Under the assumption in the issue - that the stress tests with sanitizers are a stronger check than a plain functional run - the ASan/UBSan and TSan jobs now run only the tests selected for the change. The MSan/WasmEdge jobs retain their established full-suite configuration because every existing Wasm UDF functional test is tagged no-msan, so the selected-test runner cannot currently exercise that surface.

The new selected tests option of ci/jobs/functional_tests.py runs an ordinary functional test run over the subset that Targeting already computes for the targeted check: the tests the pull request changes, the tests that already failed in this pull request, and the tests covering the changed lines according to the coverage database. Unlike the targeted check, it does not rerun that selection many times - it is a plain run with a shorter list of tests. The selection is a few hundred tests, so the batches of the converted full-suite jobs collapse into a single job per flavor.

What still covers the whole suite in a pull request: the MSan/WasmEdge, debug, and plain binary functional test jobs, plus the stress tests, which run the functional tests under every sanitizer with heavy concurrency and randomized settings. The master workflow is unchanged and keeps running the full suite in every flavor.

Also in this change:

  • When the selection cannot be fetched (the coverage database or the GitHub diff is unavailable), the job fails rather than silently run an unbatched, weaker version of the former sanitizer configuration. Retrying restores the intended selected-test run.
  • Tests the job flavor would never run (no-parallel tests in a parallel job and vice versa) are dropped from the selection, and the job is skipped when nothing is left for it.
  • clickhouse-test exits with code 1 when every test it was given is filtered out - e.g. all the selected tests are tagged no-tsan in a TSan job. For a run over an explicit list of tests (flaky, targeted, selected tests) that is now reported as SKIPPED instead of a failure; for a full-suite run it stays a failure, since there it means a broken filter.

Unit tests for the new logic are in ci/tests/test_selected_tests_run.py. .github/workflows/pull_request.yml was regenerated via python3 -m ci.praktika yaml.

Verification in this pull request's own CI

This pull request changes no source file and no test under tests/queries, so nothing is relevant to select and the new jobs correctly report SKIPPED. To exercise the path that actually runs a subset, commit 8536243 temporarily touched 00001_select_1.sql (reverted in the following commit). On that commit, with all builds served from the cache:

  • Stateless tests (amd_tsan, parallel, selected tests) and Stateless tests (amd_asan_ubsan, distributed plan, parallel, selected tests) ran, and the report shows the three selection passes followed by the single selected test - 00001_select_1 OK 1.01s.
  • Stateless tests (amd_asan_ubsan, db disk, distributed plan, sequential, selected tests) skipped, because the only changed test is parallel-safe and the flavor filter left it nothing to run.

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=114730&sha=85362432c858e0cd9aadbf57f2895888b9d35863&name_0=PR

Possible follow-up, not done here: once the test list is short, the job start dominates the run - in the TSan run above, Start ClickHouse Server (which prepares the stateful datasets test.hits, test.visits, TPC-DS and TPC-H) took 324 seconds out of a 418-second job. Skipping the stateful preparation when no stateful test is selected needs a reliable way to tell, so it is left out of this change.

Closes: #114725

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/114730]

Version info

  • Merged into: 26.8.1.1652 (included in 26.8 and later)

The sanitizer flavors of `Stateless tests` ran the whole suite in every
pull request: 17 jobs for the ASan/UBSan, TSan and MSan builds. Under the
assumption that the stress tests with sanitizers are a stronger check
than a plain functional run, those jobs are now trimmed down to the tests
selected for the change.

The new `selected tests` option of `ci/jobs/functional_tests.py` runs an
ordinary functional test run over the subset that `Targeting` already
computes for the targeted check: the tests the pull request changes, the
tests that already failed in this pull request, and the tests covering
the changed lines according to the coverage database. Unlike the
`targeted` check, it does not rerun that selection many times - it is a
plain run with a shorter list of tests. The selection is a few hundred
tests, so the batches of the full-suite jobs collapse into a single job
per flavor: 17 jobs become 8.

What still covers the whole suite in a pull request: the debug and plain
binary functional test jobs, and the stress tests, which run the
functional tests under every sanitizer with heavy concurrency and
randomized settings. The master workflow is unchanged and keeps running
the full suite in every flavor.

Also in this change:

* When the selection cannot be fetched (the coverage database or the
  GitHub diff is unavailable), the job runs the full suite instead of
  testing less than it would have without the selection, and says so in
  the report. This also makes a local run of these jobs work.
* Tests the job flavor would never run (`no-parallel` tests in a
  `parallel` job and vice versa) are dropped from the selection, and the
  job is skipped when nothing is left for it.
* `clickhouse-test` exits with code 1 when every test it was given is
  filtered out - e.g. all the selected tests are tagged `no-tsan` in a
  TSan job. For a run over an explicit list of tests (flaky, targeted,
  `selected tests`) that is now reported as SKIPPED instead of a
  failure; for a full-suite run it stays a failure, since there it means
  a broken filter.

Regenerated `.github/workflows/pull_request.yml` via
`python3 -m ci.praktika yaml`.

Closes: #114725

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@mintlify

mintlify Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ClickHouse-docs 🟢 Ready View Preview Aug 13, 2026, 11:51 PM

@clickhouse-gh

clickhouse-gh Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b9854a8]

Summary: ✅


AI Review

Summary

This PR trims most pull-request sanitizer stateless jobs down to a selected tests subset and adds support code so those lanes can skip benignly when every explicit selector is filtered out. The overall direction makes sense, but there are still two coverage gaps in the new self-skip protection: CI-script-only changes still bypass every sequential selected-test lane, and one of the core selected-test metadata paths (ci/praktika/info.py) can still make the new ASan/TSan lanes self-skip.

Findings

⚠️ Majors

  • [ci/jobs/scripts/find_tests.py:53] The new "parallel and sequential flavors" smoke-test contract is not actually met for CI-script-only PRs. ci/jobs/scripts/workflow_hooks/filter_job.py still skips every stateless job whose name contains sequential when all changed files are ci/*.py, so changes limited to ci/jobs/functional_tests.py / ci/jobs/scripts/find_tests.py never execute the new sequential selected-test lanes.

  • [ci/jobs/scripts/find_tests.py:79] The stateless-harness allowlist is still incomplete for selected-test discovery. A PR that changes only ci/praktika/info.py still schedules the parallel selected-test lanes, but Targeting.get_changed_tests(include_harness_smoke=True) returns an empty selection, so those ASan/TSan jobs self-skip instead of exercising the Info.get_changed_files() path they depend on.

Final Verdict

⚠️ Request changes

Keep at least one sequential selected-test lane alive for CI-script-only PRs, and extend the stateless-harness allowlist to cover the remaining direct selected-test metadata plumbing such as ci/praktika/info.py.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 13, 2026
Comment thread ci/jobs/functional_tests.py Resolved
alexey-milovidov and others added 2 commits August 14, 2026 00:10
Reverted in the next commit. Without a changed test or a source change
there is nothing to select, so the new jobs skip and the code path that
actually runs a subset is never reached in this pull request's CI.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The `selected tests` jobs ran the changed test on the previous commit -
see the report linked from the pull request description - so the touch
has served its purpose.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b9854a8e7 with master 062bb7954 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of b99a4b375; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 702.06 MiB 699.03 MiB -3.02 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

Only report an empty explicit list as skipped when `clickhouse-test` proves that filtering caused it.
Comment thread tests/clickhouse-test Resolved
Comment thread ci/defs/job_configs.py Resolved
Comment thread tests/clickhouse-test Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/functional_tests.py Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Addressed the WasmEdge coverage finding in 5ea7b18: the five established full-suite MSan/WasmEdge shards are retained. Every existing Wasm UDF functional test is tagged no-msan, so selected-test discovery cannot currently select a representative Wasm test; retaining the prior lanes avoids claiming coverage that the runner filters out.

Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/scripts/find_tests.py Resolved
@clickhouse-gh

clickhouse-gh Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

🟢 AI verdict: improvement — 3 query(s) improved out of 34 analysed

This PR changes only the CI test-selection harness (trimming sanitizer functional-test jobs to selected tests), documentation, and developer tooling — none of it is in the query-execution path — so no per-query timing change can be attributed to the code. The flagged clickbench improvements (Q13, Q16, Q18, Q30, Q31, Q33) and the Q28 regression were downgraded to not-sure as measurement/environment variance. Three large deltas — clickbench Q23 (×2.3 faster), tpch Q7 (×8.4 faster), and tpch Q8 (×2.1 faster) — remain locked by the automatic trust override, but given the PR touches nothing these queries run, they should be read the same way; the broad, one-directional shift across unrelated queries is the tell-tale of an environment difference, not a real change.

clickbench

🟢 1 improved · ⚠️ 7 inconclusive

Flagged queries (8 of 43)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
🟢 23 improvement 164 71 ×2.3 faster <0.0001 ×2.3 faster is locked by the automatic trust override, but the PR only changes CI test-selection and tooling, so read this large delta as likely environment variance.
⚠️ 13 not_sure 422 338 -19.9% <0.0001 Public PR 114730 changes only the CI test-selection harness, docs, and developer tooling — nothing in query execution — so this -19.9% shift is environment variance, not a PR effect.
⚠️ 16 not_sure 734 624 -15.0% <0.0001 The PR touches only CI test-selection and dev tooling, not any code Q16 executes, so the -15.0% delta cannot be attributed to this change.
⚠️ 18 not_sure 1244 1102 -11.5% <0.0001 No query-execution code changed (CI harness and docs only), so this -11.5% improvement is run-to-run variance rather than a real effect.
⚠️ 28 not_sure 1051 1116 +6.2% <0.0001 A +6.2% regression on a CI/test-harness-and-docs-only PR is not plausible; nothing Q28 executes was modified, so this is measurement noise.
⚠️ 30 not_sure 279 238 -14.7% <0.0001 The PR changes no execution path, so this -14.7% improvement reflects environment differences, not the change.
⚠️ 31 not_sure 408 311 -23.8% <0.0001 -23.8% on a CI-harness/tooling PR that touches nothing Q31 runs is run-to-run variance, not a PR-driven improvement.
⚠️ 33 not_sure 1250 1187 -5.0% <0.0001 Only CI test-selection, docs, and dev tooling changed; the -5.0% delta is variance rather than a real effect.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

tpch_adapted_1_official

🟢 2 improved

Flagged queries (2 of 22)
Query Verdict Baseline median (ms) PR median (ms) Change q-value Hint
🟢 7 improvement 560 67 ×8.4 faster <0.0001 ×8.4 faster is locked by the automatic trust override, but since the PR only changes CI harness and tooling, this outsized delta most likely reflects a measurement-environment difference.
🟢 8 improvement 166 78 ×2.1 faster <0.0001 ×2.1 faster is locked by the trust override, yet the PR touches no execution code, so treat this the same way as the other unattributable deltas.

Change = percent below ×2; the ratio of medians (×N faster/slower) beyond, where percent understates the scale. q-value = BH-FDR adjusted p; smaller is stronger evidence. MIRAI flags a query when q < fdr_q (default 0.10) — the value the verdict is based on.

Debug info
  • StressHouse run: c5e602c4-d569-4fd7-a57a-fc1447ed25ea
  • MIRAI run: 6945362d-795b-44c4-8d36-2db1c82968e4
  • PR check IDs:
    • clickbench_1919781_1787055388
    • clickbench_1919787_1787055388
    • clickbench_1919799_1787055388
    • tpch_adapted_1_official_1919810_1787055388
    • tpch_adapted_1_official_1919820_1787055388
    • tpch_adapted_1_official_1919852_1787055388

@alexey-milovidov

Copy link
Copy Markdown
Member Author

We are removing WasmEdge, so please don't be bothered with preserving this particular variant.

@alexey-milovidov alexey-milovidov self-assigned this Aug 18, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 18, 2026
Merged via the queue into master with commit 15cfe16 Aug 18, 2026
175 checks passed
@alexey-milovidov
alexey-milovidov deleted the ci-trim-sanitizer-functional-tests branch August 18, 2026 19:02
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 18, 2026
middas-0706 pushed a commit to middas-0706/ClickHouse that referenced this pull request Nov 24, 2026
…ted job

ClickHouse#122111 made the targeted stateless and integration jobs SKIP instead of
ERROR when a test-selection CIDB request times out on every attempt
(`CIDBTimeoutError`). The first selection read, the strict previously-failed
lookup in `Targeting.get_previously_failed_tests_with_info`, re-wrapped any
exception as a plain `RuntimeError`, so a timeout there lost its class
before reaching either `except CIDBTimeoutError` handler and the shard
still ERRORed ("Failed to load test selection" in the stateless job, an
uncaught exception in the integration job). On a `pr-bugfix` PR that drops
`Bugfix validation` and fails `Finish Workflow / Post Hooks`.

Re-raise `CIDBTimeoutError` unchanged in strict mode. Every other failure
(a refused connection, an answered non-OK response) stays wrapped and keeps
failing the job, as ClickHouse#114730 intends. Best-effort mode is unchanged.

CIDB shows 3 such errors, all on 2026-09-24/25 during the CIDB overload
ClickHouse#122111 targets (PRs ClickHouse#118823, ClickHouse#117436, ClickHouse#114865).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

Optimization for CI: trim down functional tests with sanitizers in favor of stress tests

2 participants