Skip to content

Tests for the clickhouse_json dialect (follow-up to #100412) - #104456

Merged
alexey-milovidov merged 11 commits into
ClickHouse:masterfrom
groeneai:groeneai/tests-for-clickhouse-json-dialect-clean
Aug 10, 2026
Merged

alexey-milovidov merged 11 commits into
ClickHouse:masterfrom
groeneai:groeneai/tests-for-clickhouse-json-dialect-clean

Conversation

@groeneai

@groeneai groeneai commented May 9, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #100412

Per @ alexey-milovidov's directive on #100412: "We should have tests for allow_experimental_json_ast_dialect and dialect = 'clickhouse_json'". The gate was since renamed to enable_json_ast_dialect by 3a5c031, and this test uses the current name.

This adds tests/queries/0_stateless/04057_dialect_clickhouse_json.sh, exercising both the client-side (ClientBase::parseQuery) and server-side (executeQueryImpl) parse paths added in #100412. Coverage:

  • Defaults: enable_json_ast_dialect is 0, dialect is clickhouse.
  • Gate off: the client-side TCP path and the server-side HTTP path both fail with SUPPORT_IS_DISABLED, and the message names the setting to enable.
  • Gate on: a hand-written JSON AST for SELECT 1 executes, and parseQueryToJSON round-trips (arithmetic, aliases, FROM numbers with WHERE/ORDER BY, GROUP BY with aggregates) return the same result as the SQL form.
  • Server-side path over HTTP: a round-trip body posted straight to the HTTP interface executes, while malformed JSON, an empty object and an unknown type are each rejected with BAD_ARGUMENTS. The client rejects those bodies itself in the client-side cases, so this is the only place the server's validation is asserted.
  • SET escape hatch: under the dialect a query starting with SET is still parsed as plain SQL, so the dialect can be switched back. Anything else is rejected, and is asserted not to have executed as SQL anyway.
  • Error paths, client-side: malformed JSON, empty {} and unknown type all raise BAD_ARGUMENTS, and each asserts the error came from the client's own parse, since the server emits the same code for the same body.

The test complements 04212_clickhouse_json_dialect_gate.sh and 04347_ast_json_http_dialect_trailing_semicolon.sh, which came in with #100412.

Two later commits drop a bare # Tags: no-fasttest that had suppressed this coverage in the Fast test job (verified against a Fast-test-shaped build first), and add the provenance assertions above. 50/50 runs green with randomized settings, 10/10 under the Fast test job's flag set.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

…son_ast_dialect`

Per @alexey-milovidov directive on ClickHouse#100412 (2026-05-07): "We should have
tests for `allow_experimental_json_ast_dialect` and `dialect = 'clickhouse_json'`".

Adds `tests/queries/0_stateless/04057_dialect_clickhouse_json.sh` covering:

* Default values of both settings.
* The experimental gate is checked at parse time, on both client-side
  TCP path (`ClientBase::parseQuery`) and server-side HTTP path
  (`executeQueryImpl`). With the gate off, both paths reject queries
  under `dialect = 'clickhouse_json'` with `SUPPORT_IS_DISABLED` and
  the error message points to the gate setting.
* Hand-written JSON-AST execution (`SELECT 1`).
* Round-trip via `parseQueryToJSON`: the JSON output of common SQL
  shapes (arithmetic, aliases, `FROM numbers` + `WHERE`/`ORDER BY`,
  `GROUP BY` + aggregates) is submitted under the dialect and produces
  the same result as the SQL form.
* Server-side escape hatch: a query starting with `SET` is parsed as
  plain SQL even under `dialect = 'clickhouse_json'`, so users can
  switch the dialect back without sending a JSON-AST `SET`.
* Error paths: malformed JSON, empty `{}`, and unknown `type` all
  raise `BAD_ARGUMENTS`.

Verified locally: 50/50 passes with full random settings.

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

groeneai commented May 9, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate (per TASK.md Phase 4 step 9):

# Question Status
a Deterministic repro? N/A — this PR adds tests for a new feature (#100412); it is not fixing a flaky failure. The "demonstration" is that the tests pass against the feature build (50/50) and would fail without it (the first assertion querying system.settings for allow_experimental_json_ast_dialect would return zero rows).
b Root cause explained? N/A — directive-driven test addition, not a bug fix.
c Fix matches root cause? Yes — tests cover exactly the two artifacts in @alexey-milovidov's directive: the experimental gate allow_experimental_json_ast_dialect and the dialect value dialect = 'clickhouse_json'.
d Test intent preserved? / New tests added? New tests added, no existing test modified. Coverage spans defaults, gate off (both TCP and HTTP parse paths), gate on (hand-written + round-trip via parseQueryToJSON, including arithmetic, aliases, FROM numbers + WHERE/ORDER BY, GROUP BY + aggregates), the server-side SET escape hatch, and three error paths (malformed JSON, empty {}, unknown type).
e Both directions demonstrated? Yes — passes 50/50 with the feature build (random settings on); first assertion would fail without the feature since the setting wouldn't be in system.settings.
f Fix is general, not a narrow patch? N/A — test addition. The test exercises both parse paths added in #100412 (ClientBase::parseQuery client-side and executeQueryImpl server-side), so it would catch a regression in either.

Session: cron:clickhouse-ci-task-worker:20260509-114500

@groeneai

groeneai commented May 9, 2026

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov @evillique — could you review this? Test-only follow-up to #100412 covering both the experimental gate allow_experimental_json_ast_dialect and the dialect value dialect = 'clickhouse_json' (client-side TCP and server-side HTTP parse paths, hand-written + round-trip JSON-AST, server-side SET escape hatch, three error paths). Expected to be cherry-picked into #100412 or merged after.

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

clickhouse-gh Bot commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4d00cda]

Summary: ✅


AI Review

Summary

This PR adds and tightens the stateless clickhouse_json dialect coverage around the renamed enable_json_ast_dialect gate, client/server parse-path attribution, plain-SQL rejection, and direct HTTP execution. I reviewed the current diff, the current code, the prior discussion, and the current CI state, and I did not find any remaining correctness or coverage gaps that justify a new inline review comment.

Final Verdict

✅ Approved

@clickhouse-gh clickhouse-gh Bot added the pr-ci label May 9, 2026
Per `clickhouse-gh[bot]` review on PR ClickHouse#104456:

> This script relies on several `grep ... | head ...` pipelines to assert
> specific error markers, but it never enables `pipefail`. Without
> `pipefail`, these pipelines return the status of `head`, so a missing
> match in `grep` still exits successfully and the test can pass while
> silently skipping the intended assertion. Please add `set -euo pipefail`
> near the top (or at least `set -o pipefail`) so missing matches fail
> the test deterministically.

Adds `set -euo pipefail` near the top of the script. The six pipelines
that submit a query expected to fail (gate-off, malformed JSON, empty
object, unknown AST type) are wrapped in `{ ... || true; } |` so `set -e`
does not exit on the expected non-zero status of `clickhouse-client` /
`clickhouse-curl`; the `|| true` only neutralises the leftmost producer's
exit code, while `pipefail` still surfaces a `grep` no-match as a
non-zero pipeline status (which then propagates via `set -e`).

Verified locally:

- `bash -n` syntax check passes.
- Stub-based simulation of the full script under `set -euo pipefail`
  produces the same output as the previous unguarded version (script
  exits 0, no early termination).
- Negative test confirmed that a `grep` with no match aborts the script
  via `set -e + pipefail` (the line after the failing pipeline is not
  executed).
- `tests/queries/shell_config.sh` is fully compatible with `set -u`
  thanks to its `${VAR:-}` expansions.

PR: ClickHouse#104456
Bot review: ClickHouse#104456 (comment) (approx.)
@groeneai

groeneai commented May 9, 2026

Copy link
Copy Markdown
Collaborator Author

Bot pipefail concern addressed in 79540a6.

The fix adds set -euo pipefail near the top of 04057_dialect_clickhouse_json.sh and wraps the six pipelines that submit a query expected to fail (gate-off, malformed JSON, empty object, unknown AST type) in { ... || true; } | grep ... | head .... The || true only neutralises the leftmost producer's expected non-zero exit, while pipefail still propagates a grep no-match as a non-zero pipeline status, which set -e then catches — so a missing assertion now aborts the test deterministically, exactly as you asked.

Verified locally:

  • bash -n syntax check passes.
  • Stub-based full-script simulation under set -euo pipefail produces the same output as the unguarded version (script exits 0, no early termination).
  • Negative test: replacing grep -oE "Code: ..." with grep -oE "WILL_NEVER_MATCH" aborts the script with exit 1 — the line after the failing pipeline does not execute. So pipefail is enforced.
  • tests/queries/shell_config.sh is compatible with set -u (it uses ${VAR:-} everywhere).

CI on #104456 is still expected to be RED until #100412 lands, by design — the test references settings (allow_experimental_json_ast_dialect) and a dialect value (clickhouse_json) that don't exist on master yet. Verified locally against #100412 head.

Session: cron:clickhouse-ci-task-worker:20260509-154500

@alexey-milovidov

Copy link
Copy Markdown
Member

I didn't ask for this; that comment was for myself. But we can merge this PR into the branch of #100412.

@alexey-milovidov
alexey-milovidov marked this pull request as draft May 9, 2026 20:18
@clickhouse-gh

clickhouse-gh Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Dear @groeneai, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 75a2d9f

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (11 checks, including the flaky check jobs) / 04057_dialect_clickhouse_json this draft PR's own new test, and it is deterministic rather than flaky: 67 of 67 runs failed with the same randomized settings and 77 of 77 with randomization disabled. The test exercises the clickhouse_json AST dialect, which exists only on the #100412 branch and not on master, so it cannot pass here. Contained: 69 hits over this one PR, 0 other PRs, 0 master runs in 30 days this PR's own test; the resolution is the cherry-pick into #100412 rather than a change to the test
Sync - CH Inc sync (private, not actionable)

Session id: cron:our-pr-ci-monitor:20260729-170000

The reviewer noted that with the gate on, the only HTTP request in
`04057_dialect_clickhouse_json.sh` was the plain-SQL `SET` escape hatch, so a
regression in the `clickhouse_json` branch of `executeQueryImpl` - in particular
in its `BAD_ARGUMENTS` validation - could leave the test green. The objection
was previously declined only because `dialect = 'clickhouse_json'` did not exist
on `master`; now that ClickHouse#100412 has been merged, the coverage can be added here.

Four gate-on HTTP requests are added: a round-trip `parseQueryToJSON` body that
must execute, and malformed JSON, an empty object and an unknown `type`, which
must each be rejected server-side with `BAD_ARGUMENTS`. The three error bodies
are rejected by the client's own parse in the existing cases, so they never
reached the server's validation before.

The whole test passes locally against `master` (6/6 runs with randomized
settings, plus the new cases 3/3).
@alexey-milovidov
alexey-milovidov marked this pull request as ready for review August 5, 2026 19:06
@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog and removed pr-ci labels Aug 5, 2026
…clickhouse_json`

The test proved that `SET` stays a plain-SQL escape hatch under
`dialect = 'clickhouse_json'`, but not the complementary invariant: that nothing
else does. A regression that broadened the escape hatch, or fell back from the
JSON-AST parser to the SQL parser, would have left the test green.

Two gate-on negative cases are added, one over `clickhouse-client` and one over
HTTP, each asserting both halves - that `SELECT 1` submitted as plain SQL is
rejected with `BAD_ARGUMENTS`, and that it did not execute as SQL anyway (no `1`
in the output).

Negative control: dropping `dialect = 'clickhouse_json'` from the client call - a
stand-in for a SQL-fallback regression - flips the output to `NO_ERROR` /
`SQL_FALLBACK`, so the assertions bite. The whole test passes 3/3 locally against
`master` with randomized settings.
@groeneai

groeneai commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — e75fc81

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Build (arm_release) / Post Hooks infra: build_profile_hook.py fails closed when the build-profile telemetry INSERT into the shared CI logs cluster is rejected (LogCluster query failed with code 500 / No connection to LogCluster). Not PR-caused and not gating: the Build (arm_release) check-run itself is green, only this CIDB row is red. #113409 (external, merged 2026-08-06T00:05:00Z) — arrives here with the next master merge, see below

This is the only failure on this head.

Fix-presence probe for the owner, by content rather than commit distance: this head's
ci/jobs/scripts/log_cluster.py is 11916 bytes with no data.seek(0) and one retries= site,
whereas current master is 12698 bytes with data.seek(0) and four of them (positive control
master, negative control the merge parent, both discriminating). So the merged fix is genuinely not
in this build. No re-run is needed to prove it works: master's own Build (arm_release) /
Post Hooks reds fell from 4 per hour at 01:00Z to 0 by 05:00Z today, and the next master merge
picks the fix up here.

Gates: (a) 175 check-runs, 0 queued/in_progress/pending/waiting; (b) Finish Workflow and
Config Workflow both success; (c) last completion 01:02:06Z, >20 min buffer; (d) the failure above
has an owner.

Session id: cron:our-pr-ci-monitor:20260806-050000

@alexey-milovidov alexey-milovidov self-assigned this Aug 9, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 9, 2026
groeneai and others added 3 commits August 9, 2026 19:41
The setting was renamed from `allow_experimental_json_ast_dialect` to
`enable_json_ast_dialect` by 3a5c031, after this branch was cut.
The old name is not an alias, so on current master
`SET allow_experimental_json_ast_dialect = 1` is `UNKNOWN_SETTING` and the
gate-off error message names the new setting instead of the old one.

The branch CI stayed green because it built a server from a base that
predates the rename. The merge queue tests the PR merged into current
master, where the assertion that the error message names the setting
found no match, `grep` exited 1, and `set -euo pipefail` aborted the
script before the remaining assertions ran: 20 of 20 runs failed in
`Stateless tests (amd_binary, flaky check)` with `return code: 1`.

Renames the 18 uses in the `.sh` and the 2 in the `.reference`. The two
`system.settings` rows also swap, because the assertion orders by name
and `dialect` sorts before `enable_json_ast_dialect` where it sorted
after `allow_experimental_json_ast_dialect`. No assertion is removed,
weakened or added, and no pipeline shape changes.

Also drops the header's claim that a non-zero pipeline status merely
produces a reference mismatch. Under `set -e` with `pipefail` it
terminates the script, which is why this failure surfaced as an abort
rather than a diff.

Co-Authored-By: Claude Fable 5 <[email protected]>
The test carried a bare `# Tags: no-fasttest` with no reason. clickhouse-test
returns FailureReason.FAST_ONLY for such a test when `--fast-tests-only` is
passed, so the Fast test job never executed it: CIDB over 20 days shows
`Fast test` SKIPPED 9 and `Fast test (arm_darwin)` SKIPPED 2, with no OK or
FAIL row in either. The tag arrived in this PR's own first commit, so the
coverage this PR adds was suppressed in the job that gates nearly every PR.

Measured rather than assumed before removing it. Built a Fast-test-shaped
binary with the flags from ci/jobs/fast_test.py (notably ENABLE_LIBRARIES=0,
which is the usual reason a test needs this tag; the resulting server reports
USE_PARQUET, USE_ORC, USE_AVRO, USE_ARROW and USE_HDFS all empty) and ran the
test against it under the job's own flag set. With the tag present the verdict
is SKIPPED; with it removed the verdict is OK, ten times out of ten, and a
direct run of the script matches the reference byte for byte over all 53 lines
with empty stderr. The test only uses clickhouse-client, the HTTP interface and
shell builtins, so nothing it touches depends on the disabled libraries.

The 50x flaky-check equivalent still passes 50 of 50 on the ordinary debug
build, and eight concurrent copies pass, so no parallelism tag is needed.
…tokens

The five client-side cases retained only tokens the server emits identically for
the same input, so they did not observe which path produced them. The client
forwards the original JSON text (pinOutboundDialectForJSONDialect) and the wire
carries query text, so the server re-parses the same bytes through the same
IAST::createFromJSON and throws the same codes. A regression in which the client
stopped validating and simply forwarded the body would have printed byte-identical
output. The file's own HTTP arms already assert those exact tokens, which shows
the client-side expected lines were satisfiable by the server alone.

Each of the five cases now also reports whether the error came from the client or
from the server, using the prefix Client::processError prints only for a server
exception. The check is written as an absence test so it does not hard-code the
version string. Every previously expected line is unchanged; this only adds one
line per case.

Measured with a temporary client mutation that skips validation for bodies that
still look like JSON on the wire, which is the subset where the server produces
identical tokens: the pre-change file stays green with byte-identical output,
confirming those assertions were blind, and the post-change file fails with
FROM_SERVER where from_client is expected. Also 50 of 50 randomized runs green,
10 of 10 green under the Fast test job flag set on a build configured with
ENABLE_LIBRARIES=0, byte-exact output against the reference with empty stderr,
and 8 concurrent copies green.

The assertion uses a here-string rather than a pipe into grep: with pipefail, a
pipe into grep -q lets the writer take SIGPIPE once the output exceeds the pipe
buffer, and the condition then silently takes the wrong branch. Measured for a
matching input at 64 KiB and above.
@groeneai

groeneai commented Aug 9, 2026

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

Three review rounds. Final round: 0 blockers, 0 majors, 0 findings from the second model.

Fixed during review, both raised and resolved before this update:

❌ The test carried a bare # Tags: no-fasttest with no reason, added by this PR's own first commit. clickhouse-test therefore skipped it whenever --fast-tests-only was passed, so the coverage this PR adds never ran in the job that gates nearly every PR (CIDB over 20 days: Fast test SKIPPED 9, Fast test (arm_darwin) SKIPPED 2, no OK or FAIL row). Removed after measuring against a build configured with ENABLE_LIBRARIES=0, rather than on the strength of sibling tests alone: with the tag the verdict is SKIPPED, without it [ OK ] 10 times out of 10.

❌ The five client-side error cases asserted only tokens the server emits identically for the same input, so they did not observe which parse path produced them. The client forwards the original JSON text and the wire carries query text, so the server re-parses the same bytes through the same IAST::createFromJSON and throws the same code. A regression in which the client stopped validating and simply forwarded the body would have printed byte-identical output. Each case now also reports client or server origin. Verified in both directions with a temporary client mutation limited to bodies still shaped as JSON on the wire: the pre-change file stayed green with byte-identical output, which is what proves those assertions were blind, and the post-change file fails where the origin flips.

⚠️ The prescribed form for that assertion, echo "$OUT" | grep -q PAT && ... || ..., is unsound under pipefail: grep -q exits at the first match, so for matching input above the pipe buffer the writer takes SIGPIPE and the condition takes the wrong branch, precisely the direction the assertion exists to catch. Measured wrong at 64 KiB and above, correct at 1 KB. Shipped as a here-string, which has no writer to signal.

💡 Noted, not changed: the file keeps set -euo pipefail with grep | head pipelines, so a genuine future assertion failure surfaces as a non-zero exit rather than a reference diff. That costs diagnostics quality on a real failure and cannot produce a false green; three restructurings were measured and each introduced a new defect.

Validation: 50/50 runs green with randomized settings against 20/20 failures in the merge queue, 10/10 under the Fast test job's own flag set, byte-exact output with empty stderr, 8 concurrent copies green.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, 100 percent, no randomization needed. tests/clickhouse-test 04057_dialect_clickhouse_json against a server built from this branch merged with master fails with 1 error, stdout truncated at === Error message mentions the setting to enable === with no line under it. Identical to the merge-queue bashlog.
b Root cause explained? 3a5c031c293aabb renamed allow_experimental_json_ast_dialect to enable_json_ast_dialect after this branch was cut, with no alias (SET allow_experimental_json_ast_dialect = 1 is Code: 115 UNKNOWN_SETTING). The assertion that the gate-off error names the setting greps for the old token, finds nothing, grep exits 1, and set -euo pipefail terminates the script, so the remaining assertions never run. The branch CI was green because its base predates the rename; the merge queue tests the PR merged into current master.
c Fix matches root cause? Yes. The test named a setting that no longer exists, so it now names the current one. No pipeline shape, bound or dataset changed. The second commit removes the unjustified no-fasttest tag, which was suppressing this PR's own coverage in the Fast test job. The third commit addresses a separate defect in the test itself: the five client-side cases asserted only tokens the server emits identically for the same input, so they did not observe which parse path produced them. Each now also reports client or server origin, using the prefix the client prints only for a server exception.
d Test intent preserved / new tests added? Preserved and strengthened, never weakened. All 9 grep assertions and every previously expected reference line are retained byte-identical; the setting token changes and 5 provenance lines are added. The test is itself the deliverable of this PR, so no separate regression test applies. Coverage is strictly widened three ways: the test now runs in the Fast test job, and the client-side cases now pin the parse path rather than accepting output the server alone could produce.
e Both directions demonstrated? Yes, same binary (Build ID 5664f75a886d274ef6f2e998caf6ba36ef0e531a, asserted equal to SELECT lower(buildId()) on the server). Without the fix: 1 error, output truncated. With the fix: [ OK ], and a direct script run diffs byte-identical against the reference. Then 50 of 50 runs green with randomized settings, against 20 of 20 failures in CI. For the tag removal, both directions on a Fast-test-shaped binary (Build ID af6eee6aee4b9677523290ac7d8dc47a30a49032, likewise asserted): tag present gives [ SKIPPED ] Reason: running fast tests only, tag removed gives [ OK ] 10 of 10 under the job's own flag set. For the provenance assertions, both directions against a temporary client mutation that skips validation for bodies still shaped as JSON on the wire, the subset where the server produces identical tokens: the pre-change file stays green with output byte-identical to its baseline, which is what proves those assertions were blind, and the post-change file fails with FROM_SERVER where from_client is expected. The mutation was reverted and the binary rebuilt back to the same Build ID before the final measurements.
f Fix is general across code paths? Yes. grep -rn allow_experimental_json_ast_dialect src/ tests/ programs/ utils/ returns 0 after the change (positive control: the new name is present in 3 places in src/Core/Settings.cpp). Both transports the test covers, client-side TCP and server-side HTTP, were renamed. no-fasttest is likewise gone from both of this PR's files (positive control: 2157 other stateless tests still carry it), and no other suppression tag was introduced. 6 files under docs/ still carry the old setting name, but that is pre-existing on master (the rename commit missed them) and outside this test-only PR. The provenance assertion was added to all five client-side cases, not only the ones a mutation happens to reach, so the two transports stay symmetric: the client-side cases pin the client path, and the HTTP cases already exercise the server path directly.
g Fix generalizes across inputs? Verified the renamed setting is accepted in every form the test uses: SET, client flag --enable_json_ast_dialect=1, and HTTP query parameter, all returning ok; and the gate-off error message names it. Across build shapes, the test passes on both the ordinary debug build and the Fast-test build, whose system.build_options reports USE_PARQUET, USE_ORC, USE_AVRO, USE_ARROW and USE_HDFS all empty, so no disabled library is reachable from it.
h Backward compatible? N/A, test-only change. No setting default, no serialization format, no SettingsChangesHistory.cpp touch. The rename it follows was made by 3a5c031c293aabb while the setting was experimental and unreleased.
i Invariants and contracts preserved? Yes, and re-asserted: the gate still gates (off gives Code: 344 SUPPORT_IS_DISABLED, on executes a JSON AST returning 1). The .reference rows also had to be reordered, because the assertion orders by name and dialect now sorts before enable_json_ast_dialect. Negative control: restoring the old row order while keeping the rename makes the test FAIL, so the reorder is load-bearing rather than cosmetic. Dropping the tag preserves the test's own contracts: it is parallel-safe (all state is per-session through CLICKHOUSE_DATABASE), and 8 concurrent copies pass, re-measured after the provenance edit; its file mode stays 100755; and it writes nothing outside the server. The provenance assertion is written as a here-string rather than a pipe into grep -q, because with pipefail a pipe lets the writer take SIGPIPE once the output exceeds the pipe buffer and the condition then takes the wrong branch, measured wrong at 64 KiB and above for matching input. The here-string form has no pipe, so it cannot fail that way, and a negative control confirms it never reports a server origin for client-side output.

Session id: cron:clickhouse-impl-slot-4:20260809-224200

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @alexey-milovidov, the merge-queue blocker is fixed, so this is ready to re-queue. The test named allow_experimental_json_ast_dialect, which 3a5c031 renamed to enable_json_ast_dialect after this branch was cut, so on current master the assertion that the error message names the setting matched nothing and pipefail aborted the script: 20 of 20 failures in the queue against a green branch run built from the older base. It now uses the current name, 50 of 50 runs green with randomized settings.

…on its plain-SQL arm

The gate-off message exists as two independent literals, in ClientBase::parseQuery and in
executeQueryImpl. Only the client-side arm asserted that it names enable_json_ast_dialect, so
a rename touching just the server copy left the HTTP arm green. That is the same drift class
that turned this test red 20 of 20 in the merge queue when the setting was renamed from
allow_experimental_json_ast_dialect, so the HTTP arm now captures the body and asserts the
name too.

The gate-on plain-SQL client arm asserted only that the request was rejected and did not
execute as SQL. The server emits the same BAD_ARGUMENTS for the same body, so if the client
stopped enforcing JSON-only input and forwarded the raw text still pinned to clickhouse_json,
that arm stayed green while the client path it names was bypassed. It now carries the same
"Received exception from server" absence check its five sibling client-side cases use.

Both new assertions were verified to redden, each against a separate mutation of the code
path it covers, with the pre-change file staying green in both arms (so the old assertions
were provably blind) and each mutation reddening only its own line. Mutations reverted, source
re-diffed identical, and the mutation symbols confirmed absent from the final binary. 50/50
randomized runs OK, 8 concurrent copies OK, direct run byte-exact with no stderr.
@groeneai

Copy link
Copy Markdown
Collaborator Author

Pushed 4d00cda after your approval, which outdates it: two additive assertions from the AI reviewer, test files only.

The gate-off message exists as two separate literals (client and server), and only the client arm asserted it names the setting, so a rename touching just the server copy would not have reddened. That is exactly what broke this test in the queue, so the HTTP arm now asserts the name too. The other arm gained the provenance check its five siblings already had. Each was verified to redden against a mutation of the path it covers, with the pre-change file green in both.

Ready to re-queue.

@clickhouse-gh

clickhouse-gh Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 4d00cda5d with master f70042f01 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 690.92 MiB 687.89 MiB -3.03 MiB (-0.44%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 4d00cda

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
- no failed checks on this commit -

CI is fully finished on this head with zero failing checks. Config Workflow, Fast test,
Fast test (arm_darwin) and Finish Workflow are all success, and the check-suite conclusion
is success. CIDB records 111148 test rows across 60 checks on this commit with 0
FAIL/ERROR.

The four flaky check jobs that were the merge-queue blocker on the earlier heads all pass here:

Job Result Duration
Stateless tests (amd_asan_ubsan, flaky check) OK 1464 s
Stateless tests (amd_debug, flaky check) OK 1054 s
Stateless tests (amd_msan, flaky check) OK 913 s
Stateless tests (amd_tsan, flaky check) OK 775 s

On the reduced job matrix: this PR changes only two files, both under
tests/queries/0_stateless/, so praktika deliberately did not schedule 134 of the 175 jobs. Each
one records an explicit reason (Not affected by the changed files and not required x74,
no build-affecting changes; coverage would be identical to master x25 which is the whole
llvm_coverage family, only test files changed ... none of the changed tests apply x17,
not labeled with 'pr-performance' x6, not a bug-fix PR x5, reused from cache x3, and four
smaller reasons). None is an unexplained drop, and the jobs that do exercise the changed test
(Fast test, the four flaky checks, 10 Stress test flavours and 13 Stateless tests flavours)
all ran and passed.

Session id: cron:our-pr-ci-monitor:20260810-063000

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 10, 2026
Merged via the queue into ClickHouse:master with commit 17a93b0 Aug 10, 2026
180 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 10, 2026
@groeneai groeneai added the groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding label Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants