Skip to content

Fix the master-build lookup in bugfix validation after the S3 prefix change - #117433

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/bugfix-validation-master-build-prefix
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/bugfix-validation-master-build-prefix

Conversation

@groeneai

@groeneai groeneai commented Sep 1, 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):

Fix Bugfix validation failing to locate the reference master binaries in S3 after the artifact prefix gained a workflow-name segment.

Description

_Environment.get_s3_prefix_static gained a trailing /<normalized workflow name> segment
in #110081, so a master build artifact now lives at
REFs/master/<sha>/masterci/build_<type>/clickhouse. find_master_builds still
hand-spelled the old REFs/master/<sha>/build_<type>/clickhouse, so every curl -sfI probe
404s and the function returns None for the x86 and the ARM build-type set alike. Both
callers then abort on assert build_urls, "Could not find master builds in S3".

So all four per-arch Bugfix validation jobs fail before starting a server, and
Finish Workflow then fails its new_tests_check.py hook: every pull request carrying a
Bug Fix category is blocked on a required check while the bug it fixes is never measured.
CI DB shows 0 occurrences in the preceding 7 days, then onset at 2026-08-31 19:00 UTC rising
to 32 rows over 19 distinct pull requests by 23:00 UTC. The ~10h lag is master_commits
being a 50-entry (~12h) listing: failures began once the newest commit predating the change
aged out of it.

This takes the prefix from _Environment.get_s3_prefix_static, the same function the
uploader uses (ci/praktika/runner.py:925), instead of spelling it here a second time, so
this reader cannot drift from the writer again.

Validated credential-free against the links the uploader itself recorded in the MasterCI
report, not against a URL I built: on master tip all 8 relevant artifacts match the derived
prefix and 0 match the old one. Exercising find_master_builds with its two collaborators
stubbed and those recorded links as ground truth gives None before the change and the full
URL set after, on both arch sets, stable over 100 invocations, with an incomplete build set
still walked past. This PR is CI Fix or Improvement, so Bugfix validation is not
scheduled on it and I cannot self-validate in CI.

Related: #110081
Related: #117287

Other places that still hand-spell the old prefix (code read, not measured)

Same root cause, deliberately not in this PR, which restores a merge-gating check:

file:line producing workflow segment
performance_tests.py:1280, 1290, 1454-1455, 1510 masterci
parser_memory_check.py:73 masterci
llvm_coverage_job.py:608-612, 706-707, 752-756 pr, masterci
scripts/generate_diff_coverage_report.sh:32 masterci
scripts/release_packages.py:38, 162 releasebranchci
scripts/create_release.py:642, 732-775 releasebranchci
.github/workflows/retry_infra_failures.yml:118 pr
update_toolchain_dockerfile.py:36-37 optimizetoolchain
docker/binary-builder/Dockerfile:55, 72 optimizetoolchain, optimizeclickhouse

CI DB is silent for all of them, but for the two reference-build lookups in
performance_tests.py that silence is not evidence of health. find_prev_build walks
master_track_commits_sha, 50 first-parent master commits, a longer window than the
master_commits listing above, and the release binaries carry retention: long, so it is
still reaching pre-change commits. Once it stops, its None is swallowed by the fixed
.../master/<arch>/clickhouse fallback at performance_tests.py:1758-1774: the MasterCI
commit-to-commit baseline silently stops being the previous commit, which is the
self-comparison store_data.py:477-490 exists to prevent, and no failure row is produced.
find_base_release_build asserts instead. Neither performance job carries allow_failure.

The two Dockerfile sites are inert today: TOOLCHAIN_COMMIT is pinned to a pre-change
commit, and CLICKHOUSE_PROFILES_COMMIT=none never takes that branch. The
retry_infra_failures.yml one fails closed, so the retry silently never fires. Docs and
local helpers (ci/CLAUDE.md:12, utils/auto-bisect/helpers/download.sh) are stale too.


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

`find_master_builds` hand-spelled the S3 prefix of the reference master binaries
as `REFs/master/<sha>`. Praktika's uploader derives that prefix from
`_Environment.get_s3_prefix_static`, which gained a trailing
`/<normalized workflow name>` segment, so a master build artifact now lives at
`REFs/master/<sha>/masterci/build_<type>/clickhouse`.

Every `curl -sfI` probe therefore gets a 404, the `all` over the requested build
types never holds for any candidate commit, and the function returns `None` for
the x86 and the ARM build-type set alike. Both callers then abort on
`assert build_urls, "Could not find master builds in S3"`, so all four per-arch
`Bugfix validation` jobs fail before starting a server, and `Finish Workflow`
then fails its `new_tests_check.py` hook on every pull request that carries a
`Bug Fix` changelog category.

The onset lagged the prefix change by about ten hours because `master_commits`
holds a 50-entry listing, which is roughly a twelve-hour window: the failures
began once the newest commit predating the change aged out of it.

Take the prefix from `_Environment.get_s3_prefix_static` instead of spelling it
again here, so this reader cannot drift from the uploader that writes the
objects.

Co-Authored-By: Claude Opus 5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Sep 1, 2026
@groeneai

groeneai commented Sep 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 my own cold
review of the resulting tree (4 findings), bounded: 1 full pass + 1 fix round + 1 delta recheck.

# Sev Finding Verdict Evidence / action
1 ⚠️ The disclosure block offered the CI DB silence as its reason for leaving the sibling call sites alone. That is unsound for the two reference-build lookups in performance_tests.py:1280, 1290: they walk a 50-entry first-parent chain, a longer window than the master_commits listing, and the release binaries carry retention: long, so they are still reaching pre-change commits rather than being healthy AGREE, fixed in the description Rewritten to separate the sites that are inert from the ones that have simply not aged past the change, and to say what happens when they do: find_prev_build's None is swallowed by the fixed .../master/<arch>/clickhouse fallback at performance_tests.py:1758-1774, so the MasterCI commit-to-commit baseline silently stops being the previous commit, find_base_release_build asserts instead, and neither performance job sets allow_failure. Text only: no code change, no widening of scope
2 💡 Gate (i) rested on "splitlines cannot yield an empty element", which is false about Python: 'a\n\nb'.splitlines() is ['a', '', 'b'] AGREE, reworded The conclusion survives on the producer rather than the splitter: gh api ... -q '.[].sha' emits one non-empty token per array element, so an empty entry would need a blank line in its output. No guard added: an input that cannot occur does not earn defensive code, and .claude/CLAUDE.md asks for the error to propagate rather than for a fallback
3 💡 Deriving the prefix but hardcoding workflow_name="MasterCI" replaces one hand-spelled literal with another DISAGREE It is required, not a shortcut. The function has to name the workflow that produced the master artifacts, not the one currently running, which is PR; and store_data.py:467-470 records that synced private-repo runs read the public upstream namespace, so it must not follow the running repository either. check_ci.py:404-405, part of #117287, spells the same two literals for the same reason
4 💡 No test is added DISAGREE .claude/CLAUDE.md says a throwaway test for a CI-script change need not be committed, "because we don't have automated CI tests". Independently, ci/tests/ is referenced by no workflow and no job config, so a test placed there would never run

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Session id: cron:clickhouse-review-slot-11:20260901-004200

@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, 100/100. find_master_builds returns None on every invocation given the real master_commits shas and the artifact set the MasterCI report actually recorded, which is exactly what makes assert build_urls, "Could not find master builds in S3" fire. Not a rate. The job path itself is CI-only (info.is_local_run short-circuits it, and an anonymous curl -sfI gets 403 for either URL scheme), so the function is driven with its two collaborators stubbed: Info.get_kv_data returns real shas, Shell.check succeeds only for a bucket+key the uploader recorded.
b Root cause explained? Yes. _Environment.get_s3_prefix_static gained a trailing /<normalized workflow name> segment in #110081, and that prefix is what the artifact uploader uses at ci/praktika/runner.py:925, so a master build moved to REFs/master/<sha>/masterci/build_<type>/clickhouse. find_master_builds still spelled the old path, so every probe got a 404, the all never held for any candidate commit, and it returned None for the x86 and the ARM set alike. One prefix serves both architectures, which is why both arch sets failed together.
c Fix matches root cause? Yes. The prefix is derived from _Environment.get_s3_prefix_static, the function that writes the objects, so the duplicate spelling is removed rather than corrected. Explicitly not a band-aid: the assertion is untouched, no fallback path was added, and the reference binaries are genuinely present, so failing to find them was the defect.
d Test intent preserved / new tests added? No test is weakened or removed; nothing under tests/ is touched. No test file is added, and that is measured rather than skipped: the only pytest directory under ci/ is ci/tests/, which no CI job runs (no JobNames entry matches CI Tests across 46 entries, and .github/workflows/ has no ci/tests reference), so a test placed there would produce zero CI signal. .claude/CLAUDE.md also says so directly: a throwaway test for a CI-script change need not be committed, "because we don't have automated CI tests". The oracle used here is kept out of the tree.
e Both directions demonstrated? Yes, on one binary-free tree and against the producer's own recorded links rather than a URL I built. Before: None. After: the full URL set, each entry equal to the link the MasterCI report recorded. The old hand-spelled expression is kept as a negative control and still returns None after the change, so the oracle discriminates the two schemes instead of passing on anything. On master tip, 8 of 8 recorded artifacts match the derived prefix and 0 match the old one.
f Fix is general across code paths? Yes for this defect: find_master_builds has exactly two callers, ci/jobs/functional_tests.py:733 and ci/jobs/integration_test_job.py:1657, so one change covers all four per-arch jobs, functional and integration. 15 further places hand-spell the same old prefix; each is listed in the PR description as a code read with no measurement. None is changed here because this PR restores a merge-gating check, and the disclosure block says explicitly which of them are inert and which are merely not aged past the boundary yet, rather than reading the CI DB silence as health.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes. Both build-type sets pass (BUGFIX_BUILD_TYPES and BUGFIX_BUILD_TYPES_ARM, 4 each), and the "partial build set is skipped" contract in the docstring stays live: a commit whose four builds were all SKIPPED is probed and walked past rather than returned, which is the common case (14 of 48 commits after the boundary are in that state). The degenerate values of the one variable input, sha, are measured under (i).
h Backward compatible? Yes, nothing to be compatible with. No setting, no serialization format, no SettingsChangesHistory.cpp, no user-visible behavior. The changed string is a CI-internal S3 URL, and the change restores behavior that worked until the prefix moved.
i Invariants and contracts preserved? Yes. The newly called function carries three asserts, so its preconditions were measured against every value that can reach it: branch and workflow_name are constant truthy literals, and sha comes only from master_commits, whose sole producer is raw.splitlines() over gh api ... -q '.[].sha' at ci/jobs/scripts/workflow_hooks/store_data.py:474. A real call yields 50 entries and 0 malformed. splitlines does return an empty element for consecutive newlines, so the ground here is the producer, not the splitter: that jq filter emits one non-empty token per array element, so an empty entry would need a blank line in its output. When the gh call fails, Shell.get_output returns the error body, one truthy non-sha string, which passes the asserts and then 404s, so the function still returns None exactly as before. An empty raw gives [] and the loop body never runs. So no reachable input turns the previous graceful skip into an abort, and no guard is added for an input that cannot occur. The function is pure and holds no lock, so no concurrency contract is engaged.

Session id: cron:clickhouse-impl-slot-5:20260901-002400

@clickhouse-gh

clickhouse-gh Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0c5e7f0]

Summary: ✅


AI Review

Summary

This PR updates find_master_builds in ci/jobs/scripts/bugfix_validation.py to derive the master-artifact S3 prefix through _Environment.get_s3_prefix_static instead of spelling the pre-#110081 layout inline. I reviewed the current diff and surrounding callers, read the existing PR discussion, and verified against current public master artifacts that the derived .../masterci/... URLs resolve while the old REFs/master/<sha>/build_<type>/clickhouse URLs do not. I did not find a correctness, safety, or PR-metadata issue in the current change.

Final Verdict

✅ No blocking or major issues found in the current diff.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Sep 1, 2026
@groeneai

groeneai commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

cc @maxknv, could you review this? The workflow-name segment #110081 added to _Environment.get_s3_prefix_static moved the master build artifacts to REFs/master/<sha>/masterci/build_<type>/clickhouse, but find_master_builds still spelled the old path, so all four per-arch Bugfix validation jobs abort on Could not find master builds in S3 and Finish Workflow then reds every pull request with a Bug Fix category. The description also lists the other places that still hand-spell the old prefix, in case #117287 is worth extending.

@vitlibar

vitlibar commented Sep 2, 2026

Copy link
Copy Markdown
Member

@groeneai Check if this issue has been already fixed by #117580

@maxknv maxknv closed this Sep 2, 2026
@groeneai

groeneai commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

@vitlibar Yes, #117580 fixes it, so my #117433 is redundant.

Same defect and same function: #117580 inserts the normalized workflow segment into the master-build key that find_master_builds probes, which is the segment #110081 had added on the writer side in _Environment.get_s3_prefix_static.

Bugfix validation (functional tests, amd64/aarch64) job outcomes, split at the merge (2026-09-01 22:06:23Z):

  • 2026-08-31 19:31Z to 2026-09-01 22:06Z: 90 success, 247 error (72.2%), with zero successes for the eight consecutive hours 17:00Z to 00:00Z.
  • Since the merge: 334 success, 47 error (12.3%). Successes resume at 01:00Z, latest 2026-09-02 07:44:56Z.

All 47 remaining errors are that same assert, on 20 heads. Every head that has hit it since the merge (34 shas, counting the Finish Workflow post-hook rows) still carries the pre-fix ci/jobs/scripts/bugfix_validation.py in its own tree, and no head that carries the fix has hit it, so the tail clears as each pull request picks up master.

Two things #117580 leaves in place, if the sweep #117287 started is worth continuing: the key is still spelled at the call site rather than derived from _Environment.get_s3_prefix_static, the function the uploader itself uses, and the same prefix without the workflow segment is still read in ci/jobs/performance_tests.py:1292,1302, ci/jobs/parser_memory_check.py:73 and ci/jobs/update_toolchain_dockerfile.py:36-37.

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-own-pr PR origin: CI on a groeneai PR exposed a separate defect pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants