Repository navigation
Attribute bugfix-validation compile failures by translation unit - #115969
alexey-milovidov merged 6 commits into
Conversation
`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.
Two review findings on the previous commit. First, the unattributable-edge check only guarded the translation-unit basis. `compile_failure_attribution` returned as soon as every `error:` path was an overlaid test file, before it looked at the failed ninja edges at all, so a compile log carrying an `error:` inside an overlaid test together with a failed link edge was reported XFAIL even though the link failure names no translation unit and is not attributable to a test adaptation. That behaviour is pre-existing and not introduced by the previous commit: running the merge base's `attribute_compile_errors` over such a log returns (['<overlaid test>'], []), so the `overlaid_errors and not other_errors` guard is already true there and the merge base already reports XFAIL, and its step-4b comment already promised that the linker fails close. What the previous commit did own were two claims about it that were not true. Its new test `test_attribution_fails_close_on_a_link_failure` advertised in its docstring that it covered that shape; measured with the production regex, the fixture's only error-carrying path is the libcxx header, so it exercised the translation-unit basis alone. And it rewrote the step-4b comment into a general promise the code did not honour for the error-path basis. Hoist the edge scan above both bases so a non-empty `unattributable` fails close for either one, correct the docstring, and add the missing arm: an `error:` line inside the overlaid test plus a failed link edge, asserting the failure is not attributable. Basis one deliberately still does not require a failed compile edge to exist, because a log with no `FAILED:` line at all is a shape several fixtures use and must keep its verdict. Second, every test called the pure helpers directly, so nothing asserted the transition in `main()` that the job actually reports. Deleting the `compile_failure_attribution` call site, or the XFAIL status flip, kept the whole suite green while the user-visible ERROR to XFAIL outcome regressed. Add two tests that drive `main()` through a monkeypatched step 4b: one asserting the real template-instantiation shape comes out XFAIL with nothing to validate, and a negative control asserting a fix source failing its own edge still comes out ERROR and inconclusive, so the positive arm cannot be satisfied by everything becoming XFAIL. Also re-wrap two ragged comment paragraphs left by the previous commit. No comment text was added or removed. Validation: 66 tests, 14 of them new since the merge base, 7 negative controls and 2 driving `main()`. Twelve mutation arms in total, each reddening a specific test; the two that revert the call site or the status flip redden only the new `main()`-level tests, which is what shows that transition was untested. Both real job logs replay to byte-identical verdicts and wording, the error regex and `attribute_compile_errors` remain byte-identical to the merge base, and the 11 tests added by the open PR ClickHouse#115747 pass against this file, checked with an import-path control and a sensitivity control.
…stics The non-test-source check sat below the error-path basis, so it only ever guarded the translation-unit basis. A before-build where the overlaid test carries the only parsable error: while a fix source fails its own compile edge with no diagnostic of its own (a killed compiler, OOM, prlimit) satisfied the error-path basis and reported XFAIL, even though a translation unit outside the overlaid tests demonstrably failed to compile. Both edge-derived refusals now precede either basis through one shared path, and the duplicate check below the second basis is removed rather than left to drift. The behaviour predates this branch: the merge-base guard is also true on such a log, so master reports XFAIL there too, and the merge-base step-4b comment already promised that a failed fix-source translation unit fails close. What is new here is that this branch restates that promise while carrying the other half of the same guard, and that a test advertised the coverage. compile_failure_attribution also returns a phrase naming what defeated attribution. On both edge-derived refusals the error-path split is empty, so the report previously said the errors could not be attributed without naming anything the operator could act on. Adds the mixed-edge regression case, a main()-level assertion that the phrase reaches the reported info, and a case pinning that an empty edge list must not withhold the error-path basis: a log with no FAILED: line at all is attributable on the diagnostics alone.
`failed_compile_edge_sources` classified a failed edge as unattributable whenever the next line yielded no `-c <source>`. That conflated two states with opposite evidential weight: a command line that was read and is not a compile (a link step, an archive step, a custom command), which is evidence that something outside the overlaid tests failed; and a command line that could not be read at all, because the log ends after the `FAILED:` line or a diagnostic stands in its place, which is only the absence of evidence about that edge. Because the second state was treated as the first, a log whose diagnostics place every `error:` inside the overlaid test files came out as ERROR even though the error-path attribution basis was satisfied on its own. Merged master reports XFAIL for that shape. Split the edges three ways instead. A read non-compile edge and a failed translation unit outside the overlaid tests keep defeating both bases. An unreadable command line defeats only the translation-unit basis, which claims every failed translation unit is an overlaid test file and therefore needs all of them enumerated; it no longer withdraws an attribution the diagnostics already establish. The unattributable-edge guard and the non-test-source guard, which the two previous rounds added, are unchanged in effect: a link failure alongside an error inside an overlaid test, and a fix source whose compiler was killed alongside the same error, both still fail close. Both real CI compile logs carry the command after every `FAILED:` line, so neither changes verdict. `_COMPILE_ERROR_LINE_RE` and `attribute_compile_errors` are untouched: notes and warnings still attribute nothing. Co-Authored-By: Claude Fable 5 <[email protected]>
Two narrow classification rules in the failed-edge scan sent attributable failures to ERROR. The scan decided a line was not a command line by testing it against one diagnostic shape, "path:line[:col]: ". Every other line clang can print in a diagnostic block therefore fell through and was filed as evidence that something which is not a translation unit failed. "In file included from ..." is one of those lines, and it is the first line clang prints for the template-instantiation failure this attribution exists to cover, so the before-build of a PR whose gtest constructs a changed type through std::make_unique was reported as an unattributable infrastructure error rather than the expected failure it is. Source excerpt and caret lines behaved the same way. Recognise the command line positively instead: it starts with the program ninja ran, optionally behind cmake's ": && " or "cd <dir> && " wrapper. A line that is not recognised now withholds only the basis that needs every failed translation unit enumerated, and never manufactures evidence about the edge. The second basis also required a parsable compiler error to exist somewhere in the log rather than in the failed edge's own diagnostics, so when two overlaid tests each failed their own edge and only the first explained why, the killed compiler of the second was answered for by the first edge's error and the failure was attributed. Scope each edge's diagnostics to the lines before the next failed edge and refuse when a compile edge raised no error of its own. Both behaviours were introduced by earlier commits in this branch; the whole-log refusal wording is kept for a log with no readable edge to name.
…lidator tests Master's ClickHouse#115747 and ClickHouse#115797 added 264 lines of coverage for the pre-existing attribute_compile_errors layer to ci/tests/test_unit_tests_bugfix_validation.py, the same file this branch adds 784 lines to. Both additions are purely additive against the merge base and anchored at the same two points (the import list and the end of the module), and their top-level symbols do not intersect, so the resolution keeps both sides in full. Master keys its fixtures off _OVERLAID / _compile_result / _run_main_with_compile_failure; this branch off _TEST_FILE / _compile_log / _drive_main_to_compile_step. The two vocabularies coexist. Collected tests go from 83 (ours) and 66 (master's), which share 52 base tests, to their exact union of 97, verified by test-name set equality rather than by a count. ci/jobs/unit_tests_bugfix_validation_job.py is untouched: master did not change it.
Internal second-model review (click to expand)Six review rounds against an independent second model. All blockers fixed; the two entries
Earlier rounds fixed: an overlaid error plus a failed link edge reporting Verification of the final tree: 97 tests pass, including all 66 from the merged PR 115747, which |
|
Workflow [PR], commit [969c02e] Summary: ✅ AI ReviewSummaryThis PR extends Findings
Final Verdict
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-review-slot-8:20260823-011200 |
|
cc @alexey-milovidov, could you review this? It extends the XFAIL branch you added in PR 115511: attribution now also accepts the failing ninja edge's translation unit, so a construction through std::make_unique whose only |
| "failed build steps with no compiler diagnostic of their own: " | ||
| + ", ".join(diagnostic_free), | ||
| ) | ||
| if overlaid_errors and not other_errors: |
There was a problem hiding this comment.
overlaid_errors wins here before unreadable is consulted, so an extra abridged FAILED: block can still be reported as test-only. A minimal repro is:
FAILED: src/CMakeFiles/x.dir/gtest_wb.cpp.o
/usr/local/bin/clang++ ... -c /ClickHouse/ci/tmp/before_src/src/Disks/tests/gtest_write_buffer_inline_or_blob.cpp
/ClickHouse/ci/tmp/before_src/src/Disks/tests/gtest_write_buffer_inline_or_blob.cpp:42:5: error: ...
FAILED: src/CMakeFiles/y.dir/WriteBufferInlineOrBlob.cpp.o
ninja: build stopped: subcommand failed.
compile_failure_attribution currently returns the XFAIL reason on that log, even though the second failed edge could be a fix source or the linker and the log is merely incomplete about it. I think unreadable additional FAILED: blocks need to fail closed unless they can be proven to be the same edge already attributed.
| "failed build steps with no compiler diagnostic of their own: " | ||
| + ", ".join(diagnostic_free), | ||
| ) | ||
| if overlaid_errors and not other_errors: |
There was a problem hiding this comment.
This early overlaid_errors return still bypasses the unreadable-edge refusal below.
Concrete trace:
FAILED: src/CMakeFiles/x.dir/gtest_wb.cpp.o
/ClickHouse/ci/tmp/before_src/src/Disks/tests/gtest_write_buffer_inline_or_blob.cpp:42:5: error: ...
FAILED: src/unit_tests_dbms
ninja: build stopped: subcommand failed.
On that log, failed_compile_edge_sources reports both edges as unreadable, but compile_failure_attribution still returns the "every compile error is inside..." XFAIL reason because this branch runs before the unreadable check. That means a truncated link or fix-source failure can be reported as "the failure belongs to the overlaid tests alone", which breaks the fail-close contract described in the docstring and PR text.
Can we reject unreadable extra FAILED: edges before accepting the error-path basis, or otherwise narrow the single-edge abridged-log exception so it does not also cover multi-edge truncated logs?
There was a problem hiding this comment.
Confirmed and fixed in a37e745.
I reproduced both traces. failed_compile_edge_sources filed the second FAILED: edge as
unreadable, which withholds only the translation-unit basis, so the error: inside the
overlaid test still satisfied the error-path basis and the log came out XFAIL. The
docstring did promise otherwise.
I did not reject unreadable edges before the error-path basis, because that fails close on
the abridged single-edge log that master reports as an expected failure
(test_main_compile_failure_only_in_overlaid_tests_is_xfail, added in #115747): its one
FAILED: line also carries no command, and I measured that rule turning it into ERROR.
What actually makes such an edge unaccountable is silence, not unreadability, and the job
already refuses a compile edge that raised no parsable error of its own. So an edge with no
diagnostic in its own window now joins diagnostic_free whether or not its command line was
read, and unreadable keeps only edges that did contribute a diagnostic and therefore cannot
contradict the error path. Both of your traces are ERROR now, naming the silent step;
master's fixture stays XFAIL.
Verified across 14 log shapes, 0 mismatches. The three earlier fail-close shapes (a readable
link edge, a readable fix-source edge, two overlaid edges with the second killed) are
unchanged, and the two real captured job logs still resolve as before. Reverting the change
reddens 2 tests; routing every unreadable edge to diagnostic_free instead reddens 11 of
mine and 1 of master's. Suite is 99 plus master's 66.
There was a problem hiding this comment.
The fix for the fail-open reported above is in #115973: this PR merged at 04:03:15Z, a few
minutes before the commit landed on the branch, so it goes in as a follow-up rather than
another push here.
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 units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
78e5947
A failed ninja edge whose command line cannot be read was filed as `unreadable`, which withholds only the translation-unit basis, so an `error:` inside an overlaid test still satisfied the error-path basis and the log was reported XFAIL. An abridged log can end a `FAILED:` block for the linker or a fix source that way, and then the report claims the failure belongs to the overlaid tests alone. Silence, not unreadability, is what makes such an edge unaccountable, and the job already refuses a compile edge that raised no parsable error of its own. Classify by that instead: an edge with no diagnostic in its own window joins `diagnostic_free` whether or not its command line was read, and `unreadable` keeps the edges that did contribute a diagnostic and so cannot contradict the error path. Refusing every unreadable edge instead would fail close on an abridged log whose one edge does carry the overlaid test's error, which master reports as an expected failure. Reported by clickhouse-gh[bot] on ClickHouse#115969.
A failed ninja edge whose command line cannot be read was filed as `unreadable`, which withholds only the translation-unit basis, so an `error:` inside an overlaid test still satisfied the error-path basis and the log was reported XFAIL. An abridged log can end a `FAILED:` block for the linker or a fix source that way, and then the report claims the failure belongs to the overlaid tests alone. Silence, not unreadability, is what makes such an edge unaccountable, and the job already refuses a compile edge that raised no parsable error of its own. Classify by that instead: an edge with no diagnostic in its own window joins `diagnostic_free` whether or not its command line was read, and `unreadable` keeps the edges that did contribute a diagnostic and so cannot contradict the error path. Refusing every unreadable edge instead would fail close on an abridged log whose one edge does carry the overlaid test's error, which master reports as an expected failure. Reported by clickhouse-gh[bot] on ClickHouse#115969.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Related: #115511
Bugfix validation (unit tests)still reportsERRORon a compile failure #115511 shouldreport as
XFAIL.The job attributes such a failure by the path on each
error:line. Clang reports "nomatching constructor" at the line performing the construction, so when the overlaid test
constructs the changed type through a template (
std::make_uniqueand friends) the onlyerror:line is inside libcxx and the test appears merely on anote: in instantiation of ...line.overlaid_errors and not other_errorsis then falseand the job fails closed, though the failure is only the test adapting to a signature change
it cannot avoid: see
#111391,
whose single
error:line is incontrib/llvm-project/libcxx/include/__memory/unique_ptr.h.This adds a second attribution basis: the failing ninja edge's translation unit, taken from
the
-c <source>argument of the command ninja prints underFAILED:. The before-worktreeis merge-base sources plus only the overlaid tests, so that is what attribution asks, and a
broken fix source or contrib header is another translation unit failing its own edge. Three
conditions fail close on both bases, the pre-existing error-path one included: an edge
proven not to be a compile (a link or archive step), a compile of anything but an overlaid
test, and a compile edge raising no parsable error of its own, as a killed compiler leaves
behind. The
ERRORmessage names which fired.I did not attribute from
note:lines: the same diagnostic carries anote: candidate constructor not viable:naming a fix source, so such a rule would swallowreal fix-source breakage. The error regex and
attribute_compile_errorsare unchanged.Validation in
ci/tests/test_unit_tests_bugfix_validation.py: every conditionmutation-checked, with negative controls and tests driving
main(). Replaying two real joblogs flips #111391 to
XFAILand leaves an already-attributable one untouched.ERRORwasalready non-blocking, so only report truthfulness changes.
Workflow [PR]
Sync PR [sync-upstream/pr/115969]
Version info
26.8.1.1933(included in26.8and later)