Skip to content

1.20 alpha1#766

Merged
peter-leonov-ch merged 34 commits into
releasefrom
main
May 31, 2026
Merged

1.20 alpha1#766
peter-leonov-ch merged 34 commits into
releasefrom
main

Conversation

@peter-leonov-ch

Copy link
Copy Markdown
Collaborator

Summary

A short description of the changes with a link to an open issue.

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

Onyx2406 and others added 10 commits March 8, 2026 13:11
When calling json() on a JSONEachRow result, the method first checks
_stream.readableEnded and then calls stream() which checks
readableEnded again. If the stream ends between these two checks
(common with fast/small responses), stream() throws "Stream has been
already consumed" even though this is the first consumption call.

Fix by introducing a _consumed boolean flag that is set synchronously
when any consumption method (text/json/stream) is called. This
eliminates the race window between the two readableEnded checks.

The fix splits stream() into a public method (with consumption check)
and a private _streamImpl() (without check) that json() calls
internally after already marking as consumed.

This matches the pattern used by the web client's ResultSet which
uses isAlreadyConsumed boolean instead of readableEnded.

Fixes #575
readableEnded=true just means the 'end' event fired, NOT that someone
already consumed the data. For fast/small responses, the stream can
end before json() is even called, making readableEnded=true while
data is still buffered and available. Checking readableEnded would
reject the first consumption call — exactly the bug reported in #575.

Only use the _consumed boolean flag, which tracks actual consumption
by our code, not stream lifecycle events.
Address Copilot review feedback:

1. Move validateStreamFormat() before markAsConsumed() in stream().
   Previously, if the format was invalid, the ResultSet was permanently
   marked as consumed even though nothing was actually read, preventing
   a subsequent text() call from working.

2. Make regression test deterministic by overriding readableEnded to
   always return true, simulating a fast response. The old code would
   throw on this; the new code only checks the _consumed flag.
Address reviewer feedback from peter-leonov-ch:

Move `markAsConsumed()` from the top of `json()` into each branch
that actually consumes the stream (streamable JSON and non-streamable
JSON). The unsupported-format path (CSV, etc.) no longer marks the
ResultSet as consumed, preserving the ability to call `text()`
afterwards — matching the pre-PR exception semantics.

Add tests verifying:
- json() on CSV throws without marking consumed, text() still works
- stream() on non-streamable format throws, text() still works
ci(tests): skip cloud integration jobs on fork PRs
…race

Fix ResultSet.json() race condition on JSONEachRow streams
Copilot AI review requested due to automatic review settings May 29, 2026 10:11
@peter-leonov-ch peter-leonov-ch requested a review from mshustov as a code owner May 29, 2026 10:11
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@CLAassistant

CLAassistant commented May 29, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ Onyx2406
✅ peter-leonov-ch
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Pull request overview

This PR prepares a 1.20.0 release while fixing Node.js ResultSet consumption tracking and adjusting CI behavior for forked PRs.

Changes:

  • Bumps package/runtime version metadata to 1.20.0.
  • Replaces Node ResultSet consumption checks based on readableEnded with an internal consumed flag.
  • Skips cloud integration jobs for forked PRs and updates the success aggregator to tolerate skipped jobs.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/client-node/src/result_set.ts Fixes ResultSet consumption tracking and stream validation order.
packages/client-node/__tests__/unit/node_result_set.test.ts Adds regression and failure-path tests for ResultSet consumption behavior.
.github/workflows/tests.yml Skips cloud tests for forked PRs and updates final success gating.
packages/client-common/package.json Bumps common package version.
packages/client-common/src/version.ts Bumps common runtime version.
packages/client-node/package.json Bumps Node package version and common dependency.
packages/client-node/src/version.ts Bumps Node runtime version.
packages/client-web/package.json Bumps web package version and common dependency.
packages/client-web/src/version.ts Bumps web runtime version.
tests/clickhouse-test-runner/package.json Bumps test runner workspace version.
package-lock.json Syncs workspace package versions and dependency metadata.

