Skip to content

Do not schedule the unit bugfix validation when the functional or integration one owns the verdict - #118108

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:skip-unit-bugfix-validation-when-ft-it-owns-verdict
Sep 13, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:skip-unit-bugfix-validation-when-ft-it-owns-verdict

Conversation

@groeneai

@groeneai groeneai commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #117894

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

...

Description

On a bug-fix PR whose reproducer is an SQL or integration test, Bugfix validation (unit tests)
reports a red check the author cannot clear when the PR also touches a gtest file for scoping:

Failed to reproduce the bug.
Touched unit tests on the before-binary (must fail): fail: 0, passed: 1

Master's gtest suite is green, so such a file passes on the merge base by construction.

new_tests_check.check is mutually exclusive on the functional/integration-vs-rest axis by
design: it returns inside its has_ft or has_it branch (new_tests_check.py:230-242), so the
branch that reads the unit validator (:251) is unreachable whenever the PR carries such a test.
filter_job.should_skip_job already declines the functional arms when a PR changes no functional
test, and the integration arms likewise, but had none for the unit one. So it scheduled a
merge-base unit_tests_dbms build whose verdict nothing reads, and a FAIL there exits 1.

This adds the missing arm, reusing the predicates the consumer branches on.

Measured over 60 days of CI DB records:

  • 9 false reds removed on 9 PRs (8 other contributors', 3 merged with the red on them)
  • ~553 merge-base unit_tests_dbms builds no longer started
  • 244 "Bug reproduced" reports, on 66 PRs, no longer emitted

Those 244 are genuine reproductions, but the gate never reads them and each such PR is validated by
its functional or integration arm. The 7 events on 4 PRs where the unit arm is the gate are
untouched.

The repo has no test harness for ci/jobs/**. Validation is a matrix calling should_skip_job
on the real base-diff file lists of 13 carrier PRs: 9 skip, and the 4 unit-only ones keep
refuting.

If you would rather it kept running and abstained, that variant is ~12 lines in
ci/jobs/unit_tests_bugfix_validation_job.py, at the cost of a cacheable non-FAIL record; your
call.


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

…egration one owns the verdict

`new_tests_check.check` is mutually exclusive on the functional/integration-vs-rest axis
by design: it returns inside its `has_ft or has_it` branch (new_tests_check.py:230-242),
so the branch that reads the unit validator (:251) is unreachable whenever the PR carries
such a test. `unit_bugfix_validation_refuted` is that job's only consumer.

`filter_job.should_skip_job` already declines to schedule the two functional arms when a
PR changes no functional test, and the two integration arms when it changes no integration
test, but had no arm for the unit one. So on a bug-fix PR whose reproducer is an SQL or
integration test, and which also touches a gtest file for scoping or whitelist reasons, it
built a merge-base unit_tests_dbms and emitted a verdict nothing reads. Master's gtest
suite is green, so the touched suite passes on the merge base by construction, the verdict
is FAIL, and Result.complete_job exits 1: a red check the author cannot clear.

This adds the missing arm, so each Bugfix-validation arm is scheduled iff
`new_tests_check.check` can consult it. It reuses the two predicates the consumer branches
on and that this file already imports, so the scheduler and the gate cannot diverge.
Whenever the arm fires, a functional or integration arm exists to hold the verdict, and a
missing one leaves the PR blocked, so nothing merges unvalidated.

At the scheduler rather than inside the job, because a should_skip_job skip is excluded
from the praktika cache by construction (hook_cache.py:101-107 via native_jobs.py:651) and
Config Workflow is uncached, so the decision is re-derived on every commit: delete the SQL
test later and the arm is scheduled again and refutes correctly. An in-job abstention would
instead create a cacheable non-FAIL record whose correctness depends on tests/queries/**,
which is not a digest input. That is the hazard 3c57efc was written about.

Measured over 60 days of CI DB records, per (pr, sha): 9 false red checks removed on 9 PRs,
8 of them other contributors' and 3 merged with the red still on them; about 553 merge-base
unit_tests_dbms builds no longer started; and 244 "Bug reproduced" reports on 66 PRs no
longer emitted, none of which the gate read. The 7 events on 4 PRs where the unit arm is
the gate are untouched.

Validated by calling should_skip_job on the real base-diff file lists of 13 carrier PRs:
0 of 13 skip on pristine master, 9 of 13 with this change, and the 4 unit-only carriers
keep running and keep refuting. The same matrix with the condition inverted flips every
value, and judged against the as-implemented expectations it fails, so it is not vacuous.
The repo has no test harness for ci/jobs/**.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 4, 2026
@groeneai

groeneai commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: 2 rounds, 0 findings

An independent cold read of the diff plus a second-model pass over the full changed hook, its
post-hook consumer, the job configuration and the praktika filter/cache path each returned
0 findings, so nothing was overridden.

The two properties I checked hardest, since they are what could make this unsafe:

  • Nothing can merge unvalidated. The arm's predicate is the exact complement of the condition
    under which new_tests_check.check reaches its unit branch, and it calls the same two predicate
    objects that check branches on, so the scheduler and the gate cannot diverge. Whenever the arm
    fires, a functional or integration arm holds the verdict, and a missing one leaves the PR blocked.
  • The decision is not cacheable. A should_skip_job skip goes through set_job_as_filtered,
    which excludes the job from cache lookup, and the cache record is only written from the job runner
    on an is_ok() result, which a skipped job never reaches. Config Workflow is itself uncacheable,
    so the arm is re-derived on every push: delete the SQL test later and it is scheduled again.

Filtering a Bugfix-validation arm is also not a new mechanism here: on every non-bugfix PR all five
arms are already filtered by the existing "not a bug-fix PR" arm in the same function.

@clickhouse-gh

clickhouse-gh Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c4ccd97]

Summary: ✅


AI Review

Summary

This PR teaches filter_job.should_skip_job to skip Bugfix validation (unit tests) when a bug-fix PR already carries functional or integration regression tests, which matches the mutually exclusive gate in new_tests_check.py that ignores the unit validator in those cases. I did not find a correctness or workflow-regression issue in the current diff.

Final Verdict

✅ No blocking concerns.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 4, 2026
@groeneai

groeneai commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator Author

cc @maxknv, could you review this? new_tests_check.check returns inside its has_ft or has_it branch before it ever reads the unit validator, so on a bug-fix PR whose reproducer is an SQL or integration test and which also touches a gtest for scoping, Bugfix validation (unit tests) built a merge-base unit_tests_dbms and emitted a verdict nothing consults, and a FAIL there is a red check the author cannot clear. This adds the missing should_skip_job arm, reusing the two predicates the consumer branches on so the scheduler and the gate cannot diverge.

@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Sep 4, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@alexey-milovidov alexey-milovidov self-assigned this Sep 13, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 13, 2026
Merged via the queue into ClickHouse:master with commit 3ed2990 Sep 13, 2026
174 of 175 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect manual approve Manual approve required to run CI 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