Repository navigation
Report an expected failure when the bugfix-validation before-binary cannot compile the overlaid tests - #115511
Conversation
…annot compile the overlaid tests `Bugfix validation (unit tests)` overlays a PR's changed `src/**/tests/*` files onto the merge base and builds `unit_tests_dbms` without the fix. When the fix changes a function signature that an existing gtest calls, the adapted call site can never compile against the merge base, so the job reported a permanent ERROR the PR author cannot avoid - e.g. on PR #113422, where a 2-line adaptation of `gtest_distributed_query.cpp` to `createExchangeLookup`'s new parameter keeps the check red while the actual regression coverage (a functional test, validated green by `Bugfix validation (functional tests)` on both arches) is elsewhere. This signature-adaptation shape is recurring: 18 such rows across 7 PRs in the last 30 days. Attribute the compile errors instead of failing close unconditionally: when every compiler error lies inside the overlaid test files, report the compile step as an expected failure (`XFAIL`, job OK) with "nothing to validate on the unit side". It is deliberately NOT counted as a reproduction - nothing proves the touched suite catches the bug - and the merge gate is unchanged: `new_tests_check.py` still demands a real validation from the functional/integration jobs when such tests exist, and already treats an inconclusive unit result as non-blocking for unit-only PRs. Any other compile failure (errors in fix sources or contrib, a link error, no parsable diagnostic) keeps the fail-close ERROR. Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113422&sha=latest&name_0=PR&name_1=Bugfix%20validation%20%28unit%20tests%29 Related: #113422 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Workflow [PR], commit [ca809a9] Summary: ✅ AI ReviewSummaryThis PR makes Findings
Final VerdictRequest changes until the new compile-log attribution path has focused automated coverage. |
| _ANSI_ESCAPE_RE = re.compile(r"\x1b\[[0-9;]*m") | ||
|
|
||
|
|
||
| def attribute_compile_errors(compile_result, test_files): |
There was a problem hiding this comment.
attribute_compile_errors is now the logic that decides whether a failed before-build becomes a green XFAIL instead of an inconclusive ERROR, but this PR does not add any coverage to ci/tests/test_unit_tests_bugfix_validation.py for that parser at all. The behavior you describe in the PR body depends on correctly separating overlaid-only diagnostics from mixed/linker/no-diagnostic cases and on stripping ANSI-colored output; without focused tests on those log shapes, a future regex or path-normalization tweak can silently misclassify unrelated build failures as expected and turn the validator green.
There was a problem hiding this comment.
🕵 Valid — this PR merged without any coverage for attribute_compile_errors. Added it in a follow-up: #115747
It covers each log shape the attribution must distinguish: errors confined to the overlaid test files, ANSI-colored diagnostics, an error in the fix sources, mixed errors, a linker-error-only log, a log with no parsable diagnostic, warnings/notes (which must not attribute anything), absolute paths outside the before-worktree, duplicate paths across multiple logs, an unreadable log, and no logs at all. The coverage is load-bearing: widening _COMPILE_ERROR_LINE_RE to also match warnings makes one of the new tests fail.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
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 units8 translation units recompiled, 21 s compile time in total, 8 of them have a recent master baseline. |
`attribute_compile_errors` decides whether a failed before-build becomes a
green `XFAIL` ("the overlaid test code depends on the interface the fix
introduces, nothing to validate on the unit side") or an inconclusive `ERROR`.
It landed in ClickHouse#115511 without any test coverage, so a future tweak to the
diagnostic regex or to the path normalization could silently misclassify an
unrelated build failure as expected and turn the validator green.
Add focused tests for every log shape the attribution has to distinguish:
errors confined to the overlaid test files, ANSI-colored diagnostics, an error
in the fix sources, mixed errors, a linker-error-only log, a log with no
parsable diagnostic, warnings and notes (which must not attribute anything),
absolute paths outside the before-worktree, multiple logs with duplicate
paths, an unreadable log, and no logs at all.
Verified the tests are load-bearing: widening the diagnostic regex to also
match warnings makes
`test_attribute_compile_errors_ignores_warnings_and_notes` fail.
Related: ClickHouse#115511
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`Bugfix validation (unit tests)` attributes a before-build compile failure by the path on each `error:` diagnostic line, and reports XFAIL only when every such path is one of the PR's overlaid test files. Clang raises "no matching constructor" at the line that performs the construction, so when the overlaid test constructs the changed type through a template (`std::make_unique` and friends) the only `error:` line is inside libcxx and the overlaid test appears merely on a `note: in instantiation of ...` line. The guard is then false and the job fails closed with ERROR, although the failure is entirely the test adapting to the signature the fix introduces, which the PR author cannot avoid. Observed on PR ClickHouse#111391 head 4cfda50, whose 12,061-line compile log carries exactly one `error:` line, in contrib/llvm-project/libcxx/include/__memory/unique_ptr.h. The XFAIL branch that should have handled it was added by ClickHouse#115511, whose harness commit ca809a9 is an ancestor of that head, so this is a residual sub-shape of a merged feature rather than the pre-fix harness. Add a second attribution basis: the failing ninja edge's translation unit, taken from the `-c <source>` argument of the command ninja prints under `FAILED:`. The before-worktree is merge-base sources with only the PR's test files overlaid, so "which translation unit failed to compile" is exactly what attribution asks, and a broken fix source or contrib header is a different translation unit that fails its own edge. The fail-close property is therefore kept structurally rather than by heuristic. The new basis additionally requires that a parsable compiler error exists somewhere and that every failed edge is a compile whose source could be extracted, so a killed compiler and a link failure both stay ERROR. Deliberately not done: widening `_COMPILE_ERROR_LINE_RE`, and attributing from `note:` lines. The latter is unsafe because the same diagnostic also carries a `note: candidate constructor not viable:` pointing at a fix source, so such a rule would start swallowing genuine fix-source breakage; it would also contradict the invariant ClickHouse#115747 pins. `attribute_compile_errors` and the error regex are unchanged, and ClickHouse#115747's tests pass against this change. Validation: 63 tests in ci/tests/test_unit_tests_bugfix_validation.py (52 existing plus 11 new, 4 of them negative controls). Replaying the two real job logs flips ClickHouse#111391 from ERROR to XFAIL and leaves an already-attributable log's verdict and wording untouched. Each condition was mutation-checked: removing it reddens a specific test. XFAIL already counts as success in `Result.is_ok()` and ERROR was already non-blocking for the merge gate (new_tests_check.py counts only a definitive FAIL), so this changes report truthfulness, not gating.
Related: #113422
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Bugfix validation (unit tests)overlays a PR's changedsrc/**/tests/*files onto the merge base and buildsunit_tests_dbmswithout the fix, expecting a touched gtest suite to fail at runtime. When the fix changes a function signature that an existing gtest calls, the adapted call site can never compile against the merge base, so the job reports a permanent ERROR that the PR author cannot avoid: adapting the call site is mandatory for the PR itself to build, and making it compile against both signatures would only turn the truthful "inconclusive" into an untruthful "failed to reproduce" (the bystander suite passes on the merge base).Concrete case: PR #113422 adapts one call in
gtest_distributed_query.cpp(2 lines) tocreateExchangeLookup's newexecute_locallyparameter. The before-binary fails witherror: no matching function for call to 'createExchangeLookup'in the overlaid test file, and the check stays red even though the real regression coverage — the functional test04746_distributed_plan_execute_locally_subquery_settings— is validated green byBugfix validation (functional tests)on both arches. This signature-adaptation shape occurred in 18 rows across 7 PRs over the last 30 days.The change attributes the before-build's compile errors instead of failing close unconditionally:
XFAIL, job OK) with "nothing to validate on the unit side". It is deliberately not counted as a reproduction — nothing proves the touched suite catches the bug.The merge gate is unchanged:
new_tests_check.pystill requires a real per-arch validation from the functional/integration jobs when such tests exist, and it already treats an inconclusive unit result as non-blocking for unit-only PRs. Only the report status becomes truthful instead of permanently red.The attribution helper was verified against the actual compile log of the failing run (error attributed to the overlaid file; linker-error-only, mixed-error, ANSI-colored and
fatal error:cases fail close or attribute correctly).Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113422&sha=latest&name_0=PR&name_1=Bugfix%20validation%20%28unit%20tests%29
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/115511]
Version info
26.8.1.1730(included in26.8and later)