Comment thread packages/client-node/package.json
@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI and others added 5 commits May 29, 2026 23:55
## Summary

Restrict npm publishing to a protected GitHub environment so release
approvals/secrets can be gated centrally.

- Add `environment: npm-publish` to the `head` and `latest` jobs in
`.github/workflows/publish.yml`.
- `e2e` is left unscoped — it only installs from the public registry.
- No other changes needed: OIDC auth and `id-token: write` permissions
remain at the job level.

## Checklist

- [x] A human-readable description of the changes was provided to
include in CHANGELOG

CHANGELOG: Publish jobs now run under the `npm-publish` GitHub
environment to enforce release protection rules.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Peter Leonov <peter.leonov@clickhouse.com>
## Summary

Upstream test
`03262_system_functions_should_not_fill_query_log_functions` failed with
`Syntax error (Multi-statements are not allowed)`. The `.sql` file
begins with a `--` comment ending in `test's purpose.`; `splitQueries`
treated the apostrophe as the start of a string literal, so subsequent
`;` separators were ignored and all three statements were sent as one.

- `tests/clickhouse-test-runner/src/split-queries.ts`: when not inside a
quoted string, skip `-- ...` line comments (to end of line) and `/* ...
*/` block comments verbatim, so apostrophes/semicolons inside comments
don't affect splitting.
- `tests/clickhouse-test-runner/__tests__/split-queries.test.ts`: added
cases for apostrophes/semicolons embedded in both line and block
comments.

```sql
-- defeat the test's purpose.
SELECT 1;
SYSTEM FLUSH LOGS query_log;
SELECT 2;
```
Previously split into 1 statement; now correctly split into 3.

## Checklist

- [x] Unit and integration tests covering the common scenarios were
added
- [x] A human-readable description of the changes was provided to
include in CHANGELOG

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Peter Leonov <peter.leonov@clickhouse.com>
## Summary

Document user-facing changes shipped since `1.19.0` under a new `1.20.0`
section in `CHANGELOG.md`.

- **Bug Fixes**
- (Node.js) `ResultSet.json()` / `stream()` race on `JSONEachRow` where
a fast response ending between `readableEnded` checks threw `Stream has
been already consumed`. Consumption is now funneled through a single
`consume()` path that marks the result set consumed in the appropriate
branches, after format validation (#603).
- **Improvements**
- Re-export `ResponseHeaders` from `@clickhouse/client` and
`@clickhouse/client-web`, continuing the move toward making
`@clickhouse/client-common` internal-only (#758).

Other commits in the `1.19.0..HEAD` range are CI/infra/test-only
(publish env gating, copilot-setup-steps, fork cloud-test skip, test
runner `splitQueries` fix, version bump, test-comment typo) and
intentionally omitted.

## Checklist

- [x] A human-readable description of the changes was provided to
include in CHANGELOG

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
## Summary

`playwright install` hangs indefinitely on Playwright `< 1.60.0`
(microsoft/playwright#40998), causing GitHub Actions to cancel jobs
during the Chromium download. Playwright was only present transitively
as a peer dependency of `@vitest/browser-playwright`, resolving to
`1.57.0` (root) and `1.59.1` (web example) — both affected.

Changes:

- **Pin Playwright** — add `playwright: "^1.60.0"` as a direct
devDependency in `package.json` and `examples/web/package.json`, giving
explicit version control over the previously transitive peer dep.
- **Lockfiles** — regenerate `package-lock.json` and
`examples/web/package-lock.json`; `playwright`/`playwright-core` now
resolve to `1.60.0`.
- **CI workflows** — no change needed; `.github/workflows/*` invoke `npx
playwright install` with no pinned version, so they pick up the new
resolved version automatically.

No test logic or other dependencies were modified.

## Checklist

- [x] A human-readable description of the changes was provided to
include in CHANGELOG

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Pull request created by AI Agent

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 28 out of 30 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • examples/web/package-lock.json: Language not supported

Comment thread CHANGELOG.md
Comment thread tests/clickhouse-test-runner/src/split-queries.ts
…784)

The 1.20.0 changelog entry claimed `ResponseHeaders` was newly
re-exported from `@clickhouse/client` and `@clickhouse/client-web`, but
those re-exports already exist on the current entrypoints and are not
modified by this release — the note belongs to 1.19.0.

## Summary

- Removed the `ResponseHeaders` re-export bullet from the 1.20.0 section
of `CHANGELOG.md`; 1.20.0 now lists only the
`ResultSet.json()`/`stream()` race-condition fix that is actually
shipped here.
- Added the same bullet under 1.19.0 (where the re-export was
introduced), along with its `[#758]` link reference.

## Checklist

- [x] A human-readable description of the changes was provided to
include in CHANGELOG

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@peter-leonov-ch peter-leonov-ch changed the title Alpha 1.20 alpha1 May 31, 2026
Copilot AI added 2 commits May 31, 2026 20:40
…lickHouse (#787)

## Summary

Reran the upstream SQL test harness after merging `main`. All 3152
allowlisted tests pass against `clickhouse:head`; against
`clickhouse:latest` (26.5.1.882) 5 tests fail because upstream test
files on master reference server features not yet shipped in the
released image. These are upstream-vs-server version skew, not client
bugs, so they are commented out in `upstream-allowlist.txt` per the
file's documented "remove or comment out with a reason" policy.

- **Setting / column not in released CH**
- `03701_limit_by_in_order` — uses setting
`query_plan_push_limit_by_into_sort`
- `03643_system_instrumentation_no_suspicious_lowcardinality` — uses
`system.instrumentation.arguments`
- **Join-optimizer reference output drift between master and `latest`**
  - `01031_pmj_new_any_semi_join`
  - `01031_semi_anti_join`
  - `03211_convert_outer_join_to_inner_join_anti_join`

Each entry is preserved (commented out) with a one-line reason so it can
be re-enabled once the released server catches up.

## Checklist

- [x] A human-readable description of the changes was provided to
include in CHANGELOG

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
#783)

## Summary

First step toward deprecating `@clickhouse/client-common` so the
platform packages can evolve their class hierarchies and types without
being constrained by a shared base. Runtime values re-exported from
`@clickhouse/client-common` are annotated with `@deprecated` JSDoc,
while platform packages remain the recommended non-deprecated import
path. Type-only exports are untouched.

This PR also includes a follow-up fix from review feedback: the
`ClickHouseClient` deprecation message in
`packages/client-common/src/index.ts` was corrected to avoid implying a
runtime import from `@clickhouse/client-web` (which exports
`ClickHouseClient` as a type). The guidance now points to:
- runtime imports from `@clickhouse/client`
- type-only Web usage via `import type { ClickHouseClient } from
'@clickhouse/client-web'`

### CHANGELOG entry

Importing runtime values (`ClickHouseError`, `ClickHouseLogLevel`,
`parseError`, `SettingsMap`, `TupleParam`, `isRow`, `isProgressRow`,
`isException`, `parseColumnType`, `SimpleColumnTypes`,
`defaultJSONHandling`, and the format-name constants) from
`@clickhouse/client-common` is now deprecated; import them from
`@clickhouse/client` or `@clickhouse/client-web` instead. For
`ClickHouseClient`, use `@clickhouse/client` for runtime imports and
`import type` from `@clickhouse/client-web` in Web projects. No runtime
behavior change.

## Checklist

- [ ] Unit and integration tests covering the common scenarios were
added
- [x] A human-readable description of the changes was provided to
include in CHANGELOG
- [ ] For significant changes, documentation in
https://github.com/ClickHouse/clickhouse-docs was updated with further
explanations or tutorials

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

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.

Pull request overview

Copilot reviewed 33 out of 35 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • examples/web/package-lock.json: Language not supported

Comment thread .github/workflows/copilot-setup-steps.yml
@peter-leonov-ch peter-leonov-ch merged commit 5423b05 into release May 31, 2026
149 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.

6 participants