1.20 Alpha 2#806
Conversation
## Summary Adds `ALTERNATIVE_CLIENTS.md` to encourage and streamline third-party clients for other runtimes (Bun, Cloudflare Workers, …) and protocols (native TCP, gRPC-over-proxy, …) now that `@clickhouse/client-common` is being deprecated and there is no replacement shared package. - **New `ALTERNATIVE_CLIENTS.md` (root)** covering: - Why `@clickhouse/client-common` is going away (versioning + bundling pain) and that shared code is being inlined into each runtime package rather than relocated to a new shared folder/package — new clients should copy what they need, not depend on a shared package. - Recommended workflow: fork `packages/client-node` or `packages/client-web` in place (whichever is closest to the target runtime), iterate until it works, then rename the directory to e.g. `packages/my-native-client`, update `package.json#name`, and open a PR. - Request to **preserve commit history** (no squash/rewrite) so the diff against the upstream package stays analyzable for reviewers and future syncs. - Strong nudge to **open an issue and discuss the design first** before significant work. - Pre-PR checklist (issue exists, no `client-common` dep, history preserved, tests, build/lint pass). - **`README.md`**: link the new doc from the Contributing section. ## 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> Co-authored-by: Peter Leonov <peter.leonov@clickhouse.com>
## Summary The code review agent had no explicit guidance on breaking changes. Undocumented breaks in the public API degrade LLM-generated code for newer client versions, since models lean on older-version training data. Added a "Breaking changes" section to `.github/instructions/review.instructions.md` instructing the agent to flag major public-API breaks (removed/renamed exports, changed signatures, changed defaults, removed config) that lack a clear justification in the PR description, commit, or comments, and to request either a rationale/migration note or a backwards-compatible path (e.g., deprecation). ## 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> Co-authored-by: Peter Leonov <peter.leonov@clickhouse.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
## 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
Adds the AI usage policy from the main ClickHouse repository: https://github.com/ClickHouse/ClickHouse/blob/master/AI_POLICY.md This makes the policy consistent across ClickHouse client/driver repositories.
## 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
…stic, and add Bun CI workflow (#795) ## Summary Adds scripts to run the existing Vitest unit suites under Bun (`bun --bun vitest`), fixes the `getAsText` "response too large" handling which was V8-only, and introduces a dedicated GitHub Actions workflow to run the Bun unit tests in CI. Running the Node unit suite under Bun surfaced two failures in `node_getAsText`: JavaScriptCore throws `RangeError: Out of memory` (not V8's `Invalid string length`) past the string limit, and its `MAX_STRING_LENGTH` differs (2147483647 vs V8's 536870888). - **Bun test scripts**: `test:node:unit:bun` and `test:common:unit:bun` in root `package.json` run the existing suites via `bun --bun vitest`. - **`getAsText` (`packages/client-node/src/utils/stream.ts`)**: also catches the JSC `Out of memory` RangeError; error message is now engine-neutral (`maximum allowed size of a string`) instead of `V8 String`. - **`node_getAsText` test**: length assertions derive from `constants.MAX_STRING_LENGTH` rather than a hard-coded V8 value, so they hold under both engines. - **Bun CI workflow** (`.github/workflows/tests-bun.yml`): separate workflow with `common-unit-tests-bun` and `node-unit-tests-bun` jobs, triggered on push/PR/`workflow_dispatch`, using `oven-sh/setup-bun` (pinned by SHA). The full Node unit suite (131 tests) passes under both Node and Bun. ## 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>
Inserting a UUID string into a `UInt128` column via `JSONEachRow` fails
with `CANNOT_PARSE_INPUT_ASSERTION_FAILED` because ClickHouse only
converts UUID → UInt128 implicitly for the `VALUES` clause. The client
correctly forwards the JSON unchanged; users need guidance on the
supported patterns.
## Summary
Adds a new example (Node + Web) demonstrating two working approaches,
with a round-trip assertion proving the server stores the value
byte-for-byte.
- **`examples/{node,web}/coding/insert_uuid_into_uint128.ts`** — two
patterns:
- *Client-side conversion* (recommended): `BigInt('0x' +
uuid.replace(/-/g, '')).toString()` passed as the UInt128 column value.
- *EPHEMERAL UUID column*: `UInt128 DEFAULT id_uuid` + `UUID EPHEMERAL`
paired with `insert({ columns: ['id_uuid', ...] })`.
- **Round-trip assertion** after each `SELECT` (`node:assert/strict` in
Node; tiny inline `assertEqual` in Web, since `node:assert` isn't
browser-compatible). Both patterns produce the same UInt128 decimal
`2126302229887840375125392584261985180`.
- **`examples/README.md`** — new row in the `coding/` table.
```ts
function uuidToUInt128(uuid: string): string {
return BigInt('0x' + uuid.replace(/-/g, '')).toString()
}
await client.insert({
table,
values: [{ id: uuidToUInt128(uuid), description: '...' }],
format: 'JSONEachRow',
})
```
## Checklist
- [x] A human-readable description of the changes was provided to
include in CHANGELOG
### Release note
Added `examples/{node,web}/coding/insert_uuid_into_uint128.ts` showing
how to insert a UUID into a `UInt128` column with `JSONEachRow`, either
via client-side BigInt conversion or via an `EPHEMERAL` UUID column with
a `UInt128 DEFAULT` expression, with a round-trip assertion verifying
the stored value.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
## Summary
Swaps vitest `expect()` for Node's built-in `node:assert` in the Node
QBit example, per reviewer preference for native assertions.
- **Node example** (`examples/node/coding/qbit.ts`): `import { expect }
from 'vitest'` → `import assert from 'node:assert'`; `toEqual` →
`assert.deepStrictEqual`, `toBe` → `assert.strictEqual`, `toMatch` →
`assert.match`.
- **Web example** (`examples/web/coding/qbit.ts`): left on vitest
`expect()`. It runs in a real browser (Playwright), where `node:assert`
is externalized (`Module "node:assert" has been externalized for browser
compatibility`) and unusable; no native throwing assert exists in
browsers.
```ts
import assert from 'node:assert'
assert.deepStrictEqual(rows, values)
assert.strictEqual(nearest[0].dist, 0)
assert.match(row.bit_plane_1_hex, /^[0-9A-F]*$/)
```
## Checklist
- [ ] 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 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 --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
|
There was a problem hiding this comment.
Pull request overview
This PR expands the repo’s documentation/examples (notably around QBit and UUID↔UInt128 pitfalls), adds Bun CI coverage for unit tests, and tweaks Node stream-to-text handling to better match Bun’s RangeError behavior.
Changes:
- Added Bun unit test scripts and a dedicated GitHub Actions workflow for running common + node unit tests under Bun.
- Added new docs/examples for
QBitvector type and for inserting UUIDs intoUInt128in JSON row formats; added troubleshooting guidance forquery()/FORMAT-clause pitfalls and a new “alternative clients” guide. - Updated Node
getAsText()error handling/message and adjusted its unit tests accordingly; bumped a couple dev dependency versions.
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/clickhouse-js-node-troubleshooting/SKILL.md | Adds/extends troubleshooting index entries (incl. FORMAT/SHOW POLICIES). |
| skills/clickhouse-js-node-troubleshooting/reference/socket-hangup.md | Clarifies header-size limit workaround and mentions client option mapping. |
| skills/clickhouse-js-node-troubleshooting/reference/query-format-clause.md | New troubleshooting doc explaining duplicate FORMAT and SHOW POLICIES syntax issues with query(). |
| skills/clickhouse-js-node-troubleshooting/reference/data-types.md | Adds UUID→UInt128 JSON insertion caveat and mitigation patterns. |
| skills/clickhouse-js-node-coding/SKILL.md | Updates coding skill index; mentions QBit and UUID→UInt128 insert nuance. |
| skills/clickhouse-js-node-coding/reference/insert-values.md | Adds a dedicated UUID→UInt128 section + pitfall entry. |
| skills/clickhouse-js-node-coding/reference/insert-formats.md | Minor formatting/wording consolidation. |
| skills/clickhouse-js-node-coding/reference/data-types.md | Adds QBit coverage + example and related pitfalls. |
| README.md | Links to the new alternative clients guide. |
| packages/client-node/src/utils/stream.ts | Treats Bun/JSC “Out of memory” RangeError similarly to V8 “Invalid string length”. |
| packages/client-node/tests/unit/node_getAsText.test.ts | Updates assertions and makes size expectations parameterized. |
| package.json | Adds Bun test scripts; bumps a couple dev dependencies. |
| examples/web/coding/qbit.ts | New web QBit example (round-trip + approximate search + bit-plane notes). |
| examples/web/coding/insert_uuid_into_uint128.ts | New web example for UUID→UInt128 insertion patterns. |
| examples/README.md | Adds rows linking to the new examples (UUID→UInt128, QBit). |
| examples/node/coding/qbit.ts | New node QBit example. |
| examples/node/coding/insert_uuid_into_uint128.ts | New node example for UUID→UInt128 insertion patterns. |
| CHANGELOG.md | Re-categorizes the enum-unescape entry under “Bug Fixes”. |
| ALTERNATIVE_CLIENTS.md | New contributor doc for building alternative-runtime/protocol clients. |
| AI_POLICY.md | Adds a repository AI usage policy document. |
| .github/workflows/tests-bun.yml | New CI workflow to run unit tests under Bun. |
| .github/instructions/review.instructions.md | Adds explicit guidance to flag undocumented breaking API changes during review. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
## 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 --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
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:
For more information about GitHub Code Scanning, check out the documentation. |
) ## Summary The `tests` workflow ran node and web jobs together under a single workflow and `success` gate, making runs harder to read and status checks coarse-grained. This splits it into two independent workflows. - **`tests-node.yml`** (`node`): `code-quality`, `common-unit-tests`, `unit-tests`, integration jobs (single-node, cluster, cloud), `codecov-upload`, plus a node-only `success` gate. - **`tests-web.yml`** (`web`): `common-unit-tests`, `all-tests-local-single-node`, integration jobs (cluster, cloud), `codecov-upload`, plus a web-only `success` gate. - Removed the combined `tests.yml`. - README now shows two CI badges (node, web) instead of one. - Both `codecov-upload` jobs use a `clickhouse: [head, latest]` matrix, consistent with the other integration test jobs in each workflow, and pass `CLICKHOUSE_VERSION` to docker-compose accordingly. - Job IDs within each workflow omit the redundant `node-`/`web-` prefix (e.g. `unit-tests` instead of `node-unit-tests`) since the workflow name already provides that context. Triggers, `permissions`, `concurrency`, and `env` are preserved in both. `code-quality` (repo-wide build/typecheck/lint) lives in the node workflow; concurrency groups key on `github.workflow`, so the two run independently. ## Checklist - [ ] 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
A short description of the changes with a link to an open issue.
Checklist
Delete items not relevant to your PR: