Skip to content

Praktika: take the changed files of a push from every commit it added, not only from its head - #128453

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-push-changed-files-walk
Nov 1, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:ci-push-changed-files-walk

Conversation

@groeneai

@groeneai groeneai commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #127365

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

Performance Comparison (amd_release, master_head, 5/6) on #127846 compared the PR build with the official build (long_primary_key +16%), because MasterCI skipped both performance reference builds at master c189bd99fb:

INFO: [Build (amd_release_performance_reference)] build inputs digest at master 1ee49128da7308cf86b6b769ba651cabf885b07d is c815e89709208b3f586b-9ebe92681def8a8c2cd8, not c815e89709208b3f586b-4b65b58d3b784f19826d as at master c189bd99fbda59c78489a6734c49397533bdd591
WARNING: no performance reference build, the reference is the official build

The merge queue fast-forwards master over up to 5 merges in one push, and MasterCI runs once, for the head. For a push, praktika took the changed files from the head commit only, so a job affected only by an earlier commit of the push was skipped as "Not affected by the changed files". The push 1ee49128..c189bd99 is #128277 (src/Common/StringValueFilter.cpp) and #128142 (tests only): 95 jobs were skipped this way, including both reference builds. At f760cbbb2d (#128371, an analyzer change, and #128365, .claude/ only) all 32 builds were skipped.

