Skip to content

CI: split Bugfix Validation Check into per-arch + final aggregator - #103541

Merged
alexey-milovidov merged 42 commits into
ClickHouse:masterfrom
groeneai:bugfix-validation-per-arch-design
Jun 26, 2026
Merged

alexey-milovidov merged 42 commits into
ClickHouse:masterfrom
groeneai:bugfix-validation-per-arch-design

Conversation

@groeneai

@groeneai groeneai commented Apr 25, 2026 •

Copy link
Copy Markdown
Collaborator

CI-only change. Splits the monolithic Bugfix Validation Check into four per-arch jobs whose results are aggregated by the existing new_tests_check.py workflow post-hook.

Related: #103389

Motivation

The Bugfix Validation Check enforces that a regression test must fail on master HEAD and pass on the PR. Previously it was monolithic per test type:

  • Bugfix validation (functional tests) ran only on aarch64
  • Bugfix validation (integration tests) ran only on amd64

That works for cross-arch bugs but structurally rejects arch-specific fixes. The originating case was #103389, a SIMD fix in base/find_symbols.h that touches the SSE2 fast path (mm_is_in_prepare) on x86 only. On aarch64 there is no SSE2 path, so the regression test passes on master HEAD there, and the old aarch64-only functional check reports "bugfix could not be reproduced" and rejects the PR. The same shape blocks any aarch64-only fix on its amd64-only integration side.

Design

Four per-arch jobs replace the two monolithic ones, keeping the FT / IT split:

Bugfix validation (functional tests, amd64)
Bugfix validation (functional tests, aarch64)
Bugfix validation (integration tests, amd64)
Bugfix validation (integration tests, aarch64)

Each per-arch job downloads the master-HEAD clickhouse binary for its own architecture, runs the new/modified test on master HEAD (expected: FAIL — bug reproduces) and on the PR (expected: PASS — fix works), and inverts the statuses for display (XFAIL / XPASS). It reports one of three top-level statuses:

  • OK — bug reproduced on master HEAD and fixed on the PR (validated on this arch)
  • SKIPPED — bug did not reproduce on master HEAD on this arch (no-repro; another arch can still validate)
  • ERROR / FAIL — infrastructure error / inconclusive run (no signal)

The per-arch jobs are configured with allow_failure=True, so a genuine ERROR (sanitizer assert, OOM, runner termination) does not block PR merge on its own.

There is no separate aggregator job and no result artifacts. The merge-blocking decision is made by the existing new_tests_check.py workflow post-hook, which ORs over the per-arch job results read from Result.from_fs(...) using strict is_success — only OK / XFAIL count; SKIPPED / ERROR / FAIL do not. The bug is considered validated as long as at least one per-arch job is strict-success.

This satisfies the per-arch case: an x86-only fix validates on amd64; the aarch64 job correctly reports SKIPPED (no bug to reproduce there); and the post-hook passes because at least one arch validated.

This design replaces an earlier draft that used a dedicated Bugfix validation (final) aggregator job plus per-arch JSON result artifacts (and, before that, a force_success=True flag). Per maintainer review (@leshikus, @maxknv, @alexey-milovidov) those mechanisms were dropped in favour of the post-hook-driven approach above.

Scope — CI only

This PR is CI infrastructure only. An earlier draft bundled the find_symbols.h SSE2 NUL-match fix and three regression tests (04109, 04110, gtest extensions) as a worked example. That defect was independently fixed on master by 6b3793bd2b3 ("find_symbols.h: fix \0 false-match in SSE2 runtime-needle path") via a different mechanism (padding the unused needle slots in mm_is_in_prepare), so the bundled tests now pass on master HEAD on every arch — exactly the no-repro shape the gate is designed to reject — and can no longer serve as the demonstration. The find_symbols.h change and the three regression tests have been removed and the files restored to master. End-to-end validation of the per-arch mechanism will happen on the next genuine per-arch bugfix PR.

The PR is re-categorized as CI Fix or Improvement and the pr-bugfix label is dropped, so it is not subject to its own validation gate.

Files touched

File Change
ci/defs/defs.py New JobNames for the 4 per-arch jobs; documents the OK / SKIPPED / ERROR status contract. Legacy monolithic BUGFIX_VALIDATE_FT / BUGFIX_VALIDATE_IT constants removed.
ci/defs/job_configs.py Parametrize the FT / IT bugfix jobs by arch; set_allow_failure(True) on each. No aggregator config, no provides=[...] artifact wiring.
ci/jobs/functional_tests.py, ci/jobs/integration_test_job.py Use master's shared invert_bugfix_validation_status inverter (ERROR-preservation gate); propagate SKIPPED to the top-level R on the no-repro path; select the arch-matching master-HEAD build set via bugfix_build_types(job_name).
ci/jobs/scripts/bugfix_validation.py bugfix_build_types(job_name) selector — aarch64 jobs download arm_* master-HEAD binaries, amd64 jobs download amd_*.
ci/jobs/scripts/workflow_hooks/filter_job.py Recognize the per-arch job names in the bugfix-PR skip gates; decide "is this a Bug Fix PR?" from the pr-bugfix / pr-critical-bugfix labels rather than a PR-body substring.
ci/jobs/scripts/workflow_hooks/new_tests_check.py Merge-blocking aggregate: strict is_success OR over per-arch results; mutually-exclusive has_ft or has_it / has_unit / no-tests axis (no unit-test or CI-report-link bypass when FT/IT regression tests are present).
ci/praktika/yaml_generator.py Comment explaining the generated per-job cache-skip if: expression.
ci/tests/test_new_tests_check.py, ci/tests/test_bugfix_validation_inverter.py, ci/tests/test_bugfix_build_types.py Pin the post-hook truth table, the inverter ERROR-preservation / no-repro paths, and the arch-aware build-type selection.
ci/workflows/pull_request.py Wire the four per-arch jobs into the PR workflow.
.github/workflows/pull_request.yml Regenerated by python3 -m ci.praktika yaml.

Status

python3 -m ci.praktika yaml regenerates cleanly. The post-hook, inverter, and build-type selector tests pass locally (33 passed).

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):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.7.1.109

groeneai and others added 6 commits April 25, 2026 06:49
The AST fuzzer found that `extractKeyValuePairs` could raise a
`LOGICAL_ERROR: 'Failed to handle unexpected quoting character. This
is a bug'` (STID 6488-5f6c) for inputs like:

    extractKeyValuePairs(toFixedString('x\0yyyyyyyyyyyyyyyy', 18),
                         ':', ',', '\0', 'accept')

Root cause: the state handler's SIMD-backed `find_first_symbols_or_null`
(`mm_is_in_execute` in `base/find_symbols.h`) iterates a fixed 16-slot
needle array whose unused entries are zero-initialised, so it
unconditionally stops on NUL bytes in the haystack regardless of the
declared needle set. When `quoting_character` is NUL and the strategy
is `ACCEPT`, `NeedleFactory` deliberately omits NUL from the needle
set to skip the quoting branch, but the SIMD still reports a match on
NUL bytes in the input. `StateHandlerImpl::readKey`/`readValue` then
falls into the "unreachable" `ACCEPT` branch and throws
`LOGICAL_ERROR` at `src/Functions/keyvaluepair/impl/StateHandlerImpl.h:126`/`:274`.

Fix: reject `'\0'` as `quoting_character` at configuration validation
time with `BAD_ARGUMENTS`, consistent with the existing rejections of
conflicting delimiter combinations. NUL as a quoting character has no
legitimate use case.

CI reports:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103383&sha=7b7d7cecd8397feadc883b0512a99d6db1e243e3&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%2C%20old_compatibility%29

Session: cron:clickhouse-ci-task-worker:20260422-171500

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Address clickhouse-gh[bot] review nit on PR ClickHouse#103389: the previous
behaviour of the fuzzer repro is a `LOGICAL_ERROR` exception, not a
server crash. Update the comment to say "raised a `LOGICAL_ERROR`
exception" instead of "crashed the server". Also wrap `LOGICAL_ERROR`
and `BAD_ARGUMENTS` in backticks for consistency with the rest of the
comment block.

No test behaviour change.

Session: cron:clickhouse-ci-task-worker:20260423-054500
…rdinary byte

Root cause is in the SSE2 runtime-needle path of `find_first_symbols_or_null`
(`base/find_symbols.h`), not in `extractKeyValuePairs`:

- `mm_is_in_prepare` zero-initialises a fixed 16-slot needle array and fills
  only the first `num_chars` slots.
