Skip to content

Run targeted stateless and integration checks in the merge queue - #125571

Merged
fm4v merged 12 commits into
masterfrom
nik/merge-queue-targeted-checks
Nov 2, 2026
Merged

fm4v merged 12 commits into
masterfrom
nik/merge-queue-targeted-checks

Conversation

@fm4v

@fm4v fm4v commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Related: #117198
Related: #125455
Related: #124131
Related: #126406
Related: #123832
Related: #125292

A pull request tested against an older master can break tests that landed after its last CI run, and master can break the PR's own tests in the meantime. The merge queue reruns only the PR's changed stateless tests (and, since #126406, the stateless tests master changed since the PR CI), and no integration tests at all. Two recent cases it missed:

MergeQueueCI now runs two targeted checks on the merge group, on the amd_binary build the queue already makes (release, no sanitizers, no ThinLTO, the lightest full build):

  • Stateless tests (amd_binary, targeted): the tests covering the changed lines of the queued PR.
  • Integration tests (amd_binary, targeted): the changed modules, the modules owning changed files, the modules covering the changed lines, and up to 10 integration test modules master added or changed after the PR's last CI run (the window and the ranking of Rerun the tests master changed since the PR CI in the merge queue #126406, extended to integration tests).

The changed stateless tests and the stateless tests master changed are left to the merge-queue flaky check, which already reruns them. The tests that failed earlier in the PR are not rerun: its CI already did, and a flaky one would only bounce the PR from the queue. Targeting takes the PR number from the merge group head ref (Info.linked_pr_number) and the diff from the PR itself, because the merge group commit is not the PR head. The jobs are not cached: their selection depends on the queue entry and on the attempt.

The merge queue is meant to fail fast:

  • Both targeted jobs stop after 3 failed tests (--max-failures 3 for clickhouse-test, --maxfail for pytest; the sequential integration phase gets what remains of the limit and is dropped once it is reached). The integration job does not rerun its failed tests.
  • Both stop at 20 minutes from their start, the budget of the merge-queue flaky check, so they do not extend the queue critical path beyond it. Reaching the limit stops the tests without failing the job (--global_time_limit for stateless, the pytest session timeout for integration). The stateless job repeats its selection 3 times instead of 50.
  • The merge-queue flaky check keeps its 20-minute limit and its 5-failure limit.

Replayed Targeting.get_merge_queue_drift_tests on the merge commit of #123832: 30 stateless and 10 integration modules selected; the PR's own test_database_disk/test.py is selected as a changed module.

Changelog category (leave one):

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

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

Version info

  • Merged into: 26.11.1.1140-master (included in 26.11 and later)

A pull request tested against an older `master` can break tests that landed after its last CI run. #117198 was last tested on 2026-10-11 21:34, merged on 2026-10-12 13:16, and broke two `test_storage_delta` tests added to `master` in between, on every lane, until the automatic revert in #125455.

`MergeQueueCI` now runs `Stateless tests (amd_binary, targeted)` and `Integration tests (amd_binary, targeted)` on the merge group, on the `amd_binary` build the queue already makes. They select the tests covering the changed lines of the queued PR, plus the changed tests and the modules owning changed files (integration). The changed stateless tests are left to the merge-queue flaky check, and the tests that failed earlier in the PR are not rerun: its CI already did, and a flaky one would only bounce the PR from the queue. `Targeting` takes the PR number from the merge group head ref and the diff from the PR itself, because the merge group commit is not the PR head.

Both jobs stop at 40 minutes from their start: the stateless one via `--global_time_limit` (3 repetitions instead of 50), the integration one via the pytest session timeout, which a targeted check does not treat as a failure.

Related: #117198
Related: #125455
@clickhouse-gh

clickhouse-gh Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ec4a0d6]

Summary: ✅


AI Review

Summary

The PR adds targeted stateless and integration checks to MergeQueueCI, selects integration modules affected by changes on master, and limits execution time and failures. The five previous findings are addressed in the current code. No new actionable findings were identified.

Missing context / blind spots
  • ⚠️ The new jobs were not exercised in a real merge-group run. All 23 selection smoke tests and six focused configuration and control-flow checks passed locally; a MergeQueueCI run would close the end-to-end validation gap.
Final Verdict

Status: ✅ Approve

LLVM Coverage Report

Measured on commit ec4a0d6.

Metric Baseline Current Δ
Lines 88.80% 88.80% +0.00%
Functions 91.60% 91.60% +0.00%
Branches 80.50% 80.50% +0.00%

Changed lines: Uncovered code analysis did not run: No coverable C/C++ source files changed (contrib/ is excluded from coverage).

Newly covered: +125 lines in 39 files (-88 lines lost coverage) · Details

Full report

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 13, 2026
Comment thread ci/defs/job_configs.py Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Oct 13, 2026
Comment thread ci/defs/job_configs.py Resolved
fm4v added 6 commits October 17, 2026 09:18
…argeted checks

