Repository navigation
Install the test configs for real in the CFI classification guard - #115825
Conversation
The guard did not run tests/config/install.sh. It cut a fragment out of it with sed -n '/^function is_sanitizer_build()/,/^fi$/p' and eval'ed that. The range ends at the first bare ^fi$ after the anchor, which on master is the one closing the if is_sanitizer_build block, so the ln -sf the assertions depend on was inside the captured text only by luck of layout. Any bare fi inserted between the function and that if truncates the range: the fragment loses the symlink, and all five disables_symbolization parameters fail on a tree whose classification is correct. ClickHouse#113107 inserts a new function plus its own if/fi there and is red for it. The four keeps_symbolization parameters share the helper and go vacuously green on that tree, because nothing installed is their expected answer, so fixing only the failing five would have left the other half asserting nothing. The helper now runs the installer with a stub clickhouse earlier on PATH, into the test's tmp_path, and asserts the resulting symlink. That removes the text extraction rather than moving its anchor, which would only relocate the next collision. The symlink has to resolve to the installer's own copy, not merely exist as a directory entry. ln -sf succeeds against an absent source, and a dangling link leaves the server reading nothing while is_symlink() alone still answers yes. The stub answers --version because the whole installer reaches check_clickhouse_version where the fragment never did; without it every version gate fails and the installer silently takes the too-old path. Pinning the one random gate in the region with --no-keeper-inject-auth, that drops backoff_policy_25_4.xml, keeper_max_request_size.xml and http_url_prefix.xml from config.d, and distributed_index_analysis.yaml and http_paths.xml from users.d. The child environment is an allow-list of PATH so an exported USE_* on a runner cannot steer the run. Six mutations of a scratch install.sh still redden it: the bare -fsanitize= revert reds only amd_cfi, and deleting the wiring, making the predicate ignore the build flags in either direction, pointing the symlink at another file, or leaving it dangling red the expected arms. Related: ClickHouse#115591
Internal second-model review (click to expand)Two review rounds, an independent cold review plus a second model against the whole diff each round.
The |
Pre-PR validation gate (click to expand)
Determinism: 20 consecutive runs, 20 identical passes (
|
|
Workflow [PR], commit [fce7e73] Summary: ✅ AI ReviewSummaryThis PR replaces the Missing context / blind spots
Findings
Final VerdictChanges requested: the new installer harness itself looks correct, but the CFI classification invariant is still violated in |
|
cc @maxknv, could you review this? It replaces a sed-extracted-and-evaled fragment of tests/config/install.sh in ci/tests/test_cfi_not_a_sanitizer_build.py with a real run of the installer against a stub clickhouse, because the sed range ended at the first bare fi and any insertion in that region silently dropped the symlink the assertions depend on. |
| DEST_SERVER_PATH=str(dest), | ||
| ) | ||
| dest = tmp_path / "server" | ||
| run = subprocess.run( |
There was a problem hiding this comment.
The installer path is guarded now, but the same CFI-vs-runtime-sanitizer invariant is still broken in tests/integration/test_userspace_page_cache/test.py:13-33: _is_sanitizer_build returns "-fsanitize=" in result.stdout, so amd_cfi is still treated as sanitized. In WeeklyCFI that keeps node_smol out of the cluster and skips test_size_adjustment at tests/integration/test_userspace_page_cache/test.py:52-59,283-284, so the regression can still survive on that sibling path. I think this needs the same -DSANITIZER contract there, or a shared helper, so CFI is not misclassified outside the installer guard.
There was a problem hiding this comment.
Agreed, and the consequence is worse than the residual note I left on #115591.
test.py:31 is a bare -fsanitize= test, and the CFI profile's CXX_FLAGS row carries
-fsanitize=cfi-vcall,cfi-derived-cast (CMakeLists.txt:527, concatenated into the published row by
cmake/print_flags.cmake:2), so amd_cfi classifies as sanitized. Measured against the CXX_FLAGS
rows of nine real profiles: the bare test misclassifies 1 of 9 (amd_cfi), the -DSANITIZER marker
0 of 9.
The skip is reached, and CIDB shows the coverage loss rather than only predicting it. Master's
WeeklyCFI does run cfi_integration_jobs (ci/workflows/weekly_cfi.py:32,
ci/defs/job_configs.py:406-416), and test_userspace_page_cache/test.py::test_size_adjustment is
SKIPPED in all 10 Integration tests (amd_cfi, *) runs of the last 60 days (2026-07-13 to
2026-08-17), while it runs OK in the non-sanitizer lanes (arm_binary, amd_llvm_coverage) and is
SKIPPED in every real sanitizer lane. CFI loses that test outright.
I am not folding it into this PR. This one de-brittles the guard's oracle in ci/tests/; the
predicate is a separate root cause in a separate harness, and a reviewer is already looking at this
diff. Your two options are not equivalent either: the local probe runs before any instance exists, so
it cannot call ClickHouseInstance.is_built_with_sanitizer, and a plain marker swap would leave a
second copy of the classification rule with nothing to redden if it regresses. Two independent copies
are what produced this bug, so the shared-helper shape is the one worth designing. That is queued as
its own change.
One correction to my own note on #115591, where I disclosed this residual as "one extra container
under CFI, not user-reachable": that was wrong in both halves. The misclassification suppresses
node_smol and skips test_size_adjustment, so it is one FEWER container plus lost coverage, which
is CI signal loss.
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. |
alexey-milovidov
left a comment
There was a problem hiding this comment.
We don't use ci/tests, they will be removed.
4506fb9
|
Understood, I will stop adding tests there. Dropping the One measured note on #115650 before it merges: its merge base is Is there a place you want harness-level checks like this one to live instead, or should they not be replaced at all? |
`ci/tests/` is being removed, so this change stops adding to it. The review that approved ClickHouse#115825 reads, in full, "We don't use ci/tests, they will be removed.", and ClickHouse#115650 (+9/-24715) is open against that directory: its file list includes `ci/tests/test_unit_tests_bugfix_validation.py`, `ci/tests/test_new_tests_check_unit_gate.py` and `ci/jobs/ci_tests_job.py`, the runner that executes them. The first tranche, ClickHouse#114675 (+0/-6543), merged on 2026-08-15. The 15 arms added in the three earlier rounds of this change are therefore deleted rather than thinned or relocated: thinning still adds to a directory that is going away and still leaves a conflict to resolve. The earlier precedent for adding there, ClickHouse#114400, merged on 2026-08-13, before both that tranche and that review, so it does not license adding there now. What remains under `ci/tests/` is three stub signatures, and they are not arms kept by preference. `configure_before_binary` and `compile_before_binary` take a build type in this change, so without the adaptations 9 of that module's 97 existing cases raise `TypeError` and the live `CI Tests` job goes red on this PR. With them the module is 97/97 and the sibling gate module is 5/5. The correctness argument does not depend on the deleted arms. Fourteen mutants across the three earlier rounds each reddened only the case written for it and never a pre-existing one, and the last three were first run against all 109 pre-existing cases and survived, which is what established that each claim was genuinely uncovered rather than redundant. That record is evidence about this change, not shipped coverage. The module's own docstring already states that the build and run orchestration is validated separately in CI, so the file returns to exactly the coverage it had rather than below it; what is given up is a live regression guard for the escalation loop until ClickHouse#115650 lands. Separately, the module docstring claimed this job "builds the before binary in parallel with the build matrix (it starts as early as the functional/integration validators)". It does not: `ci/workflows/pull_request.py:139` is `JobConfigs.bugfix_validation_ut_job.set_run_after(CORE_BLOCKING_JOB_NAMES)`, the comment directly above it says the job is deferred behind the core blocking jobs, and that list includes every unit-test job. The clause was master's, but this change re-flowed the paragraph around it, so it is corrected here. The artifact-dependency half is true and stays: the job does not need the PR's `UNITTEST_AMD_ASAN_UBSAN` artifact, so it is not gated behind `build_amd_asan_ubsan`.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
ci/tests/test_cfi_not_a_sanitizer_build.pydid not runtests/config/install.sh: itevaled afragment cut out with
sed -n '/^function is_sanitizer_build()/,/^fi$/p'. That range ends at thefirst bare
^fi$after the anchor, which on master closesif is_sanitizer_build; then ln -sf ... trace_log_no_symbolize.xml ..., so the wiring was capturedonly by luck of layout.
Inserting any bare
fibetween the function and thatiftruncates the range, so the fragment losesthe
ln -sfand all fivetest_installer_disables_symbolization_under_a_sanitizerparameters failon a correct tree. #113107 does exactly that. The four
test_installer_keeps_symbolization_without_a_sanitizerparameters share the helper and govacuously green there, since "nothing installed" is their expected answer.
The guard now runs the real installer with a stub
clickhouseearlier onPATH, into the test'stmp_path, and asserts the resulting symlink. Nosed, noeval, so rearranging that region cannotaffect it. Same nine parameters, one function, 21 lines replaced.
tests/config/install.shis notmodified: the shell predicate is correct and is the subject under test. The link must resolve to the
installer's own copy, not merely exist:
ln -sfsucceeds against an absent source, and a danglinglink leaves the server reading nothing.
Validated with the #113107 installer (5 failed before, 22 passed after) and with a bare
fiinjected before the consuming
if(22 passed). Six mutations of a scratchinstall.shconfirm theoracle still discriminates: the bare
-fsanitize=revert reds onlyamd_cfi; deleting the wiring,ignoring the build flags either way, pointing the symlink elsewhere, and leaving it dangling each
red the expected arms. 20 runs, 20 identical passes.
pytest ci/tests/failure ids are unchanged.One limit:
assert run.returncode == 0catches less than it looks, since the installer's probes sitin command substitutions, so a stub refusing every call still exits 0. Such a break surfaces through
the symlink assertion instead.
Workflow [PR]
Sync PR [sync-upstream/pr/115825]