Repository navigation
Generate the fuzzer dictionary from a release binary instead of committing it - #115307
alexey-milovidov merged 34 commits into
Conversation
…tting it Re-land of ClickHouse#111025, which was reverted wholesale in ClickHouse#113649 because the nightly libFuzzer job went red on defects introduced alongside it. The mechanism itself was never in question: a committed all.dict silently drifts from the real grammar, so the dictionary is now derived from the release binary's own registries at job time, with a source-derived fallback for build-time consumers and a curated old.dict for names that are composed at compile time. This commit restores the reverted tree verbatim. Two files drifted while the revert was in place, and the resolution keeps both sides of each: - ci/praktika/job.py. Master added run_on_upstream_failure and checkout_persist_credentials (with the __post_init__ assert tying the latter to enable_gh_auth); ClickHouse#111025 added set_digest_config, which this change uses. All three are kept. - ci/defs/job_configs.py. Master added unrelated job definitions, so the fuzzers-digest block is added to master's list rather than replacing it. The two defects that made the job red are fixed in the following commits. Related: ClickHouse#111025 Related: ClickHouse#113649
The check sorts both dictionaries with LC_ALL=C but ran comm under the job
container's LC_ALL=en_US.UTF-8. comm merges its inputs assuming they are sorted
the way it itself would sort them, and quoted multi-word keywords order
differently under the two collations ('"ADD INDEX"' sorts before '"ADD"' in C
and after it in en_US), so comm diagnosed its own C-sorted inputs as disordered
and exited 1. That sat inside a command substitution under set -e, so the script
died before the coverage verdict was ever evaluated: the nightly libFuzzer job
aborted with a bare CalledProcessError and produced zero test rows.
Two changes, both needed:
comm now runs with LC_ALL=C, matching the collation its inputs were sorted with,
and is wrapped in `if !` so a genuine comparison failure reports itself instead
of killing the script. A non-zero comm no longer means "no diff".
The two sorts now write files as plain commands rather than running inside
process substitutions. set -e does not observe a process substitution's exit
status, so an unreadable all.dict used to yield an empty diff and the check
reported success with the gate disarmed, while an unreadable source.dict
reported every token as missing.
The regression test extracts the check verbatim between the BEGIN/END markers
and runs it against synthetic dictionaries under a UTF-8 collating locale. It
covers the three outcomes the check must keep apart (covered, gap, comparison
broken), reproduces the original abort from the pre-change command, and pins
both process-substitution failure modes. The locale is chosen by measuring that
it actually inverts the token pair, so C.utf8 (a UTF-8 locale that collates by
byte value) cannot make the arms vacuous.
The libFuzzer job stages the release binary next to the fuzzer targets and
chmods it +x so update_dict.sh can generate all.dict from it. That directory is
then mounted at /fuzzers and becomes the runner's working directory, and
tests/fuzz/runner.py enumerates fuzzers as every executable file in it. The
binary matched, so the runner invoked
./clickhouse -artifact_prefix=<dir> corpus/clickhouse
which the server rejects with UNRECOGNIZED_ARGUMENTS. The nightly job reported a
`clickhouse` failure next to 20 passing *_fuzzer targets.
The binary is only executable because of that chmod: artifacts are downloaded
with `aws s3 cp`, a content copy that carries no POSIX mode, so a 755 source
lands as 644 under the job's umask, which is also why the *_fuzzer files are
chmod-ed explicitly. Nothing needs the binary executable after generation, so
restoring the mode it arrived with removes the trigger at its source rather than
teaching the runner to skip it, and leaves the directory in its pre-generation
state. The restore runs in a finally block, so a failed generation cannot leak
the bit into a later step either.
The regression test pins the whole 0644 -> 0755 -> 0644 cycle, since the binary
does have to be executable while the generator runs, and covers the failure
path. It imports generate_dictionary rather than reimplementing it, so it cannot
drift from the code.
tests/fuzz/runner.py is deliberately unchanged: it still treats the execute bit
as meaning "fuzzer target", which is a contract the producer is now respecting.
…ilding The .options files shipped to fuzzer consumers reference all.dict, which is no longer committed. Its fallback was generated by tests/fuzz/build.sh, wired only as a POST_BUILD step of the `fuzzers` aggregate target. OSS-Fuzz (google/oss-fuzz projects/clickhouse/build.sh) never reaches that target: it configures with -DENABLE_FUZZING=1, builds each fuzzer individually with `ninja -j N $FUZZER_TARGET`, and then copies the dictionary out of the source tree with `cp $SRC/ClickHouse/tests/fuzz/*.dict $OUT/`. That script runs under `#!/bin/bash -eu`, so the unmatched glob aborted the official OSS-Fuzz build rather than merely degrading a dictionary. Verified in the ninja graph: tests/fuzz/build.sh appears only on CMakeFiles/fuzzers.util, and `ninja -t deps select_parser_fuzzer` contains no reference to it. Generate the source-derived dictionary during the fuzzing configure step instead, into the source tree, where both a single-target build and the OSS-Fuzz copy find it. build.sh now copies whichever dictionary is current rather than generating a second one, so the nightly libFuzzer job's binary-derived all.dict (tests/fuzz/update_dict.sh) still wins. The generated file is ignored, so a fuzzing configure leaves the working tree clean. Related: ClickHouse#111025 Related: ClickHouse#113649
NightlyFuzzers needs the release binary to generate the fuzzer dictionary and
claimed to get it as a cache hit against the same commit built in MasterCI. The
claim was false, and the workflow paid a full ARM release build every night.
MasterCI takes JobConfigs.release_build_jobs_with_examples, which appends
--build-examples and CLICKHOUSE_EXAMPLES to the ARM release job; NightlyFuzzers
took the plain release_build_jobs. Both `command` and the `provides` artifact
configs are part of the job digest (ci/praktika/digest.py drops only requires,
enable_commit_status, allow_failure, force_success and digest_config), so the
two variants hashed differently. Measured: config digests 8383 for nightly
against ab29 for master.
Independently, CH_ARM_RELEASE is in BINARIES_WITH_LONG_RETENTION and MasterCI
tags it {"retention": "long"}, while NightlyFuzzers listed the binaries
untagged. The upload path is keyed by branch and commit, so a nightly upload
could replace MasterCI's long-retention object with a default-retention one --
and since the tags live in the artifact configs the digest hashes, the missing
tags also blocked the cache hit on their own.
Take the same job variant and apply the same tags, which makes the digests
equal (ab29 both sides) and the comment true. The tagging loop was already
duplicated between MasterCI and ReleaseBranchCI, so factor it into
with_long_retention_tags() next to the list it reads instead of adding a third
copy.
Related: ClickHouse#111025
Related: ClickHouse#113649
Two mechanisms this branch introduces enumerate their carriers incompletely. The CI Tests job digest gates whether ci/tests/ runs at all, so an input outside include_paths leaves its guard unable to run on the commit that breaks it. The OSS-Fuzz contract suite reads the root CMakeLists.txt, tests/fuzz/build.sh, tests/fuzz/generate_source_dict.sh, .gitignore, dictionaries/old.dict and the .options files; only update_dict.sh was listed. Measured with the job's own traverse_paths: deleting the generate_source_dict.sh block from the if (FUZZER) block, and making build.sh regenerate its own dictionary, both left the digest at 1f75cc3b895e -- so both would have taken a cache hit from an older green run. After the widening the same two mutations move it to 617e8249873f and cdaeacf833c3, while touching an unrelated src/ comment does not, and no commit in the last 300 master merges newly invalidates the job. with_long_retention_tags documents that every workflow uploading these binaries must apply the same tags, then tagged three of five. NightlyJepsen and NightlySQLancer are also branches=['master'], so they resolve to the same REFs/master/<sha>/<job> key and replaced MasterCI's long-retention object with a default-retention one; the tags also feed the job digest, so the two could not share MasterCI's build cache either (a7227e97 vs 1e39a9e7, 920dd7d8 vs 1d561c46). Both match after the change. Workflows under the PR and merge-queue key spaces cannot collide and are left alone. Each half gets a completeness arm, so a sixth carrier or a seventh suite input is caught rather than silently uncovered.
…ately Three statements the code did not hold. The codegen_fuzzer dependency glob claimed to be in sync with the trees generate_source_dict.sh scans, but matched only *.h and *.cpp while the generator greps those trees with no suffix filter. 28 of the 1804 files in the five trees were excluded, one of them real C++ (src/Functions/stl.hpp). Appending a registerAlias call to an excluded file moves the generator's output (md5 0f418b14 -> 50a7c55f) without invalidating codegen.dict, so a token could be added or removed and the dictionary would not rebuild. Globbing the trees whole makes the dependency set equal the scan set. The aggregate all.dict stays a configure-time product: OSS-Fuzz builds individual *_fuzzer targets and never reaches an aggregate build step. TestSuiteInputsAreInTheJobDigest enumerates the suite's direct reads, which reads as total coverage of the dictionary path. The generator's scanned trees are deliberately outside the CI Tests digest; the FATAL_ERROR in the root CMakeLists' if (FUZZER) block is what catches a failing generator, re-run by Build (arm_fuzzers) because its digest covers ./src. with_long_retention_tags said every workflow uploading these artifacts has to apply the same tags, which the PR's own test_every_colliding_workflow_tags_them excludes PULL_REQUEST and MERGE_QUEUE from: their uploads land in a different keyspace. Scoped to the workflows that can collide on the same object key. No compiled code changes. ci/tests: 750 passed, the 2 pre-existing test_max_failures_exit_code parallel-limit failures unchanged.
Internal second-model reviewAn independent review pass over this branch across several rounds: a cold read of the Fixed before publication❌ The re-land broke the official OSS-Fuzz build.
Raised and rejected, with evidence
💡 Three notes recorded and deliberately not raised as defects: |
Pre-PR validation gate (click to expand)Four defects. A = coverage check aborts under a UTF-8 locale.
Residual, disclosed and unchanged: Session id: cron:clickhouse-impl-slot-6:20260817-220002 |
|
Workflow [PR], commit [e17fa86] Summary: ✅
AI ReviewSummaryThis PR replaces the committed fuzzer dictionaries with generation from a release binary, adds a source-derived fallback for build-time/direct consumers, and rewires Missing context / blind spots
Findings
Final VerdictLLVM Coverage ReportMeasured on commit e17fa86.
Changed lines: Uncovered code analysis did not run: No coverable C/C++ source files changed (contrib/ is excluded from coverage). Newly covered: +171 lines in 50 files (-104 lines lost coverage) · Details |
| # before any target is built. The nightly libFuzzer job overwrites it with | ||
| # the authoritative binary-derived one (tests/fuzz/update_dict.sh). | ||
| execute_process( | ||
| COMMAND "${CMAKE_SOURCE_DIR}/tests/fuzz/generate_source_dict.sh" "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests/fuzz/all.dict" |
There was a problem hiding this comment.
This writes all.dict into ${CMAKE_SOURCE_DIR} during configure, so -DFUZZER=1 now requires a writable checkout. That regresses hermetic / read-only out-of-source fuzzing builds: configure fails before any target is built even though the file is only consumed later by packaging/copy steps. Can we keep the generated dictionary under ${CMAKE_BINARY_DIR} and only stage it into the source-tree location in the specific OSS-Fuzz path that still expects tests/fuzz/*.dict?
There was a problem hiding this comment.
🕵 The mechanism is right - configure writes ${CMAKE_SOURCE_DIR}/tests/fuzz/all.dict, and on a read-only checkout -DFUZZER=1 fails there. I am not moving it, and the reason is what the one consumer that needs the source-tree location actually does. Measured against google/oss-fuzz projects/clickhouse/build.sh as it stands today:
- It reads the dictionary only from the source tree:
cp $SRC/ClickHouse/tests/fuzz/*.dict $OUT/, under#!/bin/bash -eu. A dictionary that lives only under${CMAKE_BINARY_DIR}leaves that glob unmatched, so the official build aborts at the copy rather than shipping a worse dictionary. That is the failure direction this file's comment is about. - There is no in-tree signal that says "this is the OSS-Fuzz path" at configure time. It configures with
-DENABLE_FUZZING=1, exactly what our ownBuild (amd_fuzzers)passes (ci/jobs/build_clickhouse.py). The only flag unique to it is-DLIB_FUZZING_ENGINE:STRING=$LIB_FUZZING_ENGINE, which nothing in ClickHouse's CMake reads -grepoverCMakeLists.txtandcmake/outsidecontribreturns nothing. Gating the staging on a variable the tree otherwise ignores means the official build silently loses its dictionary the day OSS-Fuzz stops passing it, and we do not run that build, so we would not see it. - The hermetic premise does not survive contact with that same consumer either. Before it configures anything it runs
sed -itwice over$SRC/ClickHouse/CMakeLists.txt, thenmkdir -p $SRC/ClickHouse/tests/fuzz/*_fuzzer.in/and copiestests/queries/0_stateless/*.sqlandtests/queries/1_stateful/*.sqlinto the source tree. A read-only checkout cannot run that path no matter where the dictionary is generated.
Making the dictionary a per-target build edge instead is the other direction, and it is the shape #111025 was reverted for: OSS-Fuzz builds targets individually with ninja -j N $FUZZER_TARGET, so a step hanging off the fuzzers aggregate target is never reached. TestConfigureTimeGeneration in ci/tests/test_fuzzer_dict_ossfuzz_contract.py pins that, with mutation arms.
What is left over is the case your finding names minus the OSS-Fuzz path: a local -DFUZZER=1 configure against a checkout that is genuinely read-only. That one is real and unaddressed, and I have added it to the Residuals paragraph of the description rather than leaving it implicit here.
Three of the added assertions could stay green while the wiring they describe regressed. Each is replaced by the property it was standing in for, and each mutation was confirmed to redden. build.sh: asserting it does not mention generate_source_dict.sh still allowed regenerating the dictionary via update_dict.sh or an inlined query, which overwrites the binary-derived dictionary before the artifact is consumed. Assert instead that the only line naming a dictionary or a generator is the copy into $OUT, with a mutation arm per regeneration route. Build (arm_fuzzers): nothing covered the widened digest, so dropping ./tests/fuzz/ and ./tests/queries/0_stateless/ from that job left every test green while a dictionary or corpus change could cache-hit a stale ARM_FUZZERS artifact. Assert the include paths, that the shared build digest does not already carry them (otherwise the assertion is vacuous), that with_git_submodules survives the digest replacement, and that only the fuzzers build is widened. libFuzzer tests: the shared-build coverage was producer-side only. Assert the consumer edge too - the job requires CH_ARM_RELEASE, the workflow provides everything the job requires, and the dictionary inputs are in the consumer digest. Mutation arms verified: build.sh regenerating via update_dict.sh or an inlined write, the arm_fuzzers widening removed, with_git_submodules dropped, CH_ARM_RELEASE removed from requires, and update_dict.sh removed from the consumer digest. All six redden; the intact tree passes 50 of 50 in these modules.
The build-sharing assertion compared the imported workflow objects, but praktika hashes the mangled ones. Mangle appends the injected docker job names to every job's run_after, and run_after is part of the job digest, so the comparison could not see a difference that decides the real cache key. It was hiding one. MasterCI sets enable_dockers_manifest_merge, so its graph gains a multiplatform manifest job; NightlyFuzzers' did not. Measured post-mangle config digests for Build (arm_release): 6efd for MasterCI against b765 for NightlyFuzzers, with run_after the only differing field. So the release build was still rebuilt from scratch every night despite the job variant and artifact tags already agreeing. Enable the same manifest merge on NightlyFuzzers, which makes the two graphs and the digests identical, and compare post-mangle so the assertion tracks the key praktika actually computes. A negative control asserts run_after is populated and that the two graphs agree, since an empty run_after would make the pre- and post-mangle comparisons indistinguishable. Verified by removing the alignment again: the post-mangle assertion fails, while the previous pre-mangle comparison passes on that same tree (ab29 both sides), which is what it was blind to.
Two more assertions could not see the shape they described. The POST_BUILD guard filtered the if (FUZZER) block to lines containing the generator name, then checked those lines for add_custom_command and POST_BUILD. In a normal multi-line add_custom_command those tokens are on a different line from the generator, so they were never in the strings being checked. Measured: adding a POST_BUILD regeneration of all.dict beside the configure-time one left all 22 tests green. Parse whole parenthesis-balanced statements instead, require exactly one generator invocation and that it is the execute_process, with mutation arms for the single- and multi-line aggregate-target forms. Aligning the docker graph for the cache also made the injected manifest job cache-identical to MasterCI's while the two workflows disagreed on set_latest_for_docker_merged_manifest, which the job digest does not cover. Measured identical manifest config digests (659a) with set_latest True for MasterCI and False here, so whichever ran first would decide whether the `latest` manifests are published. Set the flag to match and pin the invariant over the workflows that share the job. Both fixes verified by reverting them: the statement parser reddens on the POST_BUILD mutation the line filter passed, and the manifest guard reddens on the flag mutation.
The generator runs from configure and needs mapfile and GNU grep -z. Stock macOS provides neither, and the failure mode was silent: the extraction just yields fewer tokens, which is not a configure error and would surface much later as the nightly coverage check. Resolve bash through PATH instead of pinning /bin/bash, which is 3.2 on macOS and shadows an installed newer bash, and check both prerequisites before their first use so an unsupported environment says which tool is missing. Output-neutral: the generated dictionary is byte-identical before and after (md5 0f418b14408c9809dda69b0595d4dc19, 6384 lines). Verified by substituting a grep that rejects -z, which now aborts with the GNU grep message and writes no output file, and by exercising the version comparison at majors 3, 4 and 5. shellcheck -S warning is clean. Also drop the exact new-test count from the description, which went stale as rounds were added.
|
All four findings verified by mutation rather than by reading, and all four were right. Head 1. 2. 3. consumer edge unasserted - agreed. Dropping 4. configure-time write into What finding 4 did surface is a real portability gap one level down, now fixed: the generator needs Two further defects of the same class as 1-3, found while verifying them:
On the aggregate-target guard you did not flag: it filtered the The CI graph did change here, so a
|
Aligning NightlyFuzzers' docker graph with MasterCI's set enable_dockers_manifest_merge on the workflow definition, which adds a "Dockers Build (multiplatform manifest)" job and puts it in the run_after of every job downstream of the docker builds. The generated YAML was not regenerated in that commit, so the committed file still described the old graph and the Config Workflow check reported it as outdated. Regenerated with 'PYTHONPATH=.:./ci python3 -m praktika yaml'. Only nightly_fuzzers.yml changes: the other workflow definitions this branch touches were refactored to build their long-retention artifact list through a helper, and artifact retention tags are not represented in the generated YAML, so those files come out byte-identical.
The generated codegen.dict is derived by grepping source trees with no suffix filter, so every file under a scanned tree is an input. Nothing asserted that the CMake dependency set for the codegen.dict command still equals that scan set, so narrowing the glob back to *.h / *.cpp left the whole ci/tests suite green while src/Functions/stl.hpp - a real carrier of an extracted name - stopped triggering a regeneration, leaving codegen_select_fuzzer with a stale grammar after an incremental build. Compare the two sets as resolved file paths rather than as pattern lists, since the lists can agree while their expansions do not. Six arms narrow one side and require the disagreement to be seen: the glob reverted to suffixes, a scanned tree dropped, the individually listed files dropped, a scan root added only to the generator, a suffix filter added to the generator, and the digest entry removed. A further pair runs the generator against a copy of the trees and measures that a name added to that carrier reaches the dictionary, with a control arm that must not carry it. The resolution expands the globs in Python because cmake is not installed in the CI Tests image; where cmake is available it is pinned against cmake itself, on the intact list and on a narrowed one. CI Tests is cache-gated, and the codegen CMakeLists was outside its digest, so a commit that only narrowed the dependency list would have taken a cache hit and never run these assertions. Add it to the include paths.
Comparing the dependency set against the generator's scan set says nothing
about whether any command consumes the variable. All of those assertions hold
with ${CODEGEN_DICT_SCANNED_SOURCES} absent from the codegen.dict command's
DEPENDS, with the generator script absent from it, or with codegen.dict absent
from the clickhouse.g command's DEPENDS - each of which leaves an edited carrier
regenerating nothing.
Parse the add_custom_command statements per argument section, so OUTPUT is not
read as far as COMMAND, and assert every edge of the chain from the scanned
sources through codegen.dict and clickhouse.g to the generated source, plus that
the grammar is built from the generated dictionary rather than the
binary-derived all.dict that does not exist at build time. Each edge carries an
arm that removes it and requires the assertion to fail.
The check that the reads outside the scanned trees are dependencies now reads
the DEPENDS section rather than the whole statement: naming a file in COMMAND
does not make a change to it trigger a rebuild.
…puts A custom command only reruns for a file named in its DEPENDS, so editing update.sh or clickhouse-template.g left clickhouse.g as it was, and editing gen.py left out.cpp and out.proto stale. Reproduced on a two-arm project: the command whose DEPENDS omits its generator keeps the output from the previous build, while the one naming it regenerates. The three scripts are configure_file'd into the binary directory and the commands run there, so DEPENDS names the copies, which is what the build compares timestamps against. Verified on the same shape end to end: a gen.py edit regenerates out.cpp, an update.sh edit regenerates clickhouse.g and then out.cpp. Each edge carries an arm that removes it, plus one that points a dependency at the source path instead of the copy.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline. |
|
Agreed, measured rather than read: reverting Added Two things this led to that were not in the finding:
The same question asked of the rest of the chain found a defect predating this PR: 88 tests pass. Head is |
|
Two things the master merge in 4c737a6 surfaced that are yours to decide, both independent of the generator fix I just pushed. The five suites this PR adds no longer have an executor.
I have not squashed, and will not: the branch carries five of your commits including the head, so a squash would mean force-pushing over them. |
Conflicts: - `tests/fuzz/all.dict`, `tests/fuzz/dictionaries/functions.dict`, `tests/fuzz/dictionaries/keywords.dict`: master updated the committed dictionaries while this branch deletes them (they are now generated from a release binary). Kept the deletions. - `.github/workflows/nightly_fuzzers.yml`: master moved `finish_workflow` to the `arm-tiny` runner label while this branch widened its `needs` with `build_arm_release` and `dockers_build_multiplatform_manifest`. Kept both; `python3 -m ci.praktika yaml` reproduces the result with no diff.
|
🕵 Refreshed against master (head Conflicts resolved:
Verified locally on the merged tree:
The AI Review Major about empty-match handling in |
| @@ -0,0 +1,425 @@ | |||
| """ | |||
There was a problem hiding this comment.
These new regression suites currently have no executor in the tree they are being merged into.
A repo-wide search across .github/workflows, ci/defs, and ci/workflows finds no job that still runs ci/tests/test_fuzzer_dict_* or ci/tests/test_nightly_fuzzers_build_sharing.py after the CI Tests job removal, so the PR's “fixed and covered” contract has no CI evidence behind it on current HEAD. Because these tests are the only proof for the cache/dictionary wiring, future regressions will pass CI unless they happen to break some other surface accidentally.
Please either wire these suites into an executed workflow again, or move the assertions into a test surface that CI already runs.
There was a problem hiding this comment.
The fact is right, and it is the same one I recorded on this PR on 2026-08-30: nothing has run these suites since 8ff3720644b2 removed the CI Tests job together with ci/tests. That round also dropped the two suites whose subject had genuinely disappeared.
Neither remedy is mine to choose. Wiring an executor back in reinstates the surface that removal deleted, and 5e8bf203b1409d2 ("Remove ci/tests (attempt 3)") states the standard for the other direction: nothing runs it, so it is dead code, and removing it finishes the removal rather than re-opening the decision. There is also no surface to move the assertions to: the style job runs mypy, pylint and ruff, master schedules no Python test job at all, and the ci/tests/test_e2e.py restored to master yesterday has no executor either.
So keeping them as a locally runnable harness or deleting them is a maintainer decision, and I have not pre-empted it. What I did fix this round is a real weakness in the new arms: they asserted the decision functions rather than the production call path, so restoring either static call would have left them green.
There was a problem hiding this comment.
🕵 Adopting the third remedy of the three you list, since it is the only one that is mine to make: the PR body no longer claims these suites as standing coverage. It now states plainly that nothing in CI has executed them since 8ff3720644b2 removed the CI Tests job together with ci/tests, gives the command that runs them locally, and records the result (94 passed on the current head). Reinstating an executor or deleting the suites both remain maintainer decisions, and there is still no already-executed Python test surface on master to move the assertions to — the style job runs mypy, pylint and ruff, and the ci/tests/test_e2e.py restored to master has no executor either.
Also in this round, the two TestLatestTagIsBaseBranchOnly wiring arms added last time were aborting before they reached Docker.merge_manifest: _build_dockers refuses to run when platform.processor cannot name the host CPU, and that value is uname -p, which is unknown on some hosts. The architecture is not their subject, so it is now pinned rather than read from the host, and the arms are verified load-bearing — restoring the static workflow.set_latest_for_docker_merged_manifest at the call site still reddens test_the_merge_gets_no_tag_on_another_branch.
`Dockers Build (multiplatform manifest)` passed `Workflow.set_latest_for_docker_merged_manifest` straight into `Docker.merge_manifest`, which turns it into `docker buildx imagetools create --tag <image>:latest`, with no branch or event guard. Two workflows set the flag: MasterCI, which only runs on `master`, and NightlyFuzzers, whose generated workflow also exposes `workflow_dispatch` and is therefore dispatchable on any ref. A manifest-job cache miss during a branch dispatch would retag every merged image `latest` from that branch. Turning the flag off for NightlyFuzzers is not the fix. The manifest job's digest does not cover the flag, so the two workflows share its cache entry, and a disagreement there would make master's `latest` tagging depend on which workflow filled the entry first. Gate the tag on the branch the run is on instead. Both flag holders declare `branches=[BASE_BRANCH]`, so scheduled and push runs keep tagging `latest` and only an off-base dispatch loses the retag. Reported by the AI reviewer in ClickHouse#115307 (comment) Co-Authored-By: Claude Opus 5 <[email protected]>
`libfuzzer_test_check.py` also backs `libFuzzer corpus minimization`, which `WeeklyFuzzersCorpus` runs with `--minimize-only`. `main` called `generate_dictionary` before branching on that flag, and the generator asserts the release binary is staged next to the fuzzer targets. That job requires only `ARM_FUZZERS` and `FUZZERS_CORPUS`, and its workflow provides no release build at all, so every weekly run would have failed with "ClickHouse release binary not found" before reaching the runner. Nothing is lost by skipping it: `tests/fuzz/runner.py` builds the merge command from `allowed_merge_libfuzzer_options`, which has no `dict` entry, and returns before the fuzzing block that would add `-dict=`. Measured on the guard: with `--minimize-only` the run now reaches the runner, without the guard it raises the assert, and a run without the flag still generates the dictionary. The added test pins the config half of the pairing, which is what makes the requirement unsatisfiable rather than merely absent. Co-Authored-By: Claude Opus 5 <[email protected]>
Review of the previous two commits found that each guard was pinned by asserting the decision, never the value the production call site passes on. Restoring the static workflow flag in `_build_dockers`, or the unconditional `generate_dictionary` call, left every assertion green. Both arms now drive the real code path: `_build_dockers` with `Docker.merge_manifest` captured, and `main` up to the runner invocation with generation counted. Each has the opposite arm as its control, and each of the two mutations above reddens exactly one of them. Also corrects the mechanism named in the mode docstring: praktika downloads artifacts through the boto3 client, not `aws s3 cp`. The conclusion is unchanged, since S3 carries object content and no POSIX mode either way. Co-Authored-By: Claude Opus 5 <[email protected]>
Round 6Two AI-reviewer findings, and one blocker my own review of the first fix turned up.
This PR broke the weekly corpus-minimization job ( Guard wiring ( Two findings I agree with and deliberately did not act on:
Five fuzzer suites pass locally (95 cases), ruff is clean, and The merge precondition is unchanged and I have not re-pinged for it. |
CI finish ledger -
|
| Check / test | Reason | Owner / fixing PR |
|---|---|---|
Docs examples / Documentation examples, Function/toYYYYMM#0 |
the example in src/Functions/toYYYYMM.cpp documents SELECT toYYYYMM(now(), 'US/Eastern') as 202608, so it began returning 202609 when the month rolled over in that zone at 2026-09-01 04:00 UTC. Time triggered and trunk-wide: 47 rows over 46 unrelated PRs since that boundary, against 0 rows in the preceding 10 days |
#117459 (mine, open) |
Integration tests (amd_asan_ubsan, db disk, old analyzer, 6/6) / Container memory budget exceeded (/docker) |
job-level container-memory abort with no failing test assertion: the shard's nested containers breach the /docker cgroup leaf. 633 rows over 301 unrelated PRs in the last 24h. #117202 is already an ancestor of this head (compare returns status=ahead, behind_by=0) and the shard failed anyway, so it is not the owner |
#117411 / #117412 (both open) |
This branch changes ci/, so I checked causation rather than assuming: the diff touches no integration
test job or config file and no memory, cgroup or /docker budget knob, and the toYYYYMM example is
outside it entirely.
Session id: cron:our-pr-ci-monitor:20260901-083000
…zer-dict-from-binary # Conflicts: # ci/defs/job_configs.py # ci/jobs/libfuzzer_test_check.py # ci/workflows/master.py # ci/workflows/release_branches.py
`_build_dockers` refuses to run when `platform.processor` cannot name the host CPU, and that value is `uname -p`, which is `unknown` on some hosts. Both `TestLatestTagIsBaseBranchOnly` wiring arms therefore aborted before reaching `Docker.merge_manifest`, so they could not observe the `add_latest` argument they exist to pin. The architecture is not their subject, so it is pinned rather than read from the host. Verified load-bearing: restoring the static `workflow.set_latest_for_docker_merged_manifest` at the call site still fails `test_the_merge_gets_no_tag_on_another_branch`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`_publish_latest_docker_manifest` confines publication of the mutable `latest` docker alias to the workflow's own branch, but a workflow that declares no branches fell back to publishing. Moving a public mutable tag is a consequential action, so the undecidable case now refuses instead. Every workflow that tags `latest` declares a branch on both the public and the private side today (`MasterCI` and `NightlyFuzzers`, both `master`), so this changes no live behaviour; the arm that pins that invariant is kept as well, because a silent never-publish would be as wrong as a silent publish. Verified load-bearing: restoring the `return True` fallback reddens `test_a_workflow_without_branches_refuses_to_publish`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…zer-dict-from-binary Master moved the fuzzers build and the libFuzzer jobs from arm to amd, which this branch's additions were keyed to. The dictionary is generated by running the release binary, so it must be the binary for the arch the job runs on: the extra requirement becomes `CH_AMD_RELEASE` and the workflow provides `amd_release`. Two of those re-keyings are in hunks that merged cleanly and would have gone wrong silently - the `special_build_jobs` digest hook still tested `BuildTypes.ARM_FUZZERS` (so it would never have applied), and `ci/workflows/nightly_fuzzers.py` still selected the arm release build while the job required the amd artifact. `praktika yaml` refuses to generate in the latter case, which is how it surfaced. `.github/workflows/nightly_fuzzers.yml` is generated, so it is regenerated with `python3 -m ci.praktika yaml` rather than hand-merged; it is the only generated workflow the regeneration changes.
ClickHouse#105118 moved the libFuzzer job to amd64 and the master merge brought it here: the fuzzers build is `BuildTypes.AMD_FUZZERS`, NightlyFuzzers selects `Build (amd_release)`, and the consumer edge is `CH_AMD_RELEASE`. Two modules still named the arm jobs, so on this head one class raised `AttributeError` before asserting anything and the build-sharing module could not find the job whose digest it compares: 11 of the 96 arms were red and the invariants they stand for were not exercised at all. The examples wiring is appended to the arm release job only, so the two arms that described the shared build in those terms lost their subject. They are replaced by what the sharing rests on instead: that the wiring does not reach the amd job, so both release job lists agree on it, and that every artifact the shared build provides is declared by the workflow. `test_an_untagged_upload_would_not_match` was also passing for an incidental reason. It compared a hand-built workflow holding the shared `ArtifactConfigs` singletons against MasterCI's import-time copies, and mangle stamps `_provided_by` onto the singletons, so the two digests differed whether the long-retention tags were there or not. It now derives both sides from this workflow's own artifact configs and flips only the tagging, which reddens in an isolated and in a full-module run when the tags are equalized.
The claim it rested on does not hold. Praktika uploads under `REFs/<branch>/<sha>/<workflow>/<job>` (`_environment.py` `get_s3_prefix_static` and `runner.py`, on master since `633ec9e571ae8`), so two workflows uploading the same artifact name for one commit cannot overwrite each other, and NightlyJepsen and NightlySQLancer could never downgrade MasterCI's retention. The digest half of the rule does not reach them either: their post-mangle build configs are cache-incompatible with MasterCI's, because their docker graph carries no manifest job. What remains there is a retention policy decision about two workflows this PR is not about, so it is reverted and the helper docstring states the invariant that does hold. NightlyFuzzers keeps the tags. It does share MasterCI's release build, and the digest is measurably sensitive to them: dropping the helper there reddens `test_digest_matches_master`. The census arm that enumerated every non-PR workflow for the same collision goes with the claim. The parametrized arm keeps the three call sites that apply the helper.
| return False | ||
| if not workflow.branches: | ||
| return False | ||
| return branch in workflow.branches |
There was a problem hiding this comment.
Workflow.Config.branches is documented and already used as "branch names or patterns" (see ci/praktika/workflow.py and the shared matcher in ci/praktika/orchestrator/__init__.py). This helper narrows that contract to literal list membership, so the first workflow that enables set_latest_for_docker_merged_manifest on a patterned branch set will silently never publish latest even when the branch should match.
Please reuse the same exact-or-regex branch matcher here instead of branch in workflow.branches, so latest tagging follows the same branch semantics as workflow selection.
There was a problem hiding this comment.
Confirmed, and patterns are live rather than hypothetical: ReleaseBranchCI declares branches = ["2[1-9].[1-9][0-9]", "2[1-9].[1-9]"] (ci/workflows/release_branches.py:26), and yaml_generator.py:481 emits those strings verbatim into on: push: branches:. So the field does carry patterns and this helper accepts only literal names.
I am not reusing _branch_matches here, because it is not the semantics that selects any workflow able to carry this flag, and the divergence runs the dangerous way. Measured on this head:
find_workflows_for_eventskipsWorkflow.Engine.GH_ACTIONS(orchestrator/__init__.py:62), and every push or pull_request workflow in the tree is GHActions (MasterCI,ReleaseBranchCI,PR,BackportPR); the only non-GHActions workflow isCreateReleaseBranch, a dispatch withbranches = []._branch_matchestherefore cannot fire onbranchestoday: what selects those four is GitHub's evaluation of the generated yaml, whose filter patterns are globs, notre.fullmatch.- The two readings disagree in both directions on real inputs.
re.fullmatch("2[1-9].[1-9][0-9]", "26x10")matches, because the dot is a metacharacter, and the glob does not; so the swap would let a run movelatestfrom a branch the workflow is not configured for. Converselyfeature/*and26.?match as globs and failre.fullmatch. re.fullmatch("releases/**", "releases/26.3")raisesre.error: multiple repeat, so a branch set written in GitHub's own syntax would fail the manifest job rather than skip the tag.
For a shared mutable alias, publishing too eagerly is the harmful direction, which is why the undecidable case refuses. A faithful pattern-aware form has to follow whichever engine selects the workflow, and branches is documented "for push trigger only" while NightlyFuzzers is a schedule workflow, so for its ref there is no selection semantics to inherit at all. That is a praktika-wide decision about what the field means, and _branch_matches is where both paths should converge if you want it; it needs glob-shaped entries handled before it can claim the documented contract.
Worth knowing if pattern support does land: test_the_declared_branches_still_publish feeds each entry of workflow.branches in as the branch, so on a patterned entry it would assert only that the pattern text round-trips and would stay green while real runs published nothing. Not vacuous today, since both flag-carrying workflows declare the literal master, but it has to change with the semantics. I have recorded the narrowing as a declined residual in the PR body.
…zer-dict-from-binary
|
🕵 Refreshed against master (head Verified on the merged tree:
The only red on the previous head was The remaining AI-review Major on The merge condition in the description is unchanged: this still needs one human-dispatched green |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Do not merge this until NightlyFuzzers is green on this branch. Dispatching it needs
admin rights, so I am asking for a manual run first.
Re-land of #111025, reverted in #113649 after the nightly
libFuzzer testsjob went red fora week. The mechanism is unchanged: the dictionary comes from the release binary's own
registries instead of a committed snapshot that drifts. Four defects are fixed; the first two
made the job red, the rest are collateral damage from dropping
all.dict.communderen_US.UTF-8onLC_ALL=C-sorted input, so itexited 1 and
set -ekilled the script.runner.pyran it as one.
all.dictfallback came only from aPOST_BUILDstep of thefuzzerstarget,which OSS-Fuzz never reaches, so
cp tests/fuzz/*.dictaborted underbash -eu.untagged and injected a different docker graph, so the digests differed and it rebuilt the
binary nightly. The shared build is the AMD one since CI: move libFuzzer test to amd64 #105118 moved the job.
Against a real binary,
update_dict.shaborts under a UTF-8 locale before the fix and succeedsafter.
ci/testscovers the four fixes and the dependency and digest invariants, each with amutation arm (
PYTHONPATH=./ci:. pytest ci/tests/test_fuzzer_dict_*.py ci/tests/test_nightly_fuzzers_build_sharing.py, 93 tests, 92 pass here;test_unpinned_comm_abortsneeds a host whose default collation makescommrejectLC_ALL=C-sorted input, which this worker'sen_US.utf8does not). Since8ff3720644b2removed theCI Testsjob withci/tests, nothing in CI runs them, so they are a local harness ratherthan a standing guard.
Residuals.
runner.pystill infers "fuzzer target" from the execute bit, and the fallback isgenerated at configure time, so a scanned-carrier edit needs a reconfigure to refresh it while
pinning all 1819 carriers would cost one per edit.
_publish_latest_docker_manifestmatchesbranchesliterally though the field admits patterns, so a workflow tagginglatestfrom apatterned set would not publish, and the regex and glob readings of the live patterns disagree
both ways, so the field's meaning is a praktika-wide call. A local
-DFUZZER=1configure againsta genuinely read-only checkout fails at the generation step; it is not moved under
${CMAKE_BINARY_DIR}because OSS-Fuzz copies$SRC/ClickHouse/tests/fuzz/*.dictunderbash -euand there is no flag that distinguishes its configure from our ownBuild (amd_fuzzers)one, so the build-tree form would abort the official build instead of degrading. The earlier dispatch showed defects
1 and 2 only; I cannot rule out more without a run.
cc @yakov-olkhovskiy @maxknv @leshikus
Workflow [PR]
Sync PR [sync-upstream/pr/115307]