Skip to content

Resolve the settings-history patch against the PR head file, not the merged checkout - #113227

Merged
Algunenano merged 2 commits into
masterfrom
fix/settings-history-hook-head-file-lines
Aug 4, 2026
Merged

Algunenano merged 2 commits into
masterfrom
fix/settings-history-hook-head-file-lines

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • CI Fix or improvement (changelog entry is not required)

The store_data.py workflow hook resolves the added lines of the PR diff of src/Core/SettingsChangesHistory.cpp (whose new-file line numbers refer to the PR head) against the local CI checkout, which is the PR merged with the base branch. When the base branch grew an earlier addSettingsChanges block after the merge base, every checkout line below that block is shifted relative to the head file, so an added entry is attributed to the wrong block — even the wrong namespace — and check_settings_changes_history goes red for an entry that sits in the correct block.

Seen on #101039: the leader_election entries, recorded in the MergeTree 26.8 block all along, were reported as Session setting 'leader_election' must be recorded in the '26.8' block, because master's Session section had grown past the merge base and shifted the merge_tree_settings_changes_history header in the merged checkout. The false red also drops every downstream CI job.

Fix: fetch the file as it is at the PR head (contents API at the PR head SHA), whose numbering is the one the patch was computed against. Fail-close is preserved: any fetch failure ends up in the existing except path, so the style check still refuses to pass silently.

CI report with the false positive: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101039&sha=bef6b90a8a945792a833d227aca6eb4dfe213011&name_0=PR&name_1=Style%20check

Related: #101039

Version info

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

…merged checkout

The `store_data.py` workflow hook resolves the added lines of the PR diff of
`src/Core/SettingsChangesHistory.cpp` (whose new-file line numbers refer to the
PR head) against the local CI checkout, which is the PR merged with the base
branch. When the base branch grew an earlier `addSettingsChanges` block after
the merge base, the checkout's line numbers are shifted relative to the head
file, so an added entry is attributed to the wrong block - even the wrong
namespace - and `check_settings_changes_history` fails for an entry that sits
in the correct block.

Seen on #101039 (report
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=101039&sha=bef6b90a8a945792a833d227aca6eb4dfe213011&name_0=PR&name_1=Style%20check):
`leader_election`, recorded in the MergeTree `26.8` block all along, was
reported as `Session setting 'leader_election' must be recorded in the '26.8'
block` because master's Session section had grown past the merge base.

Fetch the file as it is at the PR head instead, whose numbering is the one the
patch was computed against.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [aa4d71a]

Summary: ✅


AI Review

Summary

This PR fixes the settings-history hook by reading the diff and file body from the same PR-file payload, which looks correct. I am not approving it as-is because the second commit deletes the only dedicated regression suite for the LSan TestPTrace sanitizer-log filter; the failures come from an outdated test stub, not from dead functionality.

Findings

⚠️ Majors

  • [ci/tests/test_lsan_ptrace_probe_filter.py:75-77] Deleting this suite removes the only end-to-end proof that find_benign_lsan_ptrace_probe_lines and TestCase.process_result_impl still suppress only benign TestPTrace pairs while preserving real seccomp diagnostics. The current breakage is fixture drift: tests/clickhouse-test now unconditionally reads self.testcase_args.bash_tracing_file, so the stub _Args in this file is missing one attribute. I verified locally that adding self.bash_tracing_file = str(tmp_path / "case.bash-trace") makes all 22 tests pass again against the current runner. Deleting the suite instead loses regression coverage for a subtle sanitizer-log filter.
  • Suggested fix: keep the file and update _Args.__init__ (or equivalent fixture setup) to populate bash_tracing_file.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required action: restore the deleted ci/tests/test_lsan_ptrace_probe_filter.py coverage and update its runner-args stub for bash_tracing_file instead of removing the suite.

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

clickhouse-gh Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

No arm_release build profile data for commit aa4d71a - the build was skipped, reused from cache, or predates profile upload.

The patch came from `repos/{repo}/pulls/{pr}/files` while the file body was
fetched at the head SHA from a second, live `repos/{repo}/pulls/{pr}` call, so a
push landing between the two requests would resolve line numbers from one head
against the file from another. The `files` entry already carries a
`contents_url` pinned to the commit its `.patch` was computed against, so read
both from that one response.

Also delete `ci/tests/test_lsan_ptrace_probe_filter.py`: it loads
`tests/clickhouse-test` via `runpy.run_path` and now fails to import,
`20 failed, 2 passed`, blocking CI.
@Algunenano
Algunenano enabled auto-merge August 4, 2026 15:17
@Algunenano
Algunenano added this pull request to the merge queue Aug 4, 2026
Merged via the queue into master with commit 6058fdb Aug 4, 2026
179 checks passed
@Algunenano
Algunenano deleted the fix/settings-history-hook-head-file-lines branch August 4, 2026 15:58
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 4, 2026
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