Skip to content

Fix version-pinned settings-history gate self-test - #116107

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-settings-history-gate-selftest-version-pin
Aug 24, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-settings-history-gate-selftest-version-pin

Conversation

@groeneai

@groeneai groeneai commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

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

ci/tests/test_settings_history_source_gate.py::test_renaming_a_record_in_place_is_allowed has
been failing on pristine master since the 26.9 version bump (4399d6c6ae11), so the CI Tests
check reds for content-independent reasons. Example report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=115823&sha=174bdb4a215efb07da55617613f83f77c7431e53&name_0=PR&name_1=CI%20Tests

Root cause: the cell asserted a green outcome from the real check_settings_changes_history() with
cwd at the repo root, so the gate resolved the current version from the live
cmake/autogenerated_versions.txt and looked the name up in the live
SettingsChangesHistory.cpp, while the fixture pinned its record's block to the literal 26.8 and
used the real record s3_base. The bump made 26.8 an old block, so the gate demanded a 26.9
block, and master has none yet. This was the first release bump since the cell was added, which is
why it was never caught.

The fix runs this one cell against a tmp_path cwd holding only the two files the gate reads, both
written by the fixture, so the version it declares and the version the gate resolves are the same
fixture-local constant and cannot drift again. _run, _rename_patch's signature and the other 11
cells are unchanged.

Validation: the suite goes from 1 failed, 11 passed to 12 passed, and passes with the version
file set to 26.8, 26.9 and 26.10. Liveness is measured, not assumed: mutating the gate's
current-block membership test (if name not in current_block... to if True:) reddens this cell,
as does pinning its version resolution to 0.0; with the cell deselected, that first mutation is
undetected by all 61 settings-history tests, so it is the only cell covering the gate's accept path.
check_style.py is byte-identical to master.

Note: ci/tests/ is slated for removal by #115650, which includes this file. This is the minimal
unblock until that lands.

Closes: #116154


Workflow [PR]
Sync PR [sync-upstream/pr/116107]

Version info

  • Merged into: 26.9.1.46 (included in 26.9 and later)

test_renaming_a_record_in_place_is_allowed asserted a green outcome from the
real check_settings_changes_history() with cwd at the repo root, so the gate
resolved the current version from the live cmake/autogenerated_versions.txt and
looked the reported name up in the live SettingsChangesHistory.cpp, while the
fixture pinned its record's block to the literal "26.8" and used the real record
s3_base. The 26.9 bump (4399d6c) turned "26.8" into an old block, so the
gate demanded a "26.9" block that master does not have yet, and the cell failed
on pristine master with zero PR code, reddening CI Tests for every PR. This was
the first release bump since the cell was added on 2026-08-05, which is why it
was never caught.

Run this one cell against a tmp_path cwd holding only the two files the gate
reads, both written by the fixture, so the version it declares and the version
the gate resolves are the same fixture-local constant. _run, _rename_patch's
signature and the other 11 cells are untouched.

Validated: 1 failed / 11 passed becomes 12 passed, and 12 passed with the
version file at 26.8, 26.9 and 26.10. Mutating the gate's current-block
membership test, and separately pinning its version resolution to "0.0", each
redden this cell; with the cell deselected the first mutation is undetected by
all 61 settings-history tests, so it is the only cell covering the gate's accept
path.

Co-Authored-By: Claude Fable 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Aug 24, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (click to expand)

Reviewed cold against the code on disk, then with a second model over the full diff. One major
and two nits; no blockers. Findings are answered with measurements, not prose.

# Finding Verdict
⚠️ The fixture does not prove membership is restricted to the resolved current-version block. Removing version == current_version (check_style.py:1215) leaves all 62 settings-history tests green, so the version filter itself is uncovered. Mechanism agreed, scope declined. See below.
💡 The block version appears as two literals that must agree (:251 block_version="26.8" and :259 the declared version). A single local would make the co-dependence structural. Noted, not changed. Drift between them fails loudly: the gate then finds no name in the declared current block, reports a violation, and the == "" assertion fires. No silent-pass risk.
💡 PR title was 83 characters. Shortened to match the commit subject.

On the major. The mechanism is real and I am not disputing it. Two reasons it is not fixed here.

It is pre-existing and unchanged by this PR, by monotonicity rather than by assertion. That
predicate can only ever exclude entries, so deleting it makes the current-block set a strict
superset. An acceptance assertion passes exactly when the reported name is in that set, and
membership is preserved under supersets. So no acceptance-shaped cell can detect the deletion, with
any fixture. Instantiated on the pre-fix cell against master at f889715f8002: s3_base is in the
filtered 26.8 block and in the union of all blocks, so the pre-fix cell passed in both arms too.
The seven rejecting cells are blind in the other direction for the mirror-image reason:
no_such_setting_at_all is absent from the union of every block, so they reject and pass either way.
The gap predates this change and this diff neither introduces nor widens it.

The proposed remedy is sound but barred. I simulated it: with the fixture's own history and a
declared 26.9, the filter's presence flips the outcome ({} and a violation, versus
{renamed_setting} and acceptance), so the extra arm would genuinely catch it. I am still not
adding it, because ci/tests/ is being deleted: #114675 merged at 0/-6543, #115650 is open at
9/-22695 and removes this exact file (+0/-245), and #115825 was approved with the whole body
"We don't use ci/tests, they will be removed." Adding coverage to a file two PRs are deleting is
the wrong direction; this change stays the minimal unblock and removes nothing.

I have not raised a follow-up task either: nothing has removed that filter, so there is no observed
consequence to point at, and the file is on its way out.

Session id: cron:clickhouse-review-slot-49:20260824-122000

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Aug 24, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, 100% (not a rate). python3 -m pytest ci/tests/test_settings_history_source_gate.py -q on pristine master f889715f8002 gives 1 failed, 11 passed with assert "These settin... '26.9' block" == ''. Positive control: reverting only VERSION_MINOR 9 to 8 gives 12 passed, so the bump is the sole cause.
b Root cause explained? Yes. The cell asserted a green outcome from the real check_settings_changes_history() with cwd at the repo root, so the gate resolved the current version from the live cmake/autogenerated_versions.txt (check_style.py:1192-1196) and looked the name up in the live SettingsChangesHistory.cpp (:1205-1216), while the fixture pinned its record's block to the literal 26.8 and used the real record s3_base. The 26.9 bump made 26.8 an old block, so the gate demanded a 26.9 block, which master does not have.
c Fix matches root cause? Yes. It removes the dependency on live repo content, which is the thing a bump changes, instead of re-pinning a literal. Both re-pinning (26.8 to 26.9) and deriving the version from the repo were measured and refuted: the first still fails since no 26.9 block exists, the second is unsatisfiable while the block is unopened. No assertion widened, no skip, no tag.
d Test intent preserved / new tests added? Preserved. The cell still asserts its property (a pure rename is accepted and the old name is not demanded) through the real gate and the real diff parser. No new test file, deliberately, since ci/tests/ is slated for removal by #115650.
e Both directions demonstrated? Yes. Without the fix: 1 failed, 11 passed with the '26.9' block text. With the fix: 12 passed, and 12 passed with the version file set to 26.8, 26.9 and 26.10.
f Fix is general across code paths? Yes, carrier set closed by enumeration and measurement. Of the 12 cells in the file, 9 assert on a name absent from every block so they are version-independent, and 5 return before the version read. test_settings_history_fetch_error.py:334-348 is the only other cell driving the real gate from the repo root and it takes the fail-close branch at :1180-1185, before the version read. All 12 cells pass at three different versions.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes on the axis that exists here, the version: swept 26.8 / 26.9 / 26.10, including the two-digit minor, which is the next real bump and a distinct parsing shape. Type wrappers, NULL and overflow are N/A, this is a pytest cell over two text files. The gate's MergeTree namespace is untouched and has no cell asserting a green outcome from live content.
h Backward compatible? (maintainer-approved exception only) N/A. No setting, no default, no serialization format, no user-visible behaviour, so no SettingsChangesHistory.cpp entry is required. That file is deliberately not touched.
i Invariants and contracts preserved? Yes. The gate's file is byte-identical to master, asserted after every mutation arm. The new helper upholds the gate's input precondition: it writes both files the gate reads, at the paths it reads them from, with the version file in the exact SET(VERSION_MAJOR n) / SET(VERSION_MINOR n) shape the two regexes require, so a mis-setup raises rather than silently passing. monkeypatch.chdir and setattr are auto-reverted at teardown, so no cwd or module-attribute leak reaches the other cells.

Liveness is measured, not assumed: mutating the gate's current-block membership test (if name not in current_block... to if True:) reddens this cell, as does pinning its version resolution to 0.0. With the cell deselected the first mutation is undetected by all 61 settings-history tests, so it is the only cell covering the gate's accept path.

Session id: cron:clickhouse-impl-slot-7:20260824-120400

@clickhouse-gh

clickhouse-gh Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [81699bd]

Summary: ✅


AI Review

Summary

This PR fixes a brittle source-gate test by running test_renaming_a_record_in_place_is_allowed against a fixture-local version file and history file instead of the checkout's live release version. The change still exercises the real check_settings_changes_history path and the real diff parser, removes the version-bump dependency that made the test red on pristine master, and I did not find a new correctness or coverage regression in the updated test.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 24, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @leshikus, could you review this? It is a one-file test fix: test_renaming_a_record_in_place_is_allowed asserted a green outcome from the real check_settings_changes_history() with cwd at the repo root, so the 26.9 bump made its hardcoded 26.8 block an old block and the cell now fails on pristine master, reddening CI Tests on every PR. It now runs against a tmp_path holding only the two files the gate reads.

@clickhouse-gh

clickhouse-gh Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 81699bd7b with master 762e8e123 (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 709.21 MiB 706.16 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

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

Job report

@zlareb1

zlareb1 commented Aug 24, 2026

Copy link
Copy Markdown
Member

Filed #116154 to track this breakage (13+ unrelated PRs are red on CI Tests / Mergeable Check since the bump). Consider adding Closes: https://github.com/ClickHouse/ClickHouse/issues/116154 to the description so it auto-closes on merge.

@zlareb1
zlareb1 requested a review from maxknv August 24, 2026 17:01
@groeneai

Copy link
Copy Markdown
Collaborator Author

Closes: https://github.com/ClickHouse/ClickHouse/issues/116154 is in the description (added at 17:01Z), so it will auto-close on merge.

One piece of context the issue does not have: ci/tests/ is slated for wholesale removal by #115650 (57 files under ci/tests/, -22,695 lines total, this exact file at -245), per the standing "We don't use ci/tests, they will be removed". That is why this PR keeps the fix fixture-local, running the one coupled cell against a tmp_path cwd holding only the two files the gate reads, rather than opening a 26.9 block in SettingsChangesHistory.cpp. Minimal unblock, nothing to unwind when #115650 lands.

Worth flagging so the auto-close is not misread as full recovery: this PR fixes only the CI Tests half. The Style check / settings_changes_history half is wider (28 distinct PRs in the last 24h vs 20 on CI Tests) and is not the same kind of defect. There the gate is working as designed: an author who opens the 26.9 block containing their own setting makes it pass, which is what its error text instructs. It stays red on settings-touching PRs until the first one does that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding manual approve Manual approve required to run CI 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.

CI Tests broken on master since 26.9 version bump: settings-history gate self-test pins version 26.8

4 participants