Skip to content

tests: run the ClickHouse core SQL tests through the HTTP and TCP clients - #747

Merged
ccoltx merged 3 commits into
mainfrom
polyglot/core-sql-tests
Nov 19, 2026
Merged

ccoltx merged 3 commits into
mainfrom
polyglot/core-sql-tests

Conversation

@polyglotAI-bot

@polyglotAI-bot polyglotAI-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This PR adds tests/clickhouse-test-runner/: a harness that runs the ClickHouse core SQL tests (tests/queries/0_stateless) through both clients of this repository, and a workflow that runs them in CI.

  • The harness is a small .NET console program that imitates clickhouse-client well enough for the upstream runner (tests/clickhouse-test) to drive it without changes: the same flags, stdin and --query behavior, test hints, echo, and the extract-from-config shortcut.
  • It runs each test over one of two protocols (CLICKHOUSE_TEST_RUNNER_PROTOCOL):
    • http: ClickHouse.Driver through ADO.NET (ClickHouseConnection, ClickHouseCommand, ClickHouseDataReader.GetValue; RowBinary over HTTP). One session id keeps the session (SET, USE, temporary tables) for the whole invocation.
    • tcp: ClickHouse.Driver.Tcp (ClickHouseTcpClient.OpenSessionAsync, IClickHouseTcpSession.StreamAsync, IColumn.GetValue; Native). One session is one pinned connection.
  • The command-line settings go with each command, not as SET statements. Values go through the normal .NET type mapping of each client, and the column types come from the reader. A type-directed renderer then writes the values as TabSeparated text. Thus the upstream .reference files are the oracle for the type parsing and decoding of both clients. The program does not ask the server to format the text.
  • It is a port of the Go harness (test: run ClickHouse core SQL tests through clickhouse-go clickhouse-go#2141): the same design, scripts, allowlist format and triage rules. One addition: a <test> # known=<protocol>: [<id>] line, for a test that fails over one protocol only. It runs over the other protocol, so that a bug of one client does not take passing tests from the CI of the other client (311 such lines).
  • The shim is a separate console project that references the driver projects. It is not in ClickHouse.Driver.sln and not in the NuGet packages. No file of the clients changes.

Tracking issue: ClickHouse/integrations#812

Contents

  • The shim and its tests (ClickHouse.Driver.TestRunner.Tests, NUnit): unit tests ported from the Go split, hint and render tests, and live tests that compare the rendering with the server's own FORMAT TSV output for many expressions, over both protocols. 457 tests.
  • allowlist.txt: the tests that run, and the known failures in groups. Each client group header gives the cause, a reproduction, Issue: not filed yet (or the issue), and the protocols.
  • clickhouse-version: the server version and the upstream tests are pinned together (26.10.4.207, tag v26.10.4.207-stable, as in the Go harness).
  • scripts/: fetch-upstream.sh (sparse shallow checkout; also generates ErrorCodes.g.cs with gen-error-codes.sh, no .NET needed), build.sh, run-upstream-tests.sh (protocol, shards, KNOWN_FAILURES=<group>, version check, missing-test warning, optional RETRY_FAILED), run-with-real-client.sh (the same tests through the real clickhouse-client, for triage), selectors.sh, pinned-version.sh.
  • .github/workflows/upstream-sql-tests.yml: nightly, manual (input clickhouse_version), on pushes to main and on pull requests that change the harness or the workflow. Jobs: build (the shim once, and a check that the committed ErrorCodes.g.cs matches the pinned version), harness-tests (unit and live tests of the shim), and upstream-sql-tests = {http, tcp} × 8 shards at -j 4. The server is the stock image of the pinned version with CLICKHOUSE_SKIP_USER_SETUP=1 and the host name of the runner. permissions: contents: read. Artifacts on failure (runner output with the diffs, shim log, server error log, .stdout / .stderr files).
  • README.md (local runs, how the shim imitates clickhouse-client per protocol, the allowlist format, how to grow it, CI, the version bump), AGENTS.md (triage rules, environment causes), CLAUDE.md (@AGENTS.md), and one pointer row in the root AGENTS.md.

Results (server 26.10.4.207)

  • Sweep of all 12,961 .sql / .sql.j2 tests at -j 6, 926 skipped by the runner:
    • http: 10,076 OK, 1,959 FAIL; 1,472 s.
    • tcp: 10,481 OK, 1,554 FAIL; 1,654 s.
  • Every failure has a cause (no [untriaged] group). Per protocol (http / tcp): environment 1,213 / 1,050, client 169 / 97, shim 420 / 309; 157 / 98 failures were fixed in the shim.
  • Allowlist: http runs 10,073 tests, tcp runs 10,414 tests: 10,010 over both, 155 only=tcp, 1 only=http, 249 known=http, 62 known=tcp.
    • only=tcp (environment over HTTP): mostly WITH TOTALS and extremes (the HTTP RowBinary output has no totals or extremes block), and tests that drop the current database (each later HTTP request fails).
    • only=http: one EXPLAIN test that reads compressed bytes only over native, also through the real clickhouse-client.
  • Known failures: 655 tests (http 589, tcp 406) in 36 groups: 29 client groups (235 tests) and 7 shim groups.
  • Three checks of the allowlist per protocol, each on a fresh server at -j 6:
    • http: 10,073 OK and 0 FAIL each time (863–899 s); the 593 HTTP known failures failed each time.
    • tcp: 10,414 OK and 0 FAIL each time (764–788 s); the 406 TCP known failures failed each time.
    • One known failure can pass without a fix: 03024 reads generateRandom() without a structure, so over TCP it fails only when the server picks a tuple of more than 7 elements (its group header says so).
  • CI: 8 shards per protocol, about 1,300 tests each. With 4 CPUs at -j 4, shard 1 took 143 s (http) and 128 s (tcp). No RETRY_FAILED: no known client bug makes random tests fail.
  • Environment causes (not in the allowlist; the real clickhouse-client also fails these tests on the same server): no cluster / ZooKeeper / S3, upstream CI server configuration, features of clickhouse-client itself. AGENTS.md lists them. 212 tests whose result depends on the server load (EXPLAIN PIPELINE widths, thread and stream counts, memory under parallel load) are left out on purpose, as in the other harnesses.
  • Server finding (not a client bug): with max_query_size = 18446744073709551615, every HTTP query fails with Code: 62 Empty query (native works).

Client bugs found

These are not fixed in this PR, and no issues are filed (except where named). The maintainers decide when to file and fix them.

The reproductions use only the public API: ClickHouseConnection + ClickHouseCommand.ExecuteReaderAsync + GetValue / GetDataTypeName (http), and ClickHouseTcpClient.OpenSessionAsync + StreamAsync + IColumn.GetValue (tcp). "→" is the actual result, "want" is the server's TabSeparated output. The test counts are per protocol (http / tcp).

Wrong values, no error:

  • [http-datetime64-precision] (http 32): SELECT toDateTime64('2023-12-23 20:37:33.035123456', 9, 'UTC') → DateTime with 100 ns ticks: .0351234; want .035123456. The count is cut toward 1970, so before 1970 the value is later (1900 .123456789 → .1234568). TCP gives the exact count.
  • [http-time64-precision] (http 5): SELECT toTime64('00:00:01.123456789', 9) → TimeSpan 00:00:01.1234567; want .123456789.
  • [http-time64-double-rounding] (http 2): SELECT toTime64('00:45:30.123456', 6) → 00:45:30.1234559 (the value goes through double); want .123456.
  • [http-dt64-overflow-wraps] (http 2): SELECT reinterpret(toInt64(9223372036854775616), 'DateTime64(3)') → 1969-12-31 23:59:59.808 (unchecked multiply in MathUtils.ShiftDecimalPlaces); want 9999-12-31 23:59:59.616 (the server clamps).
  • [http-empty-tuple-rows] (http 16): SELECT tuple() FROM numbers(3) → 0 rows (RowBinary has no bytes for such a row, so the reader stops at the end of the bytes); want 3 rows (). TCP is right. Related: ClickHouseDataReader silently returns zero rows when every column is zero-width (Tuple()) #570 (closed, not planned).
  • [type-json-shared-path] (http 2): SELECT '{"a": 1}'::JSON(SHARED a UInt64) → {"a":0} and 7 rows for 1 (the reader is out of sync); two SHARED paths → ArgumentException ... Key: SHARED; want {"a":1}, 1 row. TCP is right.
  • [session-timezone] (tcp 15): SET session_timezone = 'Asia/Tokyo'; SELECT toDateTime('2020-01-01 00:00:00') → zone UTC (the zone of the handshake; also for a SETTINGS session_timezone clause; only ClickHouseTcpQueryOptions.Settings counts); want 2020-01-01 00:00:00 in Asia/Tokyo. The instant is right.
  • [tz-sub-minute-offset] (tcp 5): SELECT toDateTime('1969-12-31 23:15:30', 'Africa/Monrovia') → offset -00:44 (TimeZoneInfo has whole minutes): 23:16:00; want 23:15:30.
  • [http-tz-database-differs] (http 1): SELECT toDateTime('1930-06-15 12:00:34', 'Europe/Amsterdam') → offset +01:00 (the NodaTime TZDB has the Brussels rules); want +00:19:32 (server).
  • [query-text-not-utf8] (http 2 / tcp 2; a limit of the API): the query is a .NET string, so SELECT hex('<byte 0xFF>') → EFBFBD; want FF. There is no API for a query as bytes.
  • [tcp-json-as-string-to-shards] (tcp 1; possibly a server cause): SELECT DISTINCT toUnixTimestamp64Nano(json.a) FROM (SELECT materialize('{"a":1698543000}'::JSON(a DateTime64(9, 'Europe/Berlin'))) AS json FROM remote('127.0.0.{1,2}', system.one)) → 2 rows; want 1 row. The client's default output_format_native_write_json_as_string = 1 reaches the shards, and clickhouse-client with that setting gives the same 2 rows.

Session and protocol (tcp):

  • [tcp-session-lost-on-error] (tcp 14): CREATE TEMPORARY TABLE t (x UInt8); INSERT INTO t VALUES (1); SELECT throwIf(1); SELECT * FROM t → after the server exception, session.IsOpen is false: t is gone (UNKNOWN_TABLE) and the SETs are lost. In ClickHouseTcpConnection.QueryAsync, an Exception packet leaves reusable = false; want the session to stay, as in clickhouse-client.
  • [tcp-insert-needs-client-data] (tcp 7): INSERT INTO t VALUES (no data), INSERT INTO t SELECT * FROM input('x UInt8') FORMAT TSV <inline data>, INSERT ... FROM INFILE → no result until ReadTimeout, then the connection is lost; want NO_DATA_TO_INSERT, or the inline data sent (as clickhouse-client does).
  • [tcp-empty-result-no-header] (tcp 4): SELECT 1 AS a, 'x' AS b WHERE 0 → StreamAsync / QueryAsync give no block, so no column names or types (a TSVWithNames header is lost); want the header block. HTTP is right.
  • [binary-encoded-types] (tcp 3; http: no test): SET output_format_native_encode_types_in_binary_format = 1; SELECT 1 → ReadTimeout, or Column ... uses custom serialization, which this client does not support, and the connection closes. Over HTTP, SET output_format_binary_encode_types_in_binary_format = 1; SELECT 2 AS a, 'b' AS b → ArgumentException: Unknown type: (empty name). Want the values, or a clear "not supported" error.

Types that a client cannot read:

Type names and parameters:

  • [http-type-name-normalized] (http 6): GetDataTypeName of CAST((1, 'a'), 'Tuple(a UInt8, b String)') → Tuple(UInt8,String), of toDecimal32(1, 2) → Decimal32(2), of a JSON column → Json; want the server's type name (Tuple(a UInt8, b String), Decimal(9, 2), JSON).
  • [param-conflicting-type-hints] (http 1 / tcp 1): SELECT {db:String} AS d, count() FROM {db:Identifier}.one with db=system → ArgumentException: Parameter 'db' has conflicting type hints: 'String' and 'Identifier'; want the row system, 1. HTTP checks every statement, also one without parameters.
  • [http-map-literal-as-parameter] (http 1): INSERT INTO m VALUES (1, {1 : 'a'}), (2, {1 : 'b'}) → ArgumentException: Parameter '1' has conflicting type hints; want both rows inserted. TCP is right.

Shim gaps (groups marked shim)

  • [shim-output-format] (http 285 / tcp 289): output formats other than the TabSeparated family and Null.
  • [shim-render-json] (http 109): the HTTP JsonObject value has no types of the paths, so the shim cannot write the server's JSON text.
  • [shim-kql-split] (http 11 / tcp 13): KQL statements are split by the SQL rules.
  • [shim-http-string-bytes] (http 8): over HTTP the shim reads String as .NET strings, so bytes that are not UTF-8 are lost; reading bytes would lose the Dynamic / Variant types.
  • [shim-render-dynamic] (http 6): HTTP Dynamic values of DateTime types come without their type.
  • [shim-interval-output-format] (tcp 6): interval_output_format = 'kusto'.
  • [shim-client-parse-error] (http 1 / tcp 1): the end of a statement that the client parser of clickhouse-client rejects.

Run locally

docker run -d --name clickhouse -p 8123:8123 -p 9000:9000 --hostname "$(hostname)" -e CLICKHOUSE_SKIP_USER_SETUP=1 \
  "clickhouse/clickhouse-server:$(tests/clickhouse-test-runner/scripts/pinned-version.sh)"
tests/clickhouse-test-runner/scripts/fetch-upstream.sh
tests/clickhouse-test-runner/scripts/run-upstream-tests.sh -j 8                                   # http
CLICKHOUSE_TEST_RUNNER_PROTOCOL=tcp tests/clickhouse-test-runner/scripts/run-upstream-tests.sh -j 8 # tcp

Details (Python jinja2, tzdata-legacy, one test, one group of known failures) are in tests/clickhouse-test-runner/README.md.

Checklist

  • Unit and integration tests covering the common scenarios were added (the shim's unit and live tests; the harness itself is a test suite)
  • A human-readable description of the changes was provided to include in CHANGELOG — no changelog fragment: no behavior of the clients changes, and test-infrastructure changes have no fragment (dotnet run scripts/changelog.cs -- --check passes)

Checks: dotnet build ClickHouse.Driver.sln -c Release with 0 errors; the shim tests (unit + live) 457 / 457; zizmor 1.29.0 (repository configuration, also --persona pedantic on the new workflow): no findings; actionlint and shellcheck: clean.

🤖 Generated with Claude Code


Note

Low Risk
Test and CI infrastructure only; no production client API or runtime behavior changes, though the new workflow adds long-running Docker-based jobs to the pipeline.

Overview
Adds tests/clickhouse-test-runner/, a clickhouse-client-compatible shim that runs ClickHouse’s core stateless SQL tests through ClickHouse.Driver (HTTP/ADO.NET) and ClickHouse.Driver.Tcp (native), re-rendering results as TabSeparated so upstream .reference files validate client decoding rather than server formatting.

The harness includes build/fetch/run scripts, a pinned server version (clickhouse-version + generated ErrorCodes.g.cs), an allowlist with grouped known failures, 457 NUnit unit/live tests for the shim, and AGENTS.md triage rules. Root AGENTS.md now points agents at the harness docs.

.github/workflows/upstream-sql-tests.yml runs nightly, on main/PR path filters, and via workflow_dispatch: one build job (shim artifact + error-code check), harness-tests against Docker ClickHouse, then upstream-sql-tests as http/tcp × 8 shards with failure artifacts.

Reviewed by Cursor Bugbot for commit 9bbfd7b. Bugbot is set up for automated code reviews on this repo. Configure here.

…ents

Add tests/clickhouse-test-runner/: a .NET console program that imitates
clickhouse-client for the upstream runner (tests/clickhouse-test), so that
the ClickHouse core SQL tests (tests/queries/0_stateless) run through
ClickHouse.Driver (ADO.NET, RowBinary over HTTP) and ClickHouse.Driver.Tcp
(Native). A type-directed renderer writes the values that each client reads
as TabSeparated text, so the upstream .reference files check the type
parsing and decoding of both clients.

- allowlist.txt: the tests that run per protocol, the only=<protocol> and
  known=<protocol> lines, and the known failures in 36 groups (29 client,
  7 shim), each with its cause and a reproduction.
- clickhouse-version: the server version and the upstream tests are
  pinned together (26.10.4.207).
- scripts/: fetch the upstream tests, generate the error-code table, build
  the shim, run the tests (protocol, shards, known failures), and run the
  same tests through the real clickhouse-client for triage.
- .github/workflows/upstream-sql-tests.yml: nightly, manual, and on changes
  of the harness: build, the shim tests, and {http, tcp} x 8 shards.
- README.md, AGENTS.md, CLAUDE.md, and a pointer in the root AGENTS.md.

No file of the clients changes. The port follows the Go harness
(ClickHouse/clickhouse-go#2141).

Tracking issue: ClickHouse/integrations#812

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

AI review gate — AI review passed

Clean review from: Cursor Bugbot.

@polyglotAI-bot
polyglotAI-bot marked this pull request as ready for review November 19, 2026 11:49
Copilot AI balanced review requested due to automatic review settings November 19, 2026 11:49

Copilot AI left a comment

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.

🟡 Changes recommended

Unresolved SQL parsing and output-formatting defects can reject valid queries or produce false failures, while test isolation, retry handling, and missing failure artifacts undermine CI reliability.

6 open issues
What changed in this PR

Adds a standalone harness that runs ClickHouse’s upstream SQL tests through the HTTP and TCP clients. It checks client-decoded values against upstream reference output without changing the client libraries or NuGet package.

Changes:

  • Adds a clickhouse-client shim with session handling, SQL splitting, test hints, and TabSeparated output.
  • Adds harness tests, version-pinned upstream scripts, and failure-triage documentation.
  • Adds scheduled and path-filtered CI runs across both protocols and eight shards each.
File Description
tests/​clickhouse-test-runner/​scripts/​selectors.sh Builds exact test-selection expressions.
tests/​clickhouse-test-runner/​scripts/​run-with-real-client.sh Runs reference checks through the real client.
tests/​clickhouse-test-runner/​scripts/​run-upstream-tests.sh Selects, shards, and runs upstream tests.
tests/​clickhouse-test-runner/​scripts/​pinned-version.sh Reads and validates the server version.
tests/​clickhouse-test-runner/​scripts/​gen-error-codes.sh Generates the upstream error-code table.
tests/​clickhouse-test-runner/​scripts/​fetch-upstream.sh Fetches matching upstream tests and error codes.
tests/​clickhouse-test-runner/​scripts/​build.sh Publishes the shim and command wrappers.
tests/​clickhouse-test-runner/​README.md Documents usage, supported behavior, and CI.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​Utf8Buffer.cs Buffers output bytes and escaped values.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​TestHint.cs Parses expected-error and echo hints.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​TcpBackend.cs Executes tests through pinned TCP sessions.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​Statements.cs Splits SQL and identifies statement components.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​ServerError.cs Normalizes errors from both clients.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​Runner.cs Coordinates statements, sessions, hints, and output.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​ResultWriter.cs Writes result headers and rows.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​Program.cs Provides the shim entry point and exit handling.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​OutputSettings.cs Models settings that affect rendered output.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​OutputFormat.cs Detects and selects supported output formats.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​Options.cs Parses client-compatible command-line options.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​InvocationLog.cs Records diagnostic logs with password redaction.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​IBackend.cs Defines the shared backend contract.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​HttpBackend.cs Executes tests through the HTTP ADO.NET API.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​ErrorCodes.cs Resolves error names and numeric codes.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​ClickHouse.Driver.TestRunner.csproj Defines the standalone .NET 10 shim.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner/​ChType.cs Parses type names for value rendering.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner.Tests/​TestHintTests.cs Tests hint parsing and matching.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner.Tests/​StatementsTests.cs Tests SQL splitting and token handling.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner.Tests/​OutputSettingsTests.cs Tests settings extraction and rendering behavior.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner.Tests/​OptionsTests.cs Tests options, port mapping, and helper behavior.
tests/​clickhouse-test-runner/​ClickHouse.Driver.TestRunner.Tests/​ClickHouse.Driver.TestRunner.Tests.csproj Defines the NUnit harness-test project.
tests/​clickhouse-test-runner/​clickhouse-version Pins the server and upstream test release.
tests/​clickhouse-test-runner/​CLAUDE.md Points to harness-specific guidance.
tests/​clickhouse-test-runner/​AGENTS.md Documents triage and allowlist maintenance rules.
tests/​clickhouse-test-runner/​.gitignore Excludes generated binaries and upstream checkout.
AGENTS.md Adds a pointer to harness guidance.
.github/​workflows/​upstream-sql-tests.yml Builds the harness and runs sharded CI checks.

Review effort: Balanced

@security-ai-gate-reviewer

security-ai-gate-reviewer Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

AI review gate — auto-approval withheld

The AI review gate is green, but the approver did not approve 9bbfd7b7: it changes paths that always require a human reviewer: .github/workflows/upstream-sql-tests.yml (commit de18c82 has no verified signature; commit de18c82 has no verified signature).

What to do: ask someone with write access who is not the PR author to approve this pull request.

History (latest 5 heads, newest first)

  • 9bbfd7b797de withheld — it changes paths that always require a human reviewer: .github/workflows/upstream-sql-tests.yml (commit de18c82 has no verified signature; commit de18c82 has no verified signature)
  • bb8ef3afa845 withheld — it changes paths that always require a human reviewer: .github/workflows/upstream-sql-tests.yml (commit de18c82 has no verified signature; commit de18c82 has no verified signature)
  • de18c8203779 withheld — it changes paths that always require a human reviewer: .github/workflows/upstream-sql-tests.yml (commit de18c82 has no verified signature; commit de18c82 has no verified signature)

polyglotAI-bot and others added 2 commits November 19, 2026 12:27
- Upload the test outputs of a failed shard: they are in the hidden
  directory .upstream (include-hidden-files).
- Turn off the runner's own retries (--dont_retry_failures), so that
  RETRY_FAILED is the only retry.
- Decode a doubled quote in an output-setting value ('it''s').
- Write the header of TSVRaw formats without escapes, as the server does.
- Skip heredocs when the shim finds the SETTINGS clause and the
  top-level words of a statement.
- Give the table of the KILL MUTATION live test a unique name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review fixes added it, but it changes nothing: upload-artifact tests
for a hidden name only in the directories that it walks into under the
search root of a pattern (here .../tests/queries), not in the fixed
prefix with .upstream. Artifacts of failed shards with the same paths
(clickhouse-connect with upload-artifact@v7; clickhouse-rs,
clickhouse-odbc and clickhouse-go with @v4) have the .stdout and .stderr
files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@polyglotAI-bot

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 9bbfd7b. Configure here.

ccoltx pushed a commit to ClickHouse/clickhouse-js that referenced this pull request Nov 19, 2026
## Summary

`scripts/run-upstream-tests.sh` now passes `--dont_retry_failures` to
`tests/clickhouse-test`.

Without the flag, the upstream runner runs a failed test again when its
output contains one of `MESSAGES_TO_RETRY` (for example "No such file or
directory", "Permission denied", "Connection reset by peer", "(total)
memory limit exceeded"), at most 3 times. When the test passes on a
retry, the runner reports it as `OK` and the job is green. So a flaky
test looks stable and can get into the allowlist. That is contrary to
rule 5 of the harness `AGENTS.md` ("remove it ... rather than
retrying"). With the flag, each failure fails the run.

Evidence, `tests/clickhouse-test` at the pinned `UPSTREAM_REF`
(`c6428ebc`, v26.10.2.103-stable):

- `TestResult.check_if_need_retry` sets `need_retry` only if `not
args.dont_retry_failures` (and the output matches `MESSAGES_TO_RETRY`,
and `runs_count <= MAX_RETRIES`).
- The flag is defined after a `parse_known_args()` call, so `--help`
does not list it, but the runner accepts it.

The same change was made in the C# harness after a review:
ClickHouse/clickhouse-cs#747.

No allowlist change, no client change (no CHANGELOG entry: the harness
is not a published package).

## Test

In a local stack (server 26.10.4.207, upstream tests at the pin):

- A probe test that fails on its first run with "No such file or
directory" on stderr and passes on the next run:
- `python3 tests/clickhouse-test <probe>` (as on `main`): `[ OK ]`, "1
tests passed", exit 0. The failed first run shows only under "Some tests
were restarted".
- `run-upstream-tests.sh` with this change: `[ FAIL ]`, "Having 1
errors!", exit 1.
- `run-upstream-tests.sh --no-stateful` with `SHARD_INDEX=1
SHARD_TOTAL=10` (passthrough): 295 tests passed, exit 0.
- `bash -n` on the script; `prettier --check` on the README.

The `upstream-sql-tests` workflow of this PR runs the full allowlist of
both backends with the flag.

## Checklist

- [x] The harness CI runs the full allowlists with the new flag

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Test harness-only change; it makes CI stricter without touching client
or runtime code.
> 
> **Overview**
> The upstream SQL harness now invokes `tests/clickhouse-test` with
**`--dont_retry_failures`**, so failures are not silently re-run when
output matches the upstream runner’s retryable error messages.
> 
> That closes a gap where intermittently failing tests could pass on
retry, look stable, and land on **`upstream-allowlist.txt`**. The README
**allowlist** guidance now states that flaky tests surface as real
failures under this behavior.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5aa32c0. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Polyglot AI <293096396+polyglotAI-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@ccoltx
ccoltx merged commit c07be3b into main Nov 19, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants