Repository navigation
Do not report a base-branch submodule move as a bugfix-validation failure - #117948
alexey-milovidov merged 8 commits into
Conversation
The CI cache pushes a success record whenever Result.is_ok() holds, which covers OK, SKIPPED and XFAIL. That is right for a verdict determined by the checked-out tree, and wrong for a job whose outcome also depends on run-time state no digest input captures: the record is then reused on a later commit that hashes the same, and the run that would have produced a real verdict never happens. See ClickHouse#109229, where the functional and integration bugfix validators hit exactly this and were made non-cacheable by dropping their digest entirely. do_not_cache is the narrower lever for a job whose digest is load-bearing for scheduling, and it mirrors the existing per-run do_not_block_pipeline_on_failure flag: same Result.ext dict, same complete_job keyword, one runner consumer. It is opt-in and appended last in the signature, so a job that does not pass it keeps today's behaviour exactly, and nothing about digests, affectedness, changed-file filtering or cache lookup changes.
…lure The unit-test bugfix validator refuses to build the before-binary when submodule state differs between the merge-base and the checkout, and reports ERROR. Its message states a disjunction the code never decides: either the PR changes submodule state, or the base branch moved a submodule after the branch split. The workflow checks out GitHub's synthetic merge ref, so HEAD already carries the base tip's pins and master's own submodule motion since the branch split lands in that diff unaided. Any long-lived bugfix branch therefore trips the guard as a function of its age, with nothing contributed by the PR. On every occurrence I looked at, the merge-base to PR-head submodule diff was empty. Over the 30 days to 2026-09-03 that is 139 rows across 70 pull requests, the largest error class of this job, and merging master only moves the merge base, so it returns as soon as a pin moves again. Compute the PR-side diff too and decide. An empty PR-side diff means every drifted path came from the base, which the author cannot influence, so report SKIPPED: is_ok covers it, so the job exits 0 and the check is not red, while is_success does not, so the run still never counts as a validation. That is how the functional and integration validators of the same family already spell a declined verdict. A non-empty PR-side diff keeps ERROR and now names the PR's own paths instead of the disjunction. A diff that cannot be computed keeps ERROR, so an error can never be mistaken for base motion. The refusal itself, its predicate and its strict=True diff are unchanged, and so is every other arm of the job. The abstention is marked non-cacheable because the verdict depends on the merge base, which no digest input captures.
The comment introducing the submodule-drift guard still ended with `Inconclusive (ERROR), not a pass.`, which is no longer true of every arm: base-only motion reports `SKIPPED`, and `Result.is_ok` accepts `SKIPPED`, so the job exits 0 and the check is not red. Name the per-arm statuses instead, and name `Result.is_success` as the predicate that counts neither `ERROR` nor `SKIPPED`, so the sentence a reader meets first is true of all three arms. Comment only, no behaviour change.
Internal second-model review (1 change, 8 declined or noted; re-review clean)Reviewed cold against the resulting code, then a second independent pass, then adjudicated with the ❌ Fixed: the comment introducing the guard still ended "Inconclusive (ERROR), not a pass", which
💡 Noted, not changed: the doubled path list when the PR is the only contributor to the drift; The class kept firing while this was in review: re-measured just before posting, 146 error rows over |
|
Workflow [PR], commit [d9b9c8c] Summary: ✅ AI ReviewSummaryReviewed the current diff and prior discussion. The PR makes the unit-test bugfix validator return Final Verdict✅ No blocking or major issues found in the current head. |
|
cc @alexey-milovidov @maxknv, could you review this? The job now also diffs the merge-base against the PR head, so a submodule pin that the base branch moved after the branch split reports |
Unlike its functional and integration siblings, `Bugfix validation (unit tests)` keeps a `digest_config`, so an `is_ok` result is pushed to the CI cache and reused by any later commit whose digest inputs hash the same. A job digest hashes the checkout's files and submodule revisions (`ci/praktika/digest.py`) and never the merge-base commit, while the verdict is computed against `git merge-base <pr head> origin/master`, which jumps forward the moment the author merges master into the branch. The synthetic merge ref's tree is idempotent under that merge, so the digest can be unchanged across it: on master for 2026-09-03, 2 of 14 one-hour windows changed none of this job's digest paths. Both success exits that read the merge base (the compile-attribution "nothing to validate" `XFAIL` and the reproduced-bug `XFAIL`) were therefore reusable at a merge base they were never computed against, which can hide a later `FAIL`, the one verdict that blocks. They now set `do_not_cache`, like the base-only submodule-drift arm. The three short circuits above the merge-base resolution stay cacheable: they read the PR labels and the changed unit-test files, and `src/**/tests/*` lives inside the digest's `./src`. Keeping those cached is why this job marks individual exits rather than dropping `digest_config` the way the functional and integration validators do: it pulls the binary-builder image and populates submodules before it can short-circuit at all.
Of this job's success exits, the `Not a bugfix PR` short circuit is the one whose verdict can change while its digest cannot. A digest hashes the checkout's files and submodule revisions, so the PR's labels are not an input, and a label moves without any code change. `ci-force-all` is what makes the exit reachable: it bypasses the workflow filter hooks that otherwise skip every `Bugfix` job on a non-bugfix PR, and it skips only the cache lookup, so the run still pushes a success record for (job, digest). Adding `pr-bugfix` and dropping `ci-force-all` afterwards is a changelog category edit, which leaves the tree byte-identical, so the next normal run reuses that `OK` and `new_tests_check` no longer sees the `FAIL` a fresh run would report. The two exits that stay cached read the changed-file set instead, which cannot gain or lose a `src/**/tests/*` entry without also changing the digest.
`complete_job`'s note on the cache flag had no main clause. The submodule guard's note said "either way" in two consecutive sentences, once about the causes of the difference and once about the result arms. The inconclusive-verdict message used an em-dash; plain ASCII punctuation is the house style for user-visible text.
The two commits before this one exempted the verdicts that read the merge base and the one that reads the PR's labels, and left the two changed-file short circuits cacheable, on the argument that a merge cannot add a `src/**/tests/*` entry to the changed set without also changing `./src`. That argument is wrong. The changed set is GitHub's PR file list, the diff from the merge base to the head, while the digest hashes the checkout, which is the base+PR merge ref. When master changes a unit-test file AFTER a run has been cached, and the branch then merges master while keeping its own content for that file, the merge ref's `./src` is still the content the cached run hashed, yet the file has entered the changed set. Measured over nine shapes in which master moves between the two runs: five reproduce it, the producing branch actions being a restore of the branch's own content for that file after the merge, and a merge with `-s ours`. Every verdict of this job reads the merge base, the PR's labels or the changed-file set, so `finalize` marks them all non-cacheable and the per-exit keyword arguments are gone. `digest_config` stays: praktika also uses it to skip the job when the PR touches none of its paths.
The note added beside `do_not_cache` in `complete_job` was two dependent clauses with no main clause, both in its original form and in the first attempt at rewording it.
Related: #111530
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Bugfix validation (unit tests)no longer reports a failure when the only submodule difference between the merge-base and the checkout came from the base branch.Description
The job reports
ERRORwhen submodule state differs between merge-base and checkout, without deciding whether the PR or the base branch moved it. Only a PR-side move is the author's to fix.praktika checks out the synthetic merge ref, so
HEADcarries the base tip's pins: master's submodule motion since the split lands in that diff. Since 2026-08-04: 143 error rows, 70 pull requests, more than all other causes combined (87); latest 2026-09-03. Example: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=116959&sha=40a2ee8c17b1f660a491bf088121e3cd1b428e51&name_0=PR&name_1=Bugfix%20validation%20%28unit%20tests%29So compute the PR-side diff too. Empty means the base moved it, and the job reports
SKIPPED; non-empty keepsERRORand names the PR's paths; an uncomputable diff keepsERROR(fail close). The sibling validators already spell a declined verdictSKIPPED:is_okcovers it (the job exits 0),is_successdoes not.The praktika commit keeps that outcome out of the success cache, and every other verdict of this job with it: each one reads the merge base, the PR's labels or its changed-file set, none of which a digest hashes (
job_configs.pycites PR 109229). The digest stays, because it also gates affectedness. The keyword is opt-in, so no job that omits it changes behaviour.On #111530 you wrote that an inconclusive
ERRORis honest, for a case that "should stay rare (recent merge-bases)". Drift is nonzero at one day of merge-base age, and a base refresh only postpones it (below). If you still preferERROR, say so and I will close this.Alternative, your call:
digest_config=Nonehere, as on the functional and integration validators. That reaches the same place, but the digest is this job's only affectedness gate, so bugfix PRs touching none of its paths would then still schedule a large runner.My branch has no drift, so this PR's CI cannot exercise the new arm.
How to reproduce both measurements
Paths a merge-base of a given age already differs in, against master
41b3bd68a3a31449af85a6d76eff3814db5b6b1c(2026-09-03), counted exactly as the guard counts them:Not monotonic, because a pin can move and move back. The guard fires as a function of branch age rather than of anything the PR did, and merging master clears it only until the next pin moves.
The row counts are
check_status = 'error'(this job leavestest_statusempty, so filtering on it returns zero) withposition(test_context_raw, 'Submodule state differs between the merge-base and the checkout') > 0, onplay.clickhouse.com.Workflow [PR]
Sync PR [sync-upstream/pr/117948]
Version info
26.9.1.1370(included in26.9and later)