feat(#630): add consuming query APIs, ClickHouseError, stateless KILL QUERY (phase 4) - #645
Conversation
…stateless KILL QUERY Purely additive to packages/clickhouse-http: ensureClickHouseSuccess, consumeJsonResponse/consumeTextResponse/consumeProgressResponse (response.ts, new), a minimal ClickHouseError, queryJson/queryText/ queryProgress convenience client methods, and a stateless wire-level killQuery built from one queryText() call, with a private quoteKillQueryId Phase-4 quoting stopgap. Zero src/** files changed; no existing architecture rule/scanner needed extension. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwFPT465eDJqYcRa8HGNLz
ChatGPT review pass 1Reviewed head: Major —
|
queryJson's doc comment claimed an explicit defaultFormat, including '', is preserved end-to-end, but chUrl (Phase 1/2) separately falls back on any falsy format to its own default when it serializes the final URL — so a '' value never reaches the wire as ''. The defaultFormat:'' acceptance test only spied on client.request() and could not detect this, despite its own inline comment already admitting the gap. Qualify both doc comments to state the two-layer behavior accurately, and extend the test to also assert on the final Fetch URL so the wire-level fallback is pinned, not just the composed request object. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LwFPT465eDJqYcRa8HGNLz
ChatGPT review pass 2Previous reviewed head: Pass-1 finding reassessmentResolved — The old head claimed an explicit The test now proves both layers independently: it asserts that I consider this resolution scope-correct for Phase 4. The strongest objection is that allowing Complete updated-PR regression reviewNo new actionable findings.
VERDICT: SHIP |
What & why
Part of #630 — replacing the rejected
@clickhouse/client-webadoption path (#585) witha first-party, Fetch-native
@altinity/clickhouse-httppackage extracted from genericprotocol code SQL Browser already maintains.
This is Phase 4 of 8. It's purely additive to
packages/clickhouse-http:ensureClickHouseSuccess,consumeJsonResponse/consumeTextResponse/consumeProgressResponse,queryJson/queryText/queryProgressconvenience methods,a minimal
ClickHouseError, and a statelesskillQuery. Zero SQL Browser productionfiles changed — nothing consumes these new APIs yet; that cutover is Phase 7.
Claims: A8 (explicit non-consuming/consuming response APIs with a minimal
ClickHouse error model), A9 (stateless package
KILL QUERYwithout credentiallookup/retry/registry ownership). A10–A18 remain deferred.
Approved plan: see the ship-log comment on #630. Fable approved on the first review
pass — zero findings — the plan explicitly reasoned through and avoided repeating Phase
3's hand-rolled-scanner mistake (no new architecture rule was needed; the existing
package-policy rules automatically cover the new module).
Contract coverage
responseby strict identity onresponse.ok, no.text()/.json()/cloneclickhouse-http-response.test.ts.clone().text()bypass → 2 tests fail (verified independently by the coordinator)ClickHouseErroroncequeryJson/queryText/queryProgresseach exactly onerequest()+ one consumerrequest()→ 3 tests fail.json()/.text()/streamLines()killQueryqueryText()call, no retained state, no credential/retry/registrykillQuerynever writes its SQL target intoparams.query_idTests
npm run check:types && npm run check:arch && npm run check:schemas && npm run check:examples && npm test && npm run build— green (7301 tests, 100%/97.14%/100%/100% coverage).--project=chromium --project=webkit— 219/215 passed respectively (4 pre-existing skips), including new Scenario 9 provingqueryProgress()preserves the same native post-header-cancellation semantics through the new API.Build
npm run buildsucceeds — single self-containeddist/sql.html, no new runtime dependency.Invariant/sabotage verification
Verified twice: once by the implementer (whose own sabotage checks caught a real gap
in its first test draft — a
.clone().text()bypass abodyUsed-only check wouldn'tcatch — fixed before reporting done), and once by the coordinator (diff footprint
confirming zero
src/**changes, full six-command gate, direct reproduction of theclone-bypass sabotage, and direct code review confirming
killQuery's genuinestatelessness).
Checklist
npm testpasses (the per-file coverage gate is non-negotiable)npm run buildsucceeds (single-filedist/sql.html)src/**changes; no new hand-rolled text/regex scannerCHANGELOG.md([Unreleased]) updatedCLAUDE.md,docs/ARCHITECTURE.md, ADR-0005 addendum, and.wikipages updated; the issue's own## Phaseschecklist is ticked only after merge is verified onorigin/main, per its explicit stated conventionPart of #630.