Now the changed files of a push are those of every commit from the head down to the event's before, reading all pages of each commit's file list. If they cannot all be read (a created branch, a failed read, a commit at GitHub's 3000-file listing limit), they are unknown and no job is filtered. Before, a failed read gave an empty list, which skipped every job that is not required.

Validation (local, real GitHub API), replaying the 404 batched master pushes of October: the files are the union of the pushed commits' files; 2 pushes containing a 3000-file commit (#126194 and the docs translation #124860) run everything. MasterCI would run about 15,800 more jobs, +7.8% of October's master job runs, including both reference builds on 106 pushes. 100 single-commit pushes give the same files, with one request for heads of up to 100 files.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.1045-master (included in 26.11 and later)

The merge queue fast-forwards master over up to 5 merges in one push and
MasterCI runs once, for the push head. For a push, praktika read the changed
files of the head commit only (`gh api commits/{sha}`), so a job affected
only by an earlier commit of the same push was filtered as "Not affected by
the changed files and not required", and functional/integration shards
skipped themselves as "Only test files changed". At master c189bd9 (ClickHouse#128277
in `src/` + ClickHouse#128142 tests only) this skipped 95 jobs, including both
`Build (*_release_performance_reference)`, so PR performance runs based on it
fell back to the official build (`long_primary_key` +16% on amd, ClickHouse#127846).
At f760cbb all 32 builds were skipped.

Now a push event records its `before` (`_Environment.PUSH_BEFORE_SHA`), and
`GH.get_changed_file_statuses` walks first parents from the head down to it,
reading all pages of each commit's file list (`gh api --paginate`), and
unions them (the newest commit's status wins). If the files cannot all be
known - an all-zero or malformed `before` (created branch), a failed or
malformed read, a commit at GitHub's 3000-file listing limit, a walk that
does not reach `before` within 50 commits - the result is `None` with a
warning, never a partial list, and it is not cached. `store_data.py` keeps
`None` for push events, so no job is filtered by it (`Job.is_affected_by`);
before, a failed read stored `[]`, which filtered every non-required job.
Without `before` (local runs, the native orchestrator) the head-only read
is unchanged; PR, merge queue, schedule and dispatch are unchanged.

Validated locally against the real GitHub API by replaying the 404 batched
master pushes of October: the result equals the union of every pushed
commit's files (re-parsed independently, commit lists from git) on 402, and
is unknown on the 2 that contain a 3000-file commit (ClickHouse#126194, and the docs
translation ClickHouse#124860); the job filter keeps 14,871 more job-runs on 131
pushes, plus 952 test shards that self-skipped now run in full, ~+7.8% of
October's 203,420 master job-runs, including both reference builds on 106
pushes. 100 single-commit pushes give identical statuses, with one request
for heads of up to 100 files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

groeneai commented Nov 1, 2026

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

Pre-publication review by an independent model (engine: codex; 0 findings), plus a separate cold review (3 nits, none blocking).

# Sev Finding Verdict Evidence / action
1 💡 command is built but unused on the push path of get_changed_file_statuses noted, not blocking harmless: the push path returns before the read loop
2 💡 a malformed before prints the wording of the created-branch case noted, not blocking both return None, so no job is filtered
3 💡 the union travels in the Config Workflow data output, which GitHub caps at 1 MB noted, not blocking every commit stays below 3000 files (else unknown); the largest October union was 560 files; PR runs already store up to 3000

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-self-slot-58:20261101-054700

@groeneai

groeneai commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Push 1ee49128..c189bd99 with the old gh.py: changed files = 2 test files, the MasterCI job filter skips 95 jobs incl. both Build (*_release_performance_reference), the same 95 as the real run. Same for 606b66f4..f760cbbb: 156 jobs, all builds.
b Root cause explained? For a push, praktika read only the head commit's files (gh api commits/{sha}), while the merge queue fast-forwards master over up to 5 merges per push and MasterCI runs once, for the head. Jobs affected only by an inner commit were filtered as "Not affected".
c Fix matches root cause? Yes. The definition of a push's changed files now covers every commit from the head down to the event's before; every consumer reads it, nothing downstream changes.
d Test intent preserved / new tests added? CI infrastructure change, so no in-repo test; validated locally by replaying all 404 batched master pushes of October against the real GitHub API.
e Both directions demonstrated? Yes. Old code: 95 / 156 jobs filtered at c189bd99 / f760cbbb. New code: 0 / 0.
f Fix is general across code paths? Yes. Job filter, docker image filter, should_skip_job, the runtime test-only shard skips and clang-tidy all read the same list. PR, merge queue, schedule, dispatch and local runs keep their code path, with identical results.
g Fix generalizes across inputs (params/datatypes/wrappers)? 1 to 5 commit pushes, 1 to 30 pages per commit, renames, created branch, malformed or off-chain before, failed and malformed reads; 2 pushes with a commit at GitHub's 3000-file limit become unknown and run everything.
h Backward compatible? (maintainer-approved exception only) Yes. No setting and no YAML change; the new environment field defaults to empty and old dumps load; single-commit pushes give the same files with the same request.
i Invariants and contracts preserved? Unknown changed files of a push stay None end to end (no job filtered), never a partial list, and are never cached; strict still raises; the non-push [] fallback is unchanged.

Session id: cron:clickhouse-impl-self-slot-57:20261101-051100

@groeneai

groeneai commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

cc @maxknv, could you review this and add the can be tested label so CI runs? For a push event praktika took the changed files from the head commit only, so when the merge queue fast-forwards master over several merges, jobs affected only by an inner merge were skipped (e.g. both performance reference builds at c189bd99fb); it now unions the files of every commit from the head down to the event's before, and treats them as unknown (no job filtered) when that walk cannot complete.

@clickhouse-gh

clickhouse-gh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9ad735a]

Summary: ✅


AI Review

Summary

The PR fixes job selection for batched pushes by collecting changed files across the first-parent push range and preserving unknown results so affected jobs are not silently skipped. No actionable findings at 9ad735a01ef81476556fe85155d9237025fe2722. Ten focused local checks passed, including replaying both reported pushes and exercising pagination, renames, incomplete reads, traversal limits, caching, environment compatibility, and conservative job filtering.

Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 1, 2026
@clickhouse-gh
clickhouse-gh Bot requested review from leshikus and maxknv November 1, 2026 06:08
@clickhouse-gh clickhouse-gh Bot added the comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). label Nov 1, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Nov 1, 2026
@alexey-milovidov alexey-milovidov self-assigned this Nov 1, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 1, 2026
Merged via the queue into ClickHouse:master with commit def2fdf Nov 1, 2026
529 of 531 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 1, 2026
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 comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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