The coverage selection cannot see a test until a `master` coverage run records it, so a test that landed on `master` after the PR's last CI run escapes it. The `Config Workflow` job of the merge queue (which unshallows the repository) now finds the stateless tests and integration test modules changed on the first-parent history of the queue base after the PR head commit time (or after the merge base, if the PR merged `master` since), keeps the 30 stateless and 10 integration ones whose names share most words with the files the PR changes, and stores them. Both merge-queue targeted checks add them to the selection as mandatory tests. The window and ranking follow #126406.

Replayed on the merge-queue commits of the two known cases: for #117198 the integration selection includes `test_storage_delta/test_writes_interop.py` and `test_storage_delta/test.py`; for #124131 the stateless selection includes `05339_string_filters_during_scan_parquet_short_dictionary_values`.

The merge-queue targeted jobs are no longer cached: their selection depends on the queue entry and the attempt, neither of which is in the digest.
The merge queue is meant to fail fast, so its targeted checks stop at 3
failed tests (`--max-failures 3` for `clickhouse-test`, `--maxfail` for
pytest, with the sequential integration phase getting what remains of the
limit and dropped once it is reached), do not rerun the failed integration
tests, and stop at 20 minutes from their start, the budget of the
merge-queue flaky check, instead of 30. Reaching the time limit stops the
tests without failing the job, as before.

The merge-queue flaky check keeps its 20-minute limit and 5 failures.

The changed stateless tests and those `master` changed after the PR's last
CI run run only in the merge-queue flaky check, which already reruns them
since #126406; the targeted
integration check reruns the integration test modules `master` changed.

Related: #123832
Related: #125292
…tion check

The flaky and targeted integration checks sort the selected modules by name
so the tests of one module stay consecutive. Under the 20-minute cap of the
merge-queue targeted check, which ends the run without failing it, that let
a large coverage selection run first and the PR's changed modules and the
modules `master` changed since the PR CI be cut off, with the job green.
There, order the modules by their first position in the selection instead,
which keeps the tests of one module consecutive too.
Comment thread ci/jobs/integration_test_job.py Resolved
…geted check

`--dist=loadfile` (pytest-xdist 3.8.0) schedules the modules by descending
test count unless `--no-loadscope-reorder` is given, so the priority order
of the previous commit was undone at scheduling: a large coverage-only module
ran before a smaller changed one. Pass `--no-loadscope-reorder` to both
pytest phases of the merge-queue targeted check. Checked with one changed
module and a five-case module: without the flag the five cases ran first,
with it the changed module ran first.
Comment thread ci/jobs/scripts/find_tests.py Resolved
Comment thread ci/jobs/integration_test_job.py Resolved
…r mandatory sequential modules

The integration modules `master` changed since the PR CI now also include
the modules of packages whose supporting files changed (configs, data,
package-local helpers), with the same mapping as for the PR's own changes,
moved to `Targeting.owning_test_modules`. A fixture-only change on
`master`, e.g. `test_database_disk/configs/database_disk.xml`, selected
nothing before.

The parallel phase runs before the sequential one, so in the merge-queue
targeted check a large coverage selection could use the 20-minute budget
before a changed, owning or drift module of the sequential phase started,
and the job passed without it. When the sequential phase has such a module,
the parallel phase now gets half of the budget.
@fm4v
fm4v added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 2, 2026
fm4v added 2 commits November 2, 2026 14:50
In the merge queue the stateless targeted check skips the changed and the previously failed tests, so for a diff without coverage lines nothing resolved `selection_cutoff`, and `selection_manifest` from `master` failed with `KeyError: 'cutoff'`.

https://github.com/ClickHouse/ClickHouse/actions/runs/41423304278/job/125212228455
#125571
@fm4v
fm4v enabled auto-merge November 2, 2026 15:04
@fm4v
fm4v disabled auto-merge November 2, 2026 15:07
@fm4v
fm4v enabled auto-merge November 2, 2026 16:02
@fm4v
fm4v added this pull request to the merge queue Nov 2, 2026
Merged via the queue into master with commit ec51efd Nov 2, 2026
180 checks passed
@fm4v
fm4v deleted the nik/merge-queue-targeted-checks branch November 2, 2026 21:33
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 2, 2026
JTCunning pushed a commit to JTCunning/ClickHouse that referenced this pull request Nov 3, 2026
`Stateless tests (amd_binary, targeted)` and `Integration tests (amd_binary, targeted)` in `MergeQueueCI` stopped at 20 minutes from their start. The integration job hit the limit on broad selections and silently ran only a fraction of them (e.g. 370 of 1618 selected test items for the merge-queue entry of ClickHouse#128706). The merge-queue flaky check keeps its 20-minute limit.

Related: ClickHouse#125571
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.

2 participants