Skip to content

Report an expected failure when the bugfix-validation before-binary cannot compile the overlaid tests - #115511

Merged
alexey-milovidov merged 1 commit into
masterfrom
bugfix-validation-unit-signature-adaptation
Aug 20, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
bugfix-validation-unit-signature-adaptation

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 19, 2026 •

Copy link
Copy Markdown
Member

Related: #113422

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

Bugfix validation (unit tests) overlays a PR's changed src/**/tests/* files onto the merge base and builds unit_tests_dbms without 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) to createExchangeLookup's new execute_locally parameter. The before-binary fails with error: 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 test 04746_distributed_plan_execute_locally_subquery_settings — is validated green by Bugfix 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:

  • every compiler error lies inside the overlaid test files → the changed test code depends on the interface the fix introduces; the compile step is reported 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.
  • any error elsewhere (fix sources, contrib, a link error, or no parsable diagnostic at all) → fail close with ERROR, as before.

The merge gate is unchanged: new_tests_check.py still 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

  • Merged into: 26.8.1.1730 (included in 26.8 and later)

…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]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ca809a9]

Summary: ✅


AI Review

Summary

This PR makes Bugfix validation (unit tests) treat a before-build compile failure as an expected outcome when the compile diagnostics can be attributed entirely to the overlaid test files. The direction looks reasonable, and I verified that it does not change the merge gate in new_tests_check.py, but I found one important gap in the proof for the new behavior.

Findings

⚠️ Majors

  • [ci/jobs/unit_tests_bugfix_validation_job.py:468] attribute_compile_errors is now what decides whether a failed before-build becomes a green XFAIL instead of an inconclusive ERROR, yet the PR does not extend the dedicated helper tests in ci/tests/test_unit_tests_bugfix_validation.py. The contract here depends on correctly classifying overlaid-only, mixed, linker-only, no-diagnostic, and ANSI-colored compiler output; without focused regression tests, a small parser regression can silently turn unrelated build failures into a passing validator.
Final Verdict

Request changes until the new compile-log attribution path has focused automated coverage.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 19, 2026
_ANSI_ESCAPE_RE = re.compile(r"\x1b\[[0-9;]*m")


def attribute_compile_errors(compile_result, test_files):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🕵 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.

@clickhouse-gh

clickhouse-gh Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing ca809a9fc with master 27f733d4f (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 703.88 MiB 700.84 MiB -3.04 MiB (-0.43%)

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 units

8 translation units recompiled, 21 s compile time in total, 8 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Aug 20, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 20, 2026
Merged via the queue into master with commit 2998f20 Aug 20, 2026
180 checks passed
@alexey-milovidov
alexey-milovidov deleted the bugfix-validation-unit-signature-adaptation branch August 20, 2026 03:07
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 20, 2026
valerypetrov pushed a commit to valerypetrov/ClickHouse that referenced this pull request Aug 22, 2026
`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]>
pull Bot pushed a commit to admariner/ClickHouse that referenced this pull request Aug 23, 2026
`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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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