- `mm_is_in_execute` iterated all 16 slots unconditionally, so the
  zero-padded unused slots unconditionally matched NUL bytes in the haystack
  regardless of the declared needle set.

Any `find_first_symbols(haystack, SearchSymbols(...))` call with fewer than 5
needles and a haystack containing NUL was affected. This is a general bug —
the `extractKeyValuePairs` `LOGICAL_ERROR` was just one visible manifestation
(triggered when `NeedleFactory` deliberately omits NUL from the needle set
for the `ACCEPT` strategy with `quoting_character = '\0'`).

Fix: `mm_is_in_execute` now takes `num_chars` and only iterates that many
slots, so the zero-padded tail cannot match. Zero is now an ordinary byte
like the other 255, and NUL is a first-class quoting / delimiter character.

Changes:

- `base/find_symbols.h`: `mm_is_in_execute` accepts `num_chars`; both call
  sites in `find_first_symbols_sse2` and `find_last_symbols_sse2` pass it.
- `src/Functions/keyvaluepair/impl/Configuration.cpp`: reverted the
  `BAD_ARGUMENTS` rejection of `'\0'` as `quoting_character` — input
  validation is no longer needed now that the root cause is fixed.
- `src/Common/tests/gtest_find_symbols.cpp`: new `FindSymbols.NullByteInHaystack`
  unit test that exercises the SSE2 path with a 16-byte haystack containing
  NUL and short needle sets (<5 chars). The test fails with the pre-fix SIMD
  helper (verified by a side-by-side comparison: buggy mask 0x0410 picks
  NUL at position 4, fixed mask 0x0400 correctly finds 'z' at position 10).
- `tests/queries/0_stateless/04109_extract_key_value_pairs_null_quoting.{sql,reference}`:
  rewritten to verify `extractKeyValuePairs` now parses correctly with
  `quoting_character = '\0'` across all three strategies (`accept`, `invalid`,
  `promote`), including a NUL-delimited quoted value. No more `BAD_ARGUMENTS`
  assertions; the fuzzer repro input now returns `{}` instead of raising
  `LOGICAL_ERROR`.

Verified locally:
- `unit_tests_dbms --gtest_filter="Find*.*"`: 9/9 pass.
- `04109_extract_key_value_pairs_null_quoting`, `02499_extract_key_value_pairs_multiple_input`:
  60/60 pass with `--test-runs 30` and full CI randomisation.
- `*trim*`: 70/70 pass (covers the other `SearchSymbols` caller).
… test

The SIMD fix in base/find_symbols.h (mm_is_in_execute) resolves a latent
silent-wrong-result bug in `trim` / `trimLeft` / `trimRight` / `trimBoth`
with a user-supplied `trim_characters` argument, independently of the
`extractKeyValuePairs` exception that originally triggered this PR.

Pre-fix reproduction on master:

  $ build/programs/clickhouse local --query "
    SELECT length(trimLeft(char(0) || 'xxxxxxxxxxxxxxx', 'x'))"
  0      -- WRONG: should be 16; NUL byte is not in the needle set

  $ build/programs/clickhouse local --query "
    SELECT length(trimLeft(char(1) || 'xxxxxxxxxxxxxxx', 'x'))"
  16     -- CORRECT: SOH byte is not a false-match

`trim` with a custom trim character set routes through
`find_first_not_symbols(input, SearchSymbols)` and
`find_last_not_symbols_or_null(input, SearchSymbols)`. The latter has no
SSE4.2 variant, so every call exercises the SSE2 runtime-needle path in
`mm_is_in_execute` — the exact site fixed in commit 6a51762. One
primitive fix, two user-visible bugs resolved.

This test complements the existing coverage:
- SIMD primitive level: `FindSymbols.NullByteInHaystack` gtest
- `extractKeyValuePairs` level: `04109_extract_key_value_pairs_null_quoting.sql`
- `trim` level (this file): `04110_trim_null_byte_in_haystack.sql`

No existing CI test regresses with the SIMD fix — this is a latent bug
that no test has ever caught (silent wrong output, no exception), found
while auditing sibling callers per review feedback.

PR: ClickHouse#103389
Address review nit on PR ClickHouse#103389: the previous `invalid` strategy
assertion in `04109_extract_key_value_pairs_null_quoting` used an
input without any NUL byte, so it did not exercise the `invalid`
branch for the bug being fixed. Add two queries with a NUL byte in
the haystack and `quoting_character = '\0'`:

- NUL while reading a key: the partial pair is invalidated, parsing
  resumes after the NUL, the next pair is read normally.
- NUL while reading a value: the pair is invalidated, parsing resumes
  at the next pair delimiter, the next pair is read normally.

Both inputs are >= 16 bytes so the SSE2 fast path in
`find_first_symbols_or_null` is exercised; the `invalid` needle set
is `{':', '\0', ','}` (3 chars), which uses SSE2.

Review comment:
ClickHouse#103389 (comment)
Previously, `Bugfix validation (functional tests)` ran only on aarch64 and
`Bugfix validation (integration tests)` ran only on amd64. Bug fixes that
affect a single architecture (e.g. SSE2/AVX-only on x86, NEON-only on
aarch64) could not validate on the "wrong" arch — the regression test
either passes on master HEAD on that arch (because the bug only exists on
the other arch), or the fix is a no-op there. Either way, the bugfix
validation check fails for legitimate per-arch fixes.

This change implements the architecture proposed by @alexey-milovidov in
ClickHouse#103389:

  - There are two separate Bugfix Validation Checks for each test type
    (functional and integration), one per arch (amd64 and aarch64).
  - All four per-arch sub-checks always report SUCCESS to GitHub
    (`force_success=True`); they collect outcomes but do not block PR
    merge directly.
  - A new `Bugfix validation (final)` aggregator depends on all four
    per-arch result artifacts and reports SUCCESS iff at least one arch
    validated the bug (test failed on master HEAD AND passed on the PR).
    This is the only bugfix-validation check that blocks PR merge.

Per-arch jobs introduced (replacing the two monolithic checks):

  - `Bugfix validation (functional tests, amd64)`
  - `Bugfix validation (functional tests, aarch64)`
  - `Bugfix validation (integration tests, amd64)`
  - `Bugfix validation (integration tests, aarch64)`
  - `Bugfix validation (final)` — aggregator

Result-passing mechanism: each per-arch job writes a small JSON to
`ci/tmp/bugfix_validate_result.json` describing whether the bug was
validated on that arch. The four files are uploaded as S3 artifacts
(`BUGFIX_VALIDATE_{FT,IT}_{AMD,ARM}_RESULT`). The aggregator depends on
all four artifacts and OR's their `validated` fields.

Files touched:
  - ci/defs/defs.py: new JobNames + ArtifactNames + ArtifactConfigs
  - ci/defs/job_configs.py: parametrize FT/IT bugfix jobs by arch;
    add `bugfix_validation_final_job` aggregator config
  - ci/jobs/bugfix_validation_aggregate.py: new aggregator script
  - ci/jobs/functional_tests.py: emit JSON result artifact in bugfix mode
  - ci/jobs/integration_test_job.py: emit JSON result artifact in bugfix
    mode
  - ci/jobs/scripts/workflow_hooks/filter_job.py: keep skip-if-not-bugfix
    logic, extended to recognize the new per-arch and aggregator job names
  - ci/workflows/pull_request.py: wire all five new jobs and the
    `bugfix_validate_results` artifact into the PR workflow

Old job-name constants (`BUGFIX_VALIDATE_FT`, `BUGFIX_VALIDATE_IT`) are
retained for backward compatibility with cached/historical CI runs.

Originating discussion: ClickHouse#103389

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

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov @maxknv @leshikus — could you review this design? It implements the per-arch + final-aggregator architecture from #103389 by parametrizing the existing FT/IT bugfix-validation jobs across {amd64, aarch64} (each with force_success=True so they never block PR merge directly), plus a new Bugfix validation (final) aggregator that depends on all four result artifacts and OR's their validated fields. Open question: 5-check (FT/IT split per arch + final) vs 3-check (FT+IT collapsed per arch + final) — see PR description.

@leshikus

Copy link
Copy Markdown
Collaborator

Here is my review: force_success is intended for stabilizing jobs, it is a temporary flag; we generally should not be running force_success tasks as a part of pr check - they do not affect the check and make it longer and more resource consuming, if some jobs depend on another job result, there are standard GitHub mechanisms to establish this dependency

@groeneai

Copy link
Copy Markdown
Collaborator Author

@leshikus, thanks for the review — your point about force_success semantics is fair, and I want to surface the design tension explicitly so you and @alexey-milovidov can align before I rework this PR.

The tension

@alexey-milovidov's original directive in #103389 (2026-04-25T16:48:15Z) was:

  • there will be two separate Bugfix Validation Checks for amd64 and aarch64;
  • they will collect the results, but report success as their status;
  • there will be another check, Bugfix Validation Check (final), that will depend on these two checks, and summarize their results — if at least one found that the test validated the bug, the final result will be successful.

The "report success as their status" wording is what led me to force_success=True — it's the most literal mapping to praktika.

Your critique is also fair: force_success is currently used on master only for the arm_darwin Fast test (ci/defs/job_configs.py:213), which is the canonical "stabilize a flaky job" use case. Using it as a permanent design primitive for the per-arch sub-checks is a different shape, and I take your point that this is mechanism-abuse.

Possible alternatives (using GitHub-native / praktika-native primitives)

Happy to switch to whichever you and Alexey prefer:

A. Bugfix validation (final) is the only required check; per-arch sub-checks are non-required and report their real status. Branch protection rules in the ClickHouse repo would only require the final aggregator. Per-arch jobs report their actual pass/fail (no force_success); their failures don't block PR merge because they aren't required checks. The aggregator depends on them via requires=[...] (artifacts) or set_run_after(...) and OR's the result JSONs. This matches your "standard GitHub mechanisms" suggestion most directly.

B. Single Bugfix validation per arch, no force_success, internal handling. The per-arch job runs both phases (master HEAD + PR), inverts via XFAIL, and writes the result JSON. Its GitHub status is "did the validation framework run cleanly", not "did the bug validate". The aggregator is the only check whose status reflects "bug validated on at least one arch". Per-arch jobs report failure only on infrastructure errors, not on negative validation. Avoids force_success entirely.

C. Praktika-native if_change / conditional dependency. If praktika has a primitive equivalent to GitHub's needs: [..., result: success || failure] (i.e., aggregator runs even if dependencies "failed"), I'd prefer that — closer to alexey's "depend on these two checks" wording while not relying on force_success. I don't see this in ci/praktika/job.py today, but maxknv would know.

What I'd like

Could you and @alexey-milovidov agree on:

  1. Is the behavior alexey described (per-arch checks "report success", final check carries the verdict) still what you both want?
  2. If yes, which mechanism is acceptable — A, B, C, or something else?

I don't want to rework the PR twice, and I don't want to step on either of your design preferences. Once you align, I'll push the new shape.

cc @alexey-milovidov @maxknv

@leshikus

Copy link
Copy Markdown
Collaborator

there is no contradiction here, I vote against forcing the success status; you can report success status without forcing it

…orce_success)

Per @leshikus's review feedback on PR ClickHouse#103541
(ClickHouse#103541 (comment) from
2026-04-26T08:26:25Z): "I vote against forcing the success status; you can
report success status without forcing it".

This commit keeps the per-arch + final aggregator architecture from the
original PR (which @alexey-milovidov approved in
ClickHouse#103389 (comment) from
2026-04-25T16:48:15Z) but switches the per-arch jobs from a
`force_success=True` flag to a natural OK exit:

  - Remove `force_success=True` from the four per-arch
    `Bugfix validation (...)` job configs in `ci/defs/job_configs.py`.
  - In `ci/jobs/functional_tests.py` and `ci/jobs/integration_test_job.py`,
    after inverting test result statuses for bugfix validation:
      - Always call `set_success()` on the result so the per-arch job's
        GitHub status reflects "ran the test and captured the outcome",
        not "was the bug validated".
      - The validation outcome (whether the bug was reproduced) lives in
        the JSON artifact (`bugfix_validate_result.json`) consumed by the
        `Bugfix validation (final)` aggregator, which decides the
        merge-blocking status.
  - In the integration-test runner, gate the success-overwrite behind
    `if has_error:` so genuine infrastructure failures (sanitizer assert,
    OOM, server crash) still propagate as real failures instead of being
    masked. The aggregator handles that arch as SKIPPED, so the other arch
    can still validate the bug.
  - Update comments in `ci/defs/defs.py` and
    `ci/jobs/bugfix_validation_aggregate.py` to describe the new
    natural-success contract.

No changes to job names, dependencies, artifacts, or the aggregator logic
itself — only the mechanism by which per-arch jobs report success. The
regenerated `pull_request.yml` is unchanged.

CI report: ClickHouse#103541
@groeneai

Copy link
Copy Markdown
Collaborator Author

@leshikus thanks for the clarification — that resolves the design tension. I've pushed a follow-up commit that reworks the mechanism without changing the architecture: 517801bc446

What changed:

  • Removed force_success=True from all four per-arch Bugfix validation (...) job configs in ci/defs/job_configs.py.
  • In ci/jobs/functional_tests.py and ci/jobs/integration_test_job.py, after inverting test-result statuses in bugfix-validation mode, the per-arch runners now always call set_success() on the result. The per-arch job's GitHub status reflects "ran the test and captured the outcome" — not "was the bug validated". The validation outcome lives only in the JSON artifact, which the aggregator consumes.
  • Critically, in the integration-test runner the success-overwrite is gated behind if has_error: — so a genuine infrastructure failure (sanitizer assert, OOM, server crash) still propagates as a real failure instead of being silently masked the way force_success=True would have masked it. The aggregator naturally handles that arch as SKIPPED (no JSON written), so the other arch can still validate the bug.
  • Updated comments in ci/defs/defs.py, ci/defs/job_configs.py, and ci/jobs/bugfix_validation_aggregate.py to describe the new natural-success contract.

What did NOT change:

  • Job names, runners, artifact names, dependencies (provides / requires), and the aggregator logic itself — all unchanged.
  • The architecture (per-arch + final aggregator) is preserved as @alexey-milovidov originally described.
  • Regenerated pull_request.yml is unchanged (force_success is internal to praktika and doesn't surface in the GH Actions YAML).

This satisfies @leshikus's two requests:

  1. No force_success flag — per-arch jobs report success because they naturally completed their work.
  2. Real infra failures are not masked — they still block the PR.

@alexey-milovidov, the architecture you described in #103389 is intact; only the success-reporting mechanism has changed. Could you confirm this matches your expectation?

@maxknv, the praktika changes in this PR no longer rely on force_success=True for the per-arch jobs — only the existing arm_darwin Fast test continues to use that flag. Let me know if anything else looks off.

End-to-end testing on a real Bug Fix PR with the pr-bugfix label is the next step once the design is confirmed.

@leshikus

leshikus commented Apr 26, 2026 •

Copy link
Copy Markdown
Collaborator

@groeneai could you please also explain why Alexey's proposal and this PR are actually needed? please add the motivation to the updated pr description - I see the description is outdated

@groeneai

Copy link
Copy Markdown
Collaborator Author

@leshikus thanks — description rewritten in #103541 with:

  • A ## Motivation section explaining why the current monolithic check structurally cannot validate per-arch bugfixes, with Fix SIMD NUL false match in find_first_symbols_or_null (extractKeyValuePairs LOGICAL_ERROR, STID 6488-5f6c) #103389 (SSE2-only fix) as the concrete example and a small table showing why aarch64's Bugfix validation (functional tests) necessarily fails for x86-only bugs and vice versa.
  • A ## Design section that no longer references force_success. It explains the natural success contract: per-arch jobs report OK because they completed their work (ran the test, captured the outcome, wrote the JSON artifact), not because a flag silenced an actual failure status.
  • A ## What was reworked from the original design section that explicitly cites your two comments and explains the mechanism change in commit 517801b — removed force_success=True, added set_success() in the runners, gated the success-overwrite behind if has_error: so real infra failures still propagate.
  • The files-touched table is updated; the ci/defs/job_configs.py row now says "No force_success=True — per-arch jobs report success naturally via set_success() in the runner."

cc @alexey-milovidov @maxknv — the architecture is unchanged from your original directive; only the per-arch success-reporting mechanism was reworked.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Apr 26, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4752c56]

Summary: ✅


AI Review

Summary

This PR splits Bugfix validation into per-arch functional/integration jobs and makes new_tests_check.py aggregate their strict-success results. The main per-arch validation model is much clearer now, but two CI-sanity gaps remain: the non-bugfix sanity runs are non-blocking, and helper-only changes can skip those sanity runs entirely.

Missing context / blind spots
  • ⚠️ Focused local pytest verification could not start in this checkout because /usr/bin/python3 has no pytest module installed. A successful run of ci/tests/test_bugfix_build_types.py, ci/tests/test_bugfix_validation_inverter.py, and ci/tests/test_new_tests_check.py would close this gap.
  • ⚠️ Current PR checks were still pending for CI Tests and the four Bugfix validation jobs when reviewed. A completed green PR CI run would close the CI-coverage gap.
Findings

⚠️ Majors

  • [ci/defs/job_configs.py:594] The non-bugfix CI-sanity contract for Bugfix validation runner changes is no longer enforced. The per-arch jobs are statically allow_failure=True, both runners mark every BugfixValidation run as do_not_block_pipeline_on_failure, and new_tests_check.py returns early for non-pr-bugfix PRs. Therefore a CI-only PR that changes ci/jobs/functional_tests.py or ci/jobs/integration_test_job.py can run the sanity Bugfix validation jobs, have them fail, and still merge because Finish Workflow ignores failed allow_failure jobs. Existing thread: CI: split Bugfix Validation Check into per-arch + final aggregator #103541 (comment)
    Suggested fix: keep this non-blocking behavior only for real bugfix PR aggregation, or add an equivalent workflow post-hook/final check that fails non-bugfix CI PRs when these sanity jobs are non-OK.
  • [ci/jobs/scripts/workflow_hooks/filter_job.py:205] The non-bugfix sanity exception does not include the new shared helper that now carries arch-sensitive behavior. A PR changing only ci/jobs/scripts/bugfix_validation.py changes bugfix_build_types / find_master_builds, but filter_job.py still skips every Bugfix validation job unless ci/jobs/functional_tests.py or ci/jobs/integration_test_job.py changed. That lets the helper break without a sanity run. Existing thread: CI: split Bugfix Validation Check into per-arch + final aggregator #103541 (comment)
    Suggested fix: include ci/jobs/scripts/bugfix_validation.py in the files that unskip the corresponding per-arch sanity jobs, or centralize the set of bugfix-validation runner/helper files used for this exception.
Tests
  • ⚠️ Local focused tests were attempted but did not run because pytest is missing. Current GitHub checks were also pending, so the added Python coverage and regenerated workflow were not independently verified in this review run.
Final Verdict

Status: ⚠️ Request changes

Minimum required actions: make non-bugfix Bugfix validation sanity failures merge-blocking again, and ensure changes to ci/jobs/scripts/bugfix_validation.py unskip the per-arch sanity jobs.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 26, 2026
The per-arch Bugfix validation jobs declare `bugfix_validate_result.json`
in `provides=[...]`, so the praktika runner unconditionally tries to
upload that artifact during the post-run step. Previously the JSON was
only written for actual bugfix PRs (those with the `pr-bugfix` /
`pr-critical-bugfix` label). On non-bugfix PRs that exercise these jobs
(e.g. when the test-runner script itself is modified), the file was
never written, and the artifact-upload step failed with `ls: cannot
access '...bugfix_validate_result.json': No such file`, which caused
the entire job to report `FAILURE` to GitHub.

This was exactly the latent bug that `force_success=True` was masking
before commit `517801bc446`. After dropping `force_success`, the
failure surfaced on PR ClickHouse#103541 itself: 4/4 per-arch jobs failed at the
artifact-upload step even though the inner praktika test results were
all green (sanity test `00001_select_1` passed on every arch).

Fix:

- `ci/jobs/functional_tests.py` and `ci/jobs/integration_test_job.py`
  now ALWAYS write `bugfix_validate_result.json` whenever the job is a
  bugfix-validation job, regardless of PR labels. Two new fields are
  recorded:
  * `is_bugfix_pr` — whether the PR has a `pr-bugfix` /
    `pr-critical-bugfix` label.
  * `skipped` — set to `true` for non-bugfix PRs and for bugfix PRs
    that hit an infrastructure error during validation. Excludes the
    arch from the aggregator's validation decision.

- `ci/jobs/bugfix_validation_aggregate.py` recognises both fields and
  reports SUCCESS in the new "all archs skipped because not a bugfix
  PR" case, so the aggregator does not block PRs that merely modify
  the bugfix-validation runner. The default `is_bugfix_pr=true`
  preserves back-compat with older per-arch JSONs.

The `set_success()` semantics for actual bugfix PRs are unchanged:
result inversion (XFAIL semantics) and natural OK status without
`force_success=True`. The integration-test runner now also writes a
`skipped=true` JSON when `has_error` is set during bugfix validation,
so an infra-error arch propagates as a real job failure on GitHub
while still emitting the artifact for the aggregator to consume.

CI report: ClickHouse#103541
@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Apr 26, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pushed a follow-up commit fixing the 4 failing per-arch Bugfix validation checks: c6967f03fd7

Root cause

The per-arch jobs declare bugfix_validate_result.json in provides=[...], so the praktika runner unconditionally uploads that artifact during the post-run step. Before this commit the JSON was only written when the PR had a pr-bugfix / pr-critical-bugfix label, so on this PR (a CI-infrastructure change with no such label) the artifact-upload step failed with:

ls: cannot access '.../ci/tmp/bugfix_validate_result.json': No such file or directory
ERROR: Failed to upload artifact [BUGFIX_VALIDATE_FT_AMD_RESULT...]

That made all four per-arch jobs report FAILURE to GitHub even though the inner praktika test results were all green (sanity test 00001_select_1 passed on every arch — see report #2-#5 in the CI dashboard).

This was exactly the latent bug that force_success=True was masking before 517801b. @leshikus's critique was substantively correct: removing the flag surfaces a real defect that the runner needed to handle properly.

Fix

  • ci/jobs/functional_tests.py and ci/jobs/integration_test_job.py now always write bugfix_validate_result.json whenever the job is a bugfix-validation job, regardless of PR labels. Two new fields:
    • is_bugfix_pr — whether the PR has a pr-bugfix / pr-critical-bugfix label.
    • skipped — set on infrastructure errors and on non-bugfix PRs; excludes that arch from the aggregator's validation decision.
  • ci/jobs/bugfix_validation_aggregate.py recognises both fields and reports OK in the new "all archs are non-bugfix-PR" case so the aggregator doesn't block PRs that merely modify the runner. The default is_bugfix_pr=True preserves back-compat with older per-arch JSONs.
  • The integration-test runner now writes skipped=true even when has_error is set during bugfix validation, so an infra-error arch propagates as a real job failure on GitHub and still emits the artifact for the aggregator to consume.

set_success() semantics for actual bugfix PRs are unchanged: result inversion (XFAIL semantics) and natural OK status, no force_success=True. Verified locally with 8 aggregator scenarios (PR #103541 case, x86-only fix, both-archs-fail-to-validate, all-artifacts-missing, infra-error-on-one-arch, back-compat with old JSON, mixed FT-OK/IT-skipped, all-archs-infra-error).

python3 -m ci.praktika yaml still regenerates cleanly with no diff to .github/workflows/pull_request.yml.

cc @leshikus @alexey-milovidov @maxknv — please re-review when CI runs on c6967f0; the architecture and the natural-success mechanism are unchanged, this just plugs the missing-artifact hole.

Comment thread ci/jobs/functional_tests.py Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member

It's perfect now.

Happy to switch to whichever you and Alexey prefer:

A. Bugfix validation (final) is the only required check; per-arch sub-checks are non-required and report their real status. Branch protection rules in the ClickHouse repo would only require the final aggregator. Per-arch jobs report their actual pass/fail (no force_success); their failures don't block PR merge because they aren't required checks. The aggregator depends on them via requires=[...] (artifacts) or set_run_after(...) and OR's the result JSONs. This matches your "standard GitHub mechanisms" suggestion most directly.

B. Single Bugfix validation per arch, no force_success, internal handling. The per-arch job runs both phases (master HEAD + PR), inverts via XFAIL, and writes the result JSON. Its GitHub status is "did the validation framework run cleanly", not "did the bug validate". The aggregator is the only check whose status reflects "bug validated on at least one arch". Per-arch jobs report failure only on infrastructure errors, not on negative validation. Avoids force_success entirely.

C. Praktika-native if_change / conditional dependency. If praktika has a primitive equivalent to GitHub's needs: [..., result: success || failure] (i.e., aggregator runs even if dependencies "failed"), I'd prefer that — closer to alexey's "depend on these two checks" wording while not relying on force_success. I don't see this in ci/praktika/job.py today, but maxknv would know.

All of the current choices are good.

@alexey-milovidov
alexey-milovidov marked this pull request as ready for review April 26, 2026 11:15
groeneai and others added 2 commits April 26, 2026 11:54
`functional_tests.py` was missing the `has_error` gate that
`integration_test_job.py` already has. As a result, when an FT
bugfix-validation arch hit a real infrastructure error (server failed to
start, Docker pull timeout, sanitizer assert during startup), the runner
called `test_result.set_success()` unconditionally and emitted a JSON
artifact with `validated=false` (no `skipped=true`). The aggregator then
treated that arch as "test ran but didn't validate", instead of "couldn't
run on this arch", which is a false-negative validation outcome.

Fix mirrors the IT logic (`if has_error:` gate around the
success-overwrite, `skipped=true` JSON for infra errors, ERROR-status
detection from both `test_result.is_error()` and any sub-result with
ERROR status):

  - Detect FT infra errors via `test_result.is_error()` (`FTResultsProcessor`
    sets ERROR when the test runner terminated unexpectedly) plus any
    individual sub-result with ERROR status (server died on a specific
    test, test-output parse failure).
  - When `has_error`: skip the inversion + `set_success()` and emit JSON
    with `skipped=true` and a clear info message. The job's natural
    failure status propagates to GitHub so the failure isn't masked.
  - The aggregator already handles `skipped=true` correctly (excludes that
    arch from the validation decision; other arch can still validate).

Bot review:
https://github.com/ClickHouse/ClickHouse/pull/103541#discussion-on-functional_tests.py

Co-Authored-By: Claude Opus 4.7 <[email protected]>
The lower skip block in `should_skip_job` (the one that skips bugfix
validation jobs on Bug-Fix PRs that don't touch the corresponding test
kind) only matched the legacy monolithic names
(`JobNames.BUGFIX_VALIDATE_FT` / `JobNames.BUGFIX_VALIDATE_IT`). On a
Bug-Fix PR that only touches integration tests, the new per-arch
functional-test bugfix jobs would not be skipped — they would run
anyway, find no functional-test updates to validate against, and emit
`validated=false` JSON artifacts, polluting the per-arch bugfix-validation
output.

Extend the skip checks to cover the per-arch variants as well:

  - `BUGFIX_VALIDATE_FT_AMD` / `BUGFIX_VALIDATE_FT_ARM`  ->  skip if no
    functional-test updates
  - `BUGFIX_VALIDATE_IT_AMD` / `BUGFIX_VALIDATE_IT_ARM`  ->  skip if no
    integration-test updates

`Bugfix validation (final)` is intentionally NOT in either list — the
aggregator always runs on bug-fix PRs, summarizing whichever per-arch
variants ran.

The upper skip block (`if " Bug Fix" not in _info_cache.pr_body`) already
handles the per-arch names; only the lower block was missed during the
original migration.

Bot review:
https://github.com/ClickHouse/ClickHouse/pull/103541#discussion-on-filter_job.py

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

Copy link
Copy Markdown
Collaborator Author

Thanks @clickhouse-gh[bot] for the second pass — both review comments addressed.

Commit c21ebec0 — functional_tests.py: add has_error gate (mirrors integration_test_job.py)

The bot was right: the FT runner's bugfix-validation block was calling test_result.set_success() unconditionally for bugfix PRs, masking real infrastructure errors (server crash, sanitizer assert during startup, Docker pull timeout). Symmetric fix to what's in integration_test_job.py:

  • Detect FT infra errors via test_result.is_error() (FTResultsProcessor sets Status.ERROR when the test runner terminated unexpectedly) and any individual sub-result with ERROR status (server died on a specific test, test-output parse failure).
  • When has_error is true: skip the inversion and the set_success() call — let the natural failure status propagate to GitHub. Emit JSON with skipped=true and a clear info message so the aggregator excludes this arch from the validation decision.
  • The aggregator already handles skipped=true correctly (the IT side was the first user); no aggregator change needed.

JSON shape now mirrors IT's:

{\"validated\": false, \"info\": \"Skipped on amd64 due to infrastructure error during bugfix validation\",
 \"arch\": \"amd64\", \"kind\": \"functional tests\", \"is_bugfix_pr\": true, \"skipped\": true}

Commit 8a4104ec — filter_job.py: extend lower skip block to per-arch names

The earlier filter_job.py change covered the upper skip block (the if \" Bug Fix\" not in _info_cache.pr_body branch) but missed the lower one (the "skip on Bug-Fix PR if no corresponding test updates" gate). Extended both "no functional-test updates" and "no integration-test updates" gates to match the per-arch variants:

  • BUGFIX_VALIDATE_FT_AMD / BUGFIX_VALIDATE_FT_ARM → skip when no functional-test updates
  • BUGFIX_VALIDATE_IT_AMD / BUGFIX_VALIDATE_IT_ARM → skip when no integration-test updates

Bugfix validation (final) is intentionally NOT in either list — the aggregator always runs on Bug-Fix PRs, summarizing whichever per-arch variants ran.

Verification:

  • python3 -m ci.praktika yaml regenerates cleanly with no .github/workflows/pull_request.yml diff (filter_job is invoked at runtime, not yaml-gen time).
  • Standalone aggregator scenarios (7 cases including "FT amd skipped (infra) + FT arm validated", "both FT skipped + IT both validated", "all four skipped", "back-compat without skipped field", "all bugfix-PR archs failed validation") all produce expected outcomes.

cc @leshikus @alexey-milovidov @maxknv

Comment thread ci/jobs/integration_test_job.py Resolved
In bugfix-validation mode the integration-test runner must keep `has_error =
True` for infra-only failures, so the bugfix-validation block treats the run
as SKIPPED rather than as `validated=true` via the FAIL→OK inversion path.

Per @clickhouse-gh[bot] inline review on PR ClickHouse#103541 (2026-04-27, line 1060):
without this gate, an infra-only run on a Bug Fix PR clears `has_error`,
the inversion turns the infra `FAIL` results into `OK`, sets
`has_failure=True`, and emits a JSON with `validated=true, skipped=false`.
The aggregator then incorrectly reports "bug reproduced on master and fixed
on PR" for an arch that actually failed to run the test at all.

The `if has_error and not is_bugfix_validation:` gate keeps the original
infra-only clearing behavior for non-bugfix runs (we still want to suppress
the job-level error label there) while letting the bugfix-validation
branches at lines 1093-1103 correctly emit `skipped=true` JSON and
propagate the infra error as a job failure.

The LLVM-coverage `has_error = False` rewrite (line 1030) is gated by an
assertion that bugfix validation and LLVM coverage are mutually exclusive,
so no analogous gate is needed there.
Comment thread ci/defs/job_configs.py
],
),
result_name_for_cidb="Tests",
).set_allow_failure(True).parametrize(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new per-arch Bugfix validation jobs are also still used as sanity checks for non-bugfix CI changes: filter_job.should_skip_job deliberately unskips them when ci/jobs/functional_tests.py or ci/jobs/integration_test_job.py changes. With this unconditional allow_failure=True, plus the runners setting do_not_block_pipeline_on_failure for every BugfixValidation run, that sanity path no longer gates anything: on a CI-only PR new_tests_check.check returns early because there is no pr-bugfix label, and Finish Workflow ignores these failed jobs because the job config is allowed to fail. So a change that breaks the Bugfix validation runner can merge even though the validation jobs ran and failed.

Please keep the non-blocking behavior only for real bugfix PR aggregation, or add an equivalent post-hook/final check for the non-bugfix sanity path. Otherwise the existing "run these jobs when the runner changed" contract becomes a non-blocking signal.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged master into the branch (was 897 commits behind) and resolved the only conflict in the generated .github/workflows/pull_request.yml by regenerating it with python3 -m ci.praktika yaml (stable; master.yml matches origin/master, and the only PR-side job delta is the intended 2 monolithic → 4 per-arch split).

All review feedback is addressed and verified against the current code:

  • The OK / SKIPPED / ERROR status contract is documented and the no-repro path propagates SKIPPED to the top-level R (the Cursor Bugbot high-severity finding).
  • Legacy BUGFIX_VALIDATE_FT / BUGFIX_VALIDATE_IT constants and compat paths removed; bugfix-PR detection now uses labels, not a PR-body substring.
  • Arch-aware master-HEAD binary download via bugfix_build_types(job_name) (aarch64 jobs no longer pull x86 binaries).

Diff is CI-only (find_symbols.h and gtest fully restored to master). Post-hook, inverter, and build-type tests pass locally (33 passed). Description updated to match the current post-hook-driven design (no aggregator/artifacts). Approving.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving — see prior review notes. Merged master, resolved the generated-YAML conflict by regeneration, all feedback addressed and verified, CI-only diff, 33 tests pass locally. Description updated to the current post-hook-driven design.

if job_name in (
JobNames.BUGFIX_VALIDATE_FT_AMD,
JobNames.BUGFIX_VALIDATE_FT_ARM,
) and any(f.endswith("jobs/functional_tests.py") for f in changed_files):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-bugfix sanity exception only fires when ci/jobs/functional_tests.py or ci/jobs/integration_test_job.py changes, but this PR moves arch-sensitive behavior into the shared ci/jobs/scripts/bugfix_validation.py helper. A future CI-only PR that changes only bugfix_build_types or find_master_builds will skip every Bugfix validation job here as "not a bug-fix PR", so the helper can break without any sanity run.

Please include ci/jobs/scripts/bugfix_validation.py in the files that unskip the corresponding per-arch sanity jobs, or centralize this as the set of bugfix-validation runner/helper files that must force a sanity run on non-bugfix CI PRs.

groeneai and others added 2 commits June 18, 2026 07:33
…er-arch-design

Resolved one conflict in ci/jobs/scripts/workflow_hooks/new_tests_check.py:
master 760cfcf added has_new_integration_test_docker_images() as a new
test signal. Combined it with this branch's per-arch validation structure:
a Docker-image-only change (no new test_*.py module) cannot be run by the
per-arch Bugfix Validation jobs, so it is accepted on its own like unit
tests, while functional/integration regression tests still require a
strict-success per-arch validation. The generated pull_request.yml was
regenerated from the merged ci/ sources (identical to the auto-merge).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…er-arch-design

Resolve conflicts after master diverged 414 commits:

- ci/jobs/integration_test_job.py: import block. Keep our per-arch
  bugfix_build_types() selector; adopt master's removal of the dead
  'from more_itertools import tail' import (a local def tail at L519 has
  always shadowed it).
- .github/workflows/*.yml: regenerated via 'python3 -m ci.praktika yaml'
  from the merged sources (deterministic generator output; non-PR
  workflows byte-identical to the auto-merge, zero drift).
- ci/tests/test_bugfix_validation_inverter.py: master added
  test_clean_log_checks_are_not_flipped_to_failures covering its new
  LOG_CHECK handling. Keep the health-check assertions; reconcile its
  outer-status assertions to the per-arch contract (no-repro -> SKIPPED,
  not FAIL), matching the sibling no-repro tests. All 36 CI-infra tests
  pass.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

@groeneai, fix conflicts.

…er-arch-design

# Conflicts:
#	ci/jobs/scripts/workflow_hooks/new_tests_check.py
@groeneai

Copy link
Copy Markdown
Collaborator Author

@alexey-milovidov Conflicts resolved, merged master into the branch (37983f53897, fast-forward, your commits preserved). One textual conflict in new_tests_check.py (a print() line) reconciled to the per-arch contract; master's new has_new_integration_test_docker_images gate was kept. python3 -m ci.praktika yaml regenerates with zero drift; the 36 ci/tests bugfix-validation tests pass. mergeable=MERGEABLE.

The two open threads are already addressed and survived the merge: the legacy monolithic BUGFIX_VALIDATE_FT/_IT constants are gone from defs.py, and the if: explanation lives at its generator source (yaml_generator.py TEMPLATE_IF_EXPRESSION).

Drop the stray f prefix on a placeholder-less f-string at
new_tests_check.py:219 (the no-new-tests print). Introduced when the
master-merge conflict resolution kept the HEAD side of this branch.
ruff==0.15.13 F541 (selected in pyproject.toml) flagged it on the
Style check; this de-prefix makes it pass with identical output.

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

Copy link
Copy Markdown
Collaborator Author

Conflicts resolved (master merged on top, your commits preserved). One ruff F541 surfaced on that merge (placeholder-less f-string in new_tests_check.py); fixed in 7c73e2e. ruff==0.15.13 clean, 36 ci/tests pass. mergeable=MERGEABLE.

(session cron:clickhouse-worker-slot-1:20260622-003900)

…er-arch-design

# Conflicts:
#	.github/workflows/pull_request.yml
@groeneai

Copy link
Copy Markdown
Collaborator Author

Conflicts resolved (4752c5604a7, master merged on top, fast-forward, your commits preserved). Sole conflict was the generated pull_request.yml finish_workflow.needs list, regenerated via praktika yaml so it carries both the 4 per-arch bugfix jobs and master's new sqlstorm_test; zero drift on re-run. Net diff vs master is the 13 CI-infra files only. 36 ci/tests pass, ruff 0.15.13 clean. MERGEABLE.

@alexey-milovidov
alexey-milovidov merged commit 05061b4 into ClickHouse:master Jun 26, 2026
168 of 169 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 26, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…orce_success)

Per @leshikus's review feedback on PR ClickHouse#103541
(ClickHouse#103541 (comment) from
2026-04-26T08:26:25Z): "I vote against forcing the success status; you can
report success status without forcing it".

This commit keeps the per-arch + final aggregator architecture from the
original PR (which @alexey-milovidov approved in
ClickHouse#103389 (comment) from
2026-04-25T16:48:15Z) but switches the per-arch jobs from a
`force_success=True` flag to a natural OK exit:

  - Remove `force_success=True` from the four per-arch
    `Bugfix validation (...)` job configs in `ci/defs/job_configs.py`.
  - In `ci/jobs/functional_tests.py` and `ci/jobs/integration_test_job.py`,
    after inverting test result statuses for bugfix validation:
      - Always call `set_success()` on the result so the per-arch job's
        GitHub status reflects "ran the test and captured the outcome",
        not "was the bug validated".
      - The validation outcome (whether the bug was reproduced) lives in
        the JSON artifact (`bugfix_validate_result.json`) consumed by the
        `Bugfix validation (final)` aggregator, which decides the
        merge-blocking status.
  - In the integration-test runner, gate the success-overwrite behind
    `if has_error:` so genuine infrastructure failures (sanitizer assert,
    OOM, server crash) still propagate as real failures instead of being
    masked. The aggregator handles that arch as SKIPPED, so the other arch
    can still validate the bug.
  - Update comments in `ci/defs/defs.py` and
    `ci/jobs/bugfix_validation_aggregate.py` to describe the new
    natural-success contract.

No changes to job names, dependencies, artifacts, or the aggregator logic
itself — only the mechanism by which per-arch jobs report success. The
regenerated `pull_request.yml` is unchanged.

CI report: ClickHouse#103541
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The per-arch Bugfix validation jobs declare `bugfix_validate_result.json`
in `provides=[...]`, so the praktika runner unconditionally tries to
upload that artifact during the post-run step. Previously the JSON was
only written for actual bugfix PRs (those with the `pr-bugfix` /
`pr-critical-bugfix` label). On non-bugfix PRs that exercise these jobs
(e.g. when the test-runner script itself is modified), the file was
never written, and the artifact-upload step failed with `ls: cannot
access '...bugfix_validate_result.json': No such file`, which caused
the entire job to report `FAILURE` to GitHub.

This was exactly the latent bug that `force_success=True` was masking
before commit `517801bc446`. After dropping `force_success`, the
failure surfaced on PR ClickHouse#103541 itself: 4/4 per-arch jobs failed at the
artifact-upload step even though the inner praktika test results were
all green (sanity test `00001_select_1` passed on every arch).

Fix:

- `ci/jobs/functional_tests.py` and `ci/jobs/integration_test_job.py`
  now ALWAYS write `bugfix_validate_result.json` whenever the job is a
  bugfix-validation job, regardless of PR labels. Two new fields are
  recorded:
  * `is_bugfix_pr` — whether the PR has a `pr-bugfix` /
    `pr-critical-bugfix` label.
  * `skipped` — set to `true` for non-bugfix PRs and for bugfix PRs
    that hit an infrastructure error during validation. Excludes the
    arch from the aggregator's validation decision.

- `ci/jobs/bugfix_validation_aggregate.py` recognises both fields and
  reports SUCCESS in the new "all archs skipped because not a bugfix
  PR" case, so the aggregator does not block PRs that merely modify
  the bugfix-validation runner. The default `is_bugfix_pr=true`
  preserves back-compat with older per-arch JSONs.

The `set_success()` semantics for actual bugfix PRs are unchanged:
result inversion (XFAIL semantics) and natural OK status without
`force_success=True`. The integration-test runner now also writes a
`skipped=true` JSON when `has_error` is set during bugfix validation,
so an infra-error arch propagates as a real job failure on GitHub
while still emitting the artifact for the aggregator to consume.

CI report: ClickHouse#103541
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
In bugfix-validation mode the integration-test runner must keep `has_error =
True` for infra-only failures, so the bugfix-validation block treats the run
as SKIPPED rather than as `validated=true` via the FAIL→OK inversion path.

Per @clickhouse-gh[bot] inline review on PR ClickHouse#103541 (2026-04-27, line 1060):
without this gate, an infra-only run on a Bug Fix PR clears `has_error`,
the inversion turns the infra `FAIL` results into `OK`, sets
`has_failure=True`, and emits a JSON with `validated=true, skipped=false`.
The aggregator then incorrectly reports "bug reproduced on master and fixed
on PR" for an arch that actually failed to run the test at all.

The `if has_error and not is_bugfix_validation:` gate keeps the original
infra-only clearing behavior for non-bugfix runs (we still want to suppress
the job-level error label there) while letting the bugfix-validation
branches at lines 1093-1103 correctly emit `skipped=true` JSON and
propagate the infra error as a job failure.

The LLVM-coverage `has_error = False` rewrite (line 1030) is gated by an
assertion that bugfix validation and LLVM coverage are mutually exclusive,
so no analogous gate is needed there.
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…rtifacts)

Per ClickHouse#103541 (comment) from
@alexey-milovidov 2026-05-02T14:55:53Z directing implementation of
@maxknv's design (ClickHouse#103541 (comment)
2026-04-28T17:23:31Z).

Replaces the previous "4 per-arch jobs with custom JSON artifacts +
final aggregator job" design with a much simpler approach:

* Per-arch jobs keep the natural pass/fail status from the existing
  XFAIL inversion logic in `ci/jobs/functional_tests.py` /
  `ci/jobs/integration_test_job.py` (no `set_success`/`force_success`
  rework — those modifications are reverted to the pre-existing
  inversion behavior).
* Per-arch jobs use `allow_failure=True` (Praktika primitive) so an
  individual FAIL doesn't block PR merge. They also pass
  `do_not_block_pipeline_on_failure=True` to `complete_job` so
  downstream jobs aren't dropped.
* The merge-blocking decision moves from a dedicated aggregator job
  with custom JSON artifacts to the existing
  `ci/jobs/scripts/workflow_hooks/new_tests_check.py` workflow
  post-hook, which already runs at the end of every PR. The post-hook
  now reads the workflow result via `Result.from_fs(Info().workflow_name)`
  and OR's the per-arch Bugfix Validation job statuses: validation
  passes iff at least one per-arch job reported `is_success()` (OK or
  XFAIL — SKIPPED is excluded so a `filter_job`-skipped variant is
  not silently treated as a pass).

Drops:
* `ci/jobs/bugfix_validation_aggregate.py` (the aggregator script).
* `JobNames.BUGFIX_VALIDATE_FINAL` (the aggregator job name).
* `ArtifactNames.BUGFIX_VALIDATE_*_RESULT` (4 result artifact names).
* `ArtifactConfigs.bugfix_validate_results` (parametrized artifact
  config).
* `JobConfigs.bugfix_validation_final_job` (the aggregator job
  config).
* All custom JSON-write blocks added to `functional_tests.py` /
  `integration_test_job.py` for the artifact-based design — restored
  to the master inversion logic.

Keeps:
* The 4 per-arch parametrization (FT amd64, FT aarch64, IT amd64,
  IT aarch64) — this is the architectural improvement that makes
  arch-specific bugfix PRs validatable.
* `filter_job.py` per-arch handling for the bugfix-PR skip-on-no-
  test-changes gate (drops the aggregator-specific entry).

The diff vs master is +304/-29 lines across 8 files (down from
+712/-58 in the previous design).

Addresses @maxknv's concerns:
1. No new artifacts — CI checks the Result object instead.
2. `allow_failure=True` on initial validation jobs (so they don't
   block merge).
3. `do_not_block_pipeline_on_failure=True` on the per-arch jobs.
4. Aggregating job dropped; post-hook checks per-job statuses via
   `Result.from_fs(Info().workflow_name)`.
5. No changes to functional/integration test job runners beyond
   reverting our previous additions to the bugfix-validation block.

cc @maxknv @alexey-milovidov @leshikus
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…blocking log lines

Address four inline review comments from `clickhouse-gh[bot]` on PR ClickHouse#103541:

1. `ci/jobs/scripts/workflow_hooks/filter_job.py` (l. 252): typo
   `bufgfix prs` -> `bugfix PRs`.

2. `ci/jobs/scripts/workflow_hooks/filter_job.py` (l. 253): typo
   `at list one type` -> `at least one type`.

3. `ci/jobs/functional_tests.py` (l. 823): the previous log line
   `NOTE: Bugfix validation job - do not block pipeline - exit with 0`
   was misleading - `Result.complete_job` still calls `sys.exit(1)`
   for non-OK results, only the `do_not_block_pipeline_on_failure`
   metadata is set. Reword the message and surrounding comment to
   make explicit that the non-blocking flag is metadata for the
   pipeline scheduler, while the process exit code still reflects
   the actual job status.

4. `ci/jobs/integration_test_job.py` (l. 1078): same misleading wording,
   same fix as (3).

No behavior change. `python3 -m ci.praktika yaml` regenerates the same
GitHub Actions workflow.

Bot threads:
 ClickHouse#103541 (comment)
 ClickHouse#103541 (comment)
 ClickHouse#103541 (comment)
 ClickHouse#103541 (comment)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Bot review on PR ClickHouse#103541 (2026-05-03) flagged a bypass in the new
bugfix-validation gate: `has_unit` short-circuits to `return True`
before checking per-arch bugfix-validation outcomes. On a Bug Fix PR
that adds both a unit test and a functional/integration regression
test, all per-arch validation jobs can fail (`validated=false`
everywhere) and this hook would still pass — weakening the contract
this PR is trying to enforce ("at least one arch must reproduce +
validate" for FT/IT regressions).

Fix: only use the unit-test shortcut when there are NO new
functional/integration tests. If `has_ft` or `has_it` is true, still
require `any_bugfix_validation_passed`.
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The CI-report-link fallback in `new_tests_check.py` short-circuited the
per-arch Bugfix Validation contract for PRs that add new functional or
integration regression tests: if all per-arch jobs reported `validated=false`
but the PR body contained a link to a CI report, the hook still passed.

Restructure `check` to be mutually exclusive on the FT/IT-vs-rest axis so
neither shortcut can bypass per-arch validation:

  if has_ft or has_it:
      # must validate on at least one arch — no link / no unit fallback
      return any_bugfix_validation_passed()
  if has_unit:
      # unit-only PR — per-arch FT/IT machinery doesn't apply
      return True
  # no new tests — operator-supplied CI report link is acceptable
  return has_ci_report_link(pr_body)

Truth-table verified against all 32 (has_unit, has_ft, has_it,
validation_passed, ci_report_link) combinations: 32/32 match the expected
contract; both bypass concerns (#5 `has_unit`, #6 CI-report-link) closed.

Addresses bot review concern #6 on PR ClickHouse#103541.
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…roduce

When a per-arch Bugfix Validation job runs the regression test on master
HEAD and the test PASSES (i.e. the bug doesn't reproduce on this arch
because the bug is arch-specific — e.g. an SSE2-only crash that only
exists on amd64), the runner used to call `set_failed()` and the per-arch
job ended up with a red GitHub status. That is the wrong signal: the job
has no opinion on whether the bug exists on this arch — it has no bug
to invert.

Switch the no-bug-reproduces case to `set_status(Result.Status.SKIPPED)`:

  - `Result.is_ok` includes SKIPPED, so `complete_job` calls `sys.exit(0)`
    and GitHub gets a neutral status (no red).
  - The bugfix-validation post-hook in
    `ci/jobs/scripts/workflow_hooks/new_tests_check.py` uses
    `is_success` (strict — `OK`/`XFAIL` only), so a SKIPPED per-arch job
    does NOT count as a validation. The contract that "at least one
    per-arch job must reproduce the bug" is preserved: if every per-arch
    job ends up SKIPPED, the post-hook fails (correct: no validation
    occurred).

Applied to both `ci/jobs/functional_tests.py` (line ~775) and
`ci/jobs/integration_test_job.py` (line ~1062). Verified against the
real `Result` class with the SKIPPED-vs-FAIL semantics that
`is_ok`/`is_success` already encode.

Per @alexey-milovidov's directive on PR ClickHouse#103541
(ClickHouse#103541 (comment)):
"when bugfix validation can't reproduce the bug on this arch (i.e. test
PASSES on master HEAD), report SKIPPED instead of FAIL ... Yes, this is
the case. Please do it, it will be perfect!"

Co-Authored-By: Claude Opus 4.7 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…er-arch-design

Resolves merge conflict in .github/workflows/pull_request.yml. The YAML
was regenerated from praktika sources (ci/workflows/pull_request.py and
ci/defs/job_configs.py); the regeneration union'd the finish_workflow
needs list:

  - Kept the four per-arch bugfix validation jobs from this branch
    (bugfix_validation_functional_tests_amd64/aarch64 and
    bugfix_validation_integration_tests_amd64/aarch64).
  - Added libfuzzer_tests and sqlancer_amd_debug introduced on master.

All other ci/ files (ci/defs/defs.py, ci/defs/job_configs.py,
ci/jobs/functional_tests.py, ci/jobs/integration_test_job.py,
ci/jobs/scripts/workflow_hooks/filter_job.py,
ci/jobs/scripts/workflow_hooks/new_tests_check.py,
ci/workflows/pull_request.py) merged cleanly with git's text merge
and were left unchanged by the YAML regen step.

Per alexey-milovidov's directive on PR ClickHouse#103541:
ClickHouse#103541 (comment)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Addresses bot review on PR ClickHouse#103541 (2026-05-15T20:53:17Z) which observed
that infra-only failures could still leak into validation success in
`ci/jobs/integration_test_job.py`.

Before this commit, `has_error` was reset by the "all non-OK are infra"
clearing block immediately before the bugfix-validation inversion path
ran. The inversion path then:

  - flipped any surviving `FAIL` child to `OK` and called `R.set_success`
    (an infra-only run with a genuine `FAIL` could be silently counted
    as a validation);
  - rewrote `ERROR`-only outcomes as `SKIPPED` via the no-`has_failure`
    branch (an infrastructure failure became indistinguishable from
    "bug does not reproduce on this arch").

The fix captures `had_infra_or_error` BEFORE the clearing block and
skips the entire inversion path when it is true. If the resulting `R`
is still in a success-equivalent state (every surviving child was `OK`
or `SKIPPED`), it is forced to `ERROR` so the post-hook in
`new_tests_check.py` (which uses strict `is_success`) cannot count this
per-arch job as a validation.

Verified with a six-scenario simulation:

  1. Real bug reproduces on master HEAD          -> validation: YES (preserved)
  2. Bug does not reproduce on this arch         -> validation: NO  (preserved)
  3. Session-level error, no real test signal    -> validation: NO  (preserved, now reports ERROR instead of SKIPPED)
  4. Session-level error + genuine FAIL child    -> validation: NO  (FIXED — was YES before)
  5. INFRA-labeled child + master-pass child     -> validation: NO  (preserved, now reports ERROR instead of SKIPPED)
  6. Pure INFRA-only run                         -> validation: NO  (preserved, now reports ERROR instead of SKIPPED)

Scenario 4 is the regression the bot flagged: a session-level
infrastructure error coexisting with a genuine `FAIL` would otherwise
be flipped to `OK` and silently treated as a successful bug validation.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…o-repro path

Addresses Cursor Bugbot review on PR ClickHouse#103541 (2026-05-23T09:29:34Z):
ClickHouse#103541 (comment)

When a per-arch bugfix-validation functional-tests job determined that the
bug does not reproduce on this arch, only the child `test_result` was being
set to `SKIPPED`. The top-level `R` is constructed later via
`Result.create_from(results=results, ...)`, and `create_from` treats
`SKIPPED` child results as benign (`continue`) — defaulting `R.status` to
`OK`. The post-hook in `ci/jobs/scripts/workflow_hooks/new_tests_check.py`
then evaluates `R.is_success()` for each per-arch job (strict — only `OK`
or `XFAIL` count). For `R.status = OK`, `is_success()` returns `True`,
incorrectly counting the arch as having validated the bug. The contract
"at least one arch must reproduce the bug" was defeated whenever the test
passed on master HEAD on every arch.

Fix: track a `bugfix_validation_no_repro` flag in the bugfix-validation
inversion block and, after `R = Result.create_from(...)`, set
`R.set_status(Result.Status.SKIPPED)` directly. This mirrors what
`ci/jobs/integration_test_job.py` already does at the `R` level (per-arch
integration-tests job constructs `R` before the inversion and sets
`R.set_status(SKIPPED)` directly on no-repro).

Verified locally against the real `Result` class:
- child `SKIPPED` + plain `create_from` ⇒ `R.is_success() == True` (the
  bug Cursor flagged)
- child `SKIPPED` + post-create `R.set_status(SKIPPED)` ⇒
  `R.is_success() == False` (the fix)
- child `OK` (bug reproduced, FAIL inverted to OK) ⇒
  `R.is_success() == True` (unchanged — bug-repro path still counted)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
… post-hook tests

Two unresolved review comments from `clickhouse-gh[bot]` on commit
734ce0f of PR ClickHouse#103541:

1. `ci/defs/defs.py:377` — the status-table comment for the per-arch
   `Bugfix validation` jobs still described the old `FAIL` /
   `allow_failure=True` model. The current implementation propagates
   `SKIPPED` to the top-level `R` for the no-repro case, and the
   merge-blocking decision uses strict `is_success` (`OK`/`XFAIL` only).
   Update the comment to document `OK` / `SKIPPED` / `ERROR` and the
   strict-success contract.

2. `ci/jobs/scripts/workflow_hooks/new_tests_check.py:145` — no
   checked-in coverage for the `check` / `any_bugfix_validation_passed`
   truth table. Earlier iterations of this branch had two bypasses in
   `check` (the `has_unit` shortcut and the CI-report-link fallback)
   that let an unvalidated FT/IT regression test through — both were
   caught only by review. Add `ci/tests/test_new_tests_check.py`,
   pinning the contract: when a Bug-Fix PR adds new functional or
   integration regression tests, `check` returns True iff at least one
   per-arch `Bugfix validation` job is strict-success (`OK`/`XFAIL`).
   The unit-test presence shortcut and CI-report-link fallback apply
   ONLY when no FT/IT regression test was added.

Coverage:
- `any_bugfix_validation_passed`: `SKIPPED`/`FAIL`/`ERROR` per-arch
  results do NOT count, only `OK`/`XFAIL` do.
- `check`: FT/IT present + all per-arch `SKIPPED` / all `FAIL` -> reject.
- `check`: FT/IT present + at least one per-arch `OK`/`XFAIL` -> pass.
- `check`: FT plus a unit test -> still requires per-arch validation
  (the `has_unit` shortcut is FT/IT-disjoint).
- `check`: FT plus a CI-report link in PR body -> still requires per-arch
  validation (the CI-report-link fallback is FT/IT-disjoint).
- `check`: unit-only Bug-Fix PR -> pass without per-arch.
- `check`: no new tests + CI-report link -> pass; no link -> reject.
- `check`: not a Bug-Fix PR -> trivially passes.
- `check`: legacy monolithic `BUGFIX_VALIDATE_FT` job name still
  recognized by the post-hook for cached/historical workflows.

Both bot review threads:
ClickHouse#103541 (comment) (defs.py)
ClickHouse#103541 (comment) (new_tests_check.py)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The original draft of this per-arch Bugfix Validation Check redesign bundled the
`base/find_symbols.h` SSE2 `mm_is_in_execute` num_chars fix and three regression
tests (`04109_extract_key_value_pairs_null_quoting`,
`04110_trim_null_byte_in_haystack`, plus `gtest_find_symbols.cpp` extensions) as
a worked example to validate the per-arch mechanism end-to-end.

Master 6b3793b ("find_symbols.h: fix `\\0` false-match in SSE2 runtime-needle
path") has independently fixed the same SSE2 NUL-match defect, but using a
different mechanism (padding the unused needle slots in `mm_is_in_prepare`
instead of having `mm_is_in_execute` respect `num_chars`). Consequently the
bundled regression tests now pass on master HEAD on every arch — exactly the
no-repro shape that the per-arch validation gate is designed to reject — so
they cannot serve as the demonstration any longer, and the PR's own
`find_symbols.h` change is redundant defence-in-depth on top of master's fix.

This commit drops both: revert `base/find_symbols.h` and
`src/Common/tests/gtest_find_symbols.cpp` to master, delete the two stateless
regression tests. The PR is now CI infrastructure only and is being recategorized
as `CI Fix or Improvement` with `pr-bugfix` removed so it isn't subject to its
own validation gate. End-to-end demonstration of the per-arch validation will
happen on the next genuine per-arch bugfix PR.

Implements alexey-milovidov directive on PR ClickHouse#103541
(ClickHouse#103541 (comment)).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…per-arch-design

CI: split Bugfix Validation Check into per-arch + final aggregator
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 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.

5 participants