Skip to content

feat(qwp): add owned_by to name the owner of the tables a sender auto-creates - #82

Open
glasstiger wants to merge 9 commits into
mainfrom
ia_qwp_owned_by
Open

glasstiger wants to merge 9 commits into
mainfrom
ia_qwp_owned_by

Conversation

@glasstiger

@glasstiger glasstiger commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Client side of questdb/questdb#8504 and questdb/questdb-enterprise#1572, modelled on questdb/java-questdb-client#130; the protocol and Java client are documented in questdb/documentation#652.

Problem

QWP ingestion auto-creates the tables and columns a sender writes, and QuestDB Enterprise grants their creator the owner permissions on them. An external user, one authenticated with an OIDC token, cannot hold permissions, so it could not auto-create anything over QWP. SQL solves this with OWNED BY; this client had no QWP equivalent.

Changes

Node.js

Option owned_by=<name> connect-string key and ownedBy ingress option: Sender.fromConfig(), qwp.webSocket, the direct senders, and the pooled client's ingress. Ingress only: query sessions never send it, and the connect strings of the ILP and UDP transports reject the key.
Wire X-QWP-Owned-By on every /write/v4 upgrade, reconnects, failovers and orphan drains included, percent-encoded UTF-8 in the canonical form the server echoes.
Confirmation The upgrade fails with the new QwpOwnedByMismatchError (exported from the Node.js package only) unless the 101 echoes the owner: a server that predates the header ignores it, and the tables it creates would not get the owner.
Refusal reason A rejected upgrade carries the text/plain body that arrived with its headers as QwpUpgradeError.reason, sanitized and capped at 256 characters, and appends it to the message. A refused owner (403) reads [reason=owned_by refused: …] instead of looking like a rejected credential.
Validation A blank name, a lone surrogate, and ownedBy combined with a hand-written X-QWP-Owned-By header are rejected when the sender or client is created.

Retry policy

An unconfirmed owner is a capability gap, handled like a durable ACK the server does not confirm; the two now share one path in the reconnect loop:

  • A blocking (off or sync) startup fails at once, and so does a reconnect without background replay.
  • A store-and-forward sender that has connected, or one started with initialConnectMode: "async", keeps retrying and keeps its rows.
  • An orphan drainer counts it toward the same budget as a missing durable ACK (16 sweeps and reconnectMaxDurationMs), then quarantines the slot behind .failed with an error that names owned_by. The durable-ACK events still report durable ACK only.

Browser

A browser cannot set the header, so the owner travels in the qwp_owned_by URL parameter, which the server reads when the header is absent. A browser cannot read the 101 either, so it cannot confirm the owner: a server that predates the option ignores it, and a refused owner surfaces as the opaque upgrade error. The option's TSDoc and QWP.md say so.

Differences from the Java client

These follow this client's existing durable-ACK policy rather than Java's:

  • An async startup retries an unconfirmed owner; Java fails it at once.
  • A sender with neither a journal nor an async startup ends when a reconnect meets one; Java keeps retrying.
  • A sweep that meets both a replica's 421 and an unconfirmed owner fails with a QwpFailoverError listing both attempts, which stays retryable; Durable-ack mismatch reported as a missing primary in mixed connect rounds java-questdb-client#131 made Java report the gap instead.
  • The ILP and UDP connect strings reject owned_by as an unknown key, as they do every other QWP key, rather than with a dedicated message.

Compatibility

Additive: a new option, a new error class and a new optional QwpUpgradeError.reason. Two existing behaviors change:

  • A rejected upgrade's message gains a [reason=…] suffix when the server sends a text/plain body; the wording of an error message is not part of the contract.
  • A Sender built from a ws/wss connect string copies typed qwp.webSocket.headers when its SenderOptions is created and again when the Sender is built, so later edits to that object no longer reach reconnects; the caller's object used to be read on every connection attempt. Replacing SenderOptions.qwp before building the Sender replaces those headers and the ownedBy override. This keeps a sender from sending headers meant for another sender built from the same options; QWP.md documents it.

Follow-up

questdb/documentation#652 marks owned_by as Java-only; it can name the Node.js and browser clients once this ships.

Validation

  • Passed: 1,419 unit tests, 33 of them new: the wire behavior against real ws and raw TCP servers, the reconnect policy, orphan quarantine, config parsing, and the browser URL parameter.
  • Passed: 39 distribution tests and 13 Chromium tests, one of them new.
  • Passed: typecheck, typecheck:qwp-browser, typecheck:test, typecheck:bench, typecheck:dist (including TypeScript 4.9), ESLint, Prettier and check:packages.
  • Not run: the Docker-based ILP integration tests, and an end-to-end run against the server PRs.

Most of the 614-file diff is the regenerated API reference.

…-creates

QWP ingestion auto-creates the tables and columns a sender writes, and
QuestDB Enterprise grants their creator the owner permissions on them. An
external (OIDC) user cannot hold permissions, so it could not auto-create
anything over QWP. SQL solves this with OWNED BY. The owned_by connect-string
key and the ownedBy ingress option are the QWP equivalent, as in the Java
client (questdb/java-questdb-client#130).

- Node.js sends the owner as X-QWP-Owned-By, percent-encoded UTF-8 in the
  canonical form the server echoes, on every /write/v4 upgrade: reconnects,
  failovers and orphan drains included. Query sessions never send it, and
  the connect strings of the other transports reject the key.
- The upgrade fails with the new QwpOwnedByMismatchError, exported from the
  Node.js package, unless the server echoes the owner: a server that predates
  the header ignores it, and the tables it creates would not get the owner.
- That failure is a capability gap, handled like a durable ACK the server
  does not confirm: a blocking startup fails at once, background replay
  retries it, and an orphan drainer counts it toward the budget a missing
  durable ACK draws on, then quarantines the slot.
- A rejected upgrade carries the text/plain body that arrived with its
  headers as QwpUpgradeError.reason, sanitized and capped at 256 characters,
  and appends it to the message, so a refused owner (403) reads
  "[reason=owned_by refused: ...]" instead of looking like a rejected
  credential.
- The browser client sends the owner in the qwp_owned_by URL parameter. A
  browser cannot read the upgrade response, so it cannot confirm the owner,
  as the option's documentation says.

Documents the option in QWP.md and the READMEs, and regenerates the API
reference.
ownedBy combined with an X-QWP-Owned-By header in the headers escape hatch
was rejected only by the first connection attempt, while a blank owner, or
one with a lone surrogate, already failed when the sender or client was
created. createQwpNodeSender() and the pooled client's option normalization
now reject the conflict as well, against the headers ingress ends up with,
so Sender.fromConfig(), new Sender(), createQwpNodeClient() and
parseQwpNodeClientConfig() report it up front. The raw connector keeps its
connect-time check, and both apply one rule.

A Sender's invalid typed ownedBy is reported as qwp.webSocket.ownedBy, the
option its caller wrote, rather than as the pooled client's ingress.ownedBy.

The display-text test now covers U+2029, the one character class of the
sanitizer that no test exercised.
Resolve ownedBy and raw headers at Sender construction so later overrides cannot leave a stale upgrade header. Only read a bounded prefix of complete, uncompressed text/plain upgrade rejections.

Document orphan adoption, browser fallback, and reconnect event semantics. Exercise owner changes and replay on the wire, and drain notifications before asserting their absence.
Snapshot headers per parsed configuration and honor getter-backed owners on Node and browser ingress. Keep the chosen owner across lazy connects, failover, foreground replay, and orphan adoption.

Report the final capability gap separately from the orphan retry budget and decode bounded upgrade refusal text using its declared charset. Cover these paths with transport and replay regressions.
@glasstiger

Copy link
Copy Markdown
Collaborator Author

Review of 1d99d3fc..e9fcd755 (level 3, full pass). Verdict: approve. No blocking issues. Three minor documentation and test-wording items below. The generated docs/** was skipped. Line references are at e9fcd755.

Critical

None.

Moderate

None.

Minor

  1. Factory docs are now stale, and one comment sits above the wrong line.

    • createQwpNodeSender now calls connectQwpNodeIngressInternal directly, and createQwpBrowserSender now goes through openBrowserIngress. That leaves connectQwpNodeIngress, connectQwpBrowserIngress and createQwpBrowserConnectionFactory with test callers only.
    • Their docs still describe them as the factory behind the sender:
      • packages/nodejs-client/src/qwp.ts:3 and :1006
      • packages/browser-client/src/qwp.ts:3-4, :799 and :1288
    • In createQwpBrowserSender (packages/browser-client/src/qwp.ts:1331), the new comment "Bind the owner before the first lazy connect…" replaced the explanation for validateBrowserAuthOptions(options). It now sits above that call, and the owner binding it describes is on :1333.
    • Fix: reword these docs as test entry points, restore the auth-validation comment, and move the owner comment down one line.
  2. durable-ack-unavailable events now count owner-gap sweeps, but the docs only say so for durable-ack-persistent-failure.

    • Both gap kinds share one counter and one episode start (packages/client-core/src/_qwp/_internal/reconnecting-ingress-connection.ts:1785-1789). A durable-ack-unavailable event that follows owner gaps reports attempt > 1, and its episodeMs includes the owner-gap time (:1832-1838). The new test pins this as [2, 4, …, 14] (test/qwp/reconnect.test.ts:4870).
    • The new sentence appears only for persistent-failure (packages/client-core/src/_qwp/transport.ts:244-248, QWP.md:642-644). It is missing for DURABLE_ACK_UNAVAILABLE (transport.ts:243) and for QwpReconnectEvent.attempt, which is still documented as a "one-based reconnect sweep number" (:259).
    • Fix: extend the same sentence to durable-ack-unavailable in both places.
  3. The test "bounds body copies for a complete %s rejection" never checks a bound against this implementation (test/qwp/owned-by.test.ts:587-618).

    • The byte-limit assertion only runs inside a loop over Buffer.concat calls. readRejectedUpgradeBody copies with response.read(n) and never calls Buffer.concat.
    • An instrumented copy of the test (Node 24.3, Vitest 3.1.3) recorded 0 concat calls and 0 runs of the assertion, in both the text/plain and text/html arms.
    • The test would still catch a whole-body concatenation, and its .reason check catches a whole-body decode. It would not catch a whole-body read that avoids concat, such as read() followed by slicing.
    • Fix: rename the test and its comment to what it actually guards, e.g. "does not concatenate the whole rejected body".

Tradeoffs (deliberate, not findings)

  • Senders built from a ws/wss connect string now copy typed qwp.webSocket.headers when the options are built, so editing that header object later no longer reaches reconnects. At base it did, and a programmatic new Sender({...}) still reads it live.
  • Replacing options.qwp after construction now picks up ownedBy and headers only.
  • Both changes stop one reused extra-options object from leaking credentials between Senders. Neither is documented.
  • The PR's documented policy choices stand: a memory-replay sender ends on an unconfirmed owner, an adopted orphan slot replays under the adopting sender's owner, and browsers can't confirm the owner.

Verified at e9fcd755

Summary: 0 critical, 0 moderate, 3 minor, all within the diff. No submodule changes. The correctness and test gates pass.

…est name with the code

The senders no longer call connectQwpNodeIngress(), connectQwpBrowserIngress()
or createQwpBrowserConnectionFactory(): they capture ownedBy once, when they are
created. Describe those functions as the test entry points they are, and put the
auth-validation comment in createQwpBrowserSender() back above its call.

durable-ack-unavailable events count the whole capability-gap episode, owner gaps
included. Say so for that event and for QwpReconnectEvent.attempt, as the
durable-ack-persistent-failure docs already did.

Name the rejected-upgrade copy test after what it checks: it decodes at most
4,096 bytes and catches only a concat-based copy.

Regenerates the API reference.
A Sender built from a ws/wss connect string copies qwp.webSocket.headers
when its SenderOptions is created and again when the Sender is built, so
edits to that object no longer reach it, reconnects included, and it reads
headers and ownedBy from the qwp section it is given. The caller's object
used to be read on every connection attempt. Say so in QWP.md and on
QwpExtraOptions.webSocket, and pin both copies and the section read in
tests.

The content-coded rejection test now declares charset=iso-8859-1, which
decodes any byte sequence, so it fails without the Content-Encoding check.
Under UTF-8, gzip's magic number failed to decode with or without it.

Regenerates the API reference.
@glasstiger

Copy link
Copy Markdown
Collaborator Author

Review level 3 (requested, full pass). PR #82 feat(qwp): add owned_by … at HEAD aa7638a9, compared with BASE 1d99d3fc. I skipped the 588 generated docs/** files.

The title and commits follow Conventional Commits. The description explains the user impact, the retry policy, the differences from the Java client and both behavior changes. The Compatibility section leaves out two additive public type members: QwpNodeUpgradeRejection.body and QwpUpgradeErrorDetails.reason.

Critical

None.

Moderate

None.

Adjacent findings

None.

Coverage map

The test gate passes with no coverage gaps.

Summary

Verdict: approve. No problems found.

  • Correctness gate: passes.
  • Test gate: passes, with no gaps.
  • Findings: none, either in the diff or in unchanged callers.
  • Submodules: none.

What I checked at aa7638a9 (all in throwaway worktrees, since removed):

  • Build and tests: all pass.
    • 1,442 unit tests. I did not run the Docker ILP integration tests.
    • typecheck, typecheck:qwp-browser, typecheck:test, and typecheck:dist including TypeScript 4.9.
    • ESLint, Prettier, test:dist (39 tests) and check:packages.
    • The real-browser suite: 13 Chromium tests, including the new owner test.
  • Wire format: the X-QWP-Owned-By encoding, the echo check, and the browser qwp_owned_by parameter (where + means a space) match the server code in feat(qwp): let QWP senders choose the owner of the tables and columns they auto-create questdb#8504 at a79cdc1a.
  • Rejected upgrades: I tested a server reset right after the response, a split body, a 40 KB body and a chunked body that never ends. In every case the error was classified as at BASE: same kind, status, retry flag, and the endpoint sweep still stops. The only difference is the new reason.
  • Pooled client orphan drain: the pool's orphan drainer replays a slot it adopts under the pool's own ownedBy, as QWP.md says.
  • Mutation spot-checks: the tests caught 18 of 20 mutations. Neither survivor matters to users:
    • One removes the reset of the capability-gap episode after a successful connect. BASE has no test for it either, and the PR only renamed that line.
    • The other removes the header-conflict check when SenderOptions is created. The same error is still thrown when the Sender is built, before any connection.

Deliberate tradeoffs, documented in QWP.md and the PR body:

  • A Sender built from a connect string now copies the typed qwp.webSocket.headers. Editing that object later no longer reaches reconnects.
  • On Node, rejected-upgrade messages gain a [reason=…] suffix, on both ingress and egress. A text/plain rejection is now reported one event-loop turn later.
  • A sender with no journal and no async startup stops when a reconnect finds the owner unconfirmed. The Java client keeps retrying.
  • An adopted orphan slot replays under the adopting sender's owner.
  • A browser cannot confirm the owner.

Limitations:

…the pooled drainer's owner

No test fed the reconnect loop a sweep in which every endpoint completed
the upgrade without a capability the session asked for. Disabling its
handling of such a sweep left every test passing, while a blocking
store-and-forward startup then retried for its whole budget and an orphan
slot was never quarantined. Cover it with synthetic sweeps of owner gaps,
and of an owner gap followed by a durable-ACK gap, and run the blocking
startup test against two real endpoints that both ignore the owner.

The pooled client's orphan drainer was untested as well: passing it no
owner left every test passing, while a recovered slot then replayed
without X-QWP-Owned-By. Drain a slot a pooled sender left behind and check
that the recovery upgrade names the pool's owner.
createQwpNodeSender() binds ownedBy when the sender is created, so that
lazy startup, foreground replay and orphan adoption all use the same
owner. Only the first two were tested. The orphan-drain test adopted
through connectQwpNodeIngress(), where the live and the bound owner are
the same value, so a drainer that read options.ownedBy again left every
test passing while it replayed adopted slots under an owner the sender
was not created with.

Run that test through a sender whose options change after it is created
as well.
…ct error

The error for an owner that an X-QWP-Owned-By header also names always
called the option 'ownedBy'. A Sender or pooled client that takes its owner
from the connect string now reports 'owned_by', and typed owners report
'qwp.webSocket.ownedBy' or 'ingress.ownedBy', as the other owner errors on
those paths already do. createQwpNodeSender() and the raw connector keep
'ownedBy'.
@glasstiger

Copy link
Copy Markdown
Collaborator Author

Review level 3 (requested, full pass). PR #82 at HEAD 38cac008, compared with BASE 1d99d3fc. I skipped the generated docs/**.

Verdict: approve. No Critical, Moderate or Minor issues remain.

The title and all nine commit subjects follow Conventional Commits. The description covers the user impact, the retry policy, how this differs from the Java client, and the two behavior changes.

Since the previous pass

My pass at 497acc30 raised one Minor item: the header-conflict error named 'ownedBy' even when the caller wrote owned_by. 38cac008 fixes it. The error now names the spelling the caller used, as the other owner errors on those paths do:

  • owned_by when the owner comes from a connect string, for a Sender or the pooled client;
  • qwp.webSocket.ownedBy on a Sender;
  • ingress.ownedBy on the pooled client;
  • ownedBy on createQwpNodeSender() and the raw connector, as before.

New cases in test/qwp/owned-by.test.ts and test/qwp/node-client-config.test.ts cover each spelling. They also check that SenderOptions built from a connect string reports the conflict when it is created.

Critical

None.

Moderate

None.

Minor

None.

Adjacent findings

None.

Coverage map

The test gate passes, with no coverage gaps. At 497acc30 I applied 14 mutations to the new behavior one at a time, and the suite caught every one; 38cac008 changes none of the mutated lines. The mutated areas were:

  • the echo check;
  • recognizing the owner gap;
  • binding the owner in the Node sender, the browser sender and the orphan drainer;
  • quarantining the slot in the drainer;
  • the event branch, and failing fast at startup;
  • reading only a complete text/plain body, and the content-encoding check;
  • the encoding;
  • copying the headers in qwpConfig;
  • the browser URL parameter;
  • getter-backed owners.

Summary

  • Gates: correctness passes; test passes, with no gaps.
  • Findings: none.
  • Submodules: none.

Deliberate tradeoffs (all documented in QWP.md or the PR body):

  • A Sender built from a connect string now copies the typed headers. Editing them in place, for example to rotate an Authorization header, no longer reaches reconnects. Programmatic Senders still read them live.
  • A sender with no store-and-forward journal and an off or sync startup stops when a reconnect finds the owner unconfirmed. This matches how BASE handles a missing durable ACK; the Java client keeps retrying.
  • An adopted orphan slot replays under the adopting sender's owner. If the server refuses that owner with a 403, the slot is quarantined, as for a rejected credential.
  • On Node, rejected-upgrade messages on both ingress and egress now end with [reason=…].
  • A browser cannot confirm the owner.

What I verified at 38cac008 (build-based checks in a scratch worktree, since removed):

  • Static checks: all three typechecks, plus typecheck:dist including TypeScript 4.9, ESLint, Prettier and check:packages pass.
  • Tests:
    • Unit suite: 1,447 of 1,447 pass.
    • test:dist: 39 of 39 pass.
    • Chromium end-to-end: 13 of 13 pass.

What I verified at 497acc30 (38cac008 changes only how the conflict error names the option):

  • Wire format against feat(qwp): let QWP senders choose the owner of the tables and columns they auto-create questdb#8504 (head 7e1fe35c):
    • The server's canonical encoding matches encodeQwpOwnedBy.
    • + is taken literally in the header.
    • An owner refusal comes back as a text/plain 403 with a Content-Length, so the client picks up its reason.
  • Against a real QuestDB nightly (10.2.1-SNAPSHOT, without #8504):
    • Setting owned_by fails with QwpOwnedByMismatchError because the server sends no echo, as the docs say.
    • A bad credential is classified as at BASE, now with reason: "Unauthorized".
  • Rejected upgrades, now reported one event-loop turn later: kind, status, retry flag and whether the sweep stops all matched BASE in each case I tried:
    • a reset right after the response;
    • a reset after a short delay;
    • the response and the reset arriving together while the event loop was busy;
    • a body arriving late, which gives no reason but is still reported promptly.

Limitations: I didn't run against a server that includes #8504 or the Enterprise PR, so I checked their behavior from source only. I tested connection resets on macOS only.

@glasstiger

Copy link
Copy Markdown
Collaborator Author

Review level 3 (requested, full pass). PR #82 at HEAD 38cac008, compared with BASE 1d99d3fc. I skipped the 588 generated docs/** files.

Verdict: approve. I found no Critical or Moderate issues and one Minor doc comment.

Critical

None.

Moderate

None.

Minor

  1. An internal doc comment lists only two of the four values its parameter takes (in-diff).
    • packages/client-core/src/_qwp/owned-by.ts:65-66 says option is "ownedBy, or owned_by on a connect string". assertNoQwpOwnedByHeaderConflict (:94-95) refers back to that sentence.
    • Callers also pass:
      • "qwp.webSocket.ownedBy" in packages/nodejs-client/src/options.ts:658-664
      • "ingress.ownedBy" in packages/nodejs-client/src/qwp-node/client-config.ts:1149-1157 and packages/browser-client/src/qwp.ts:1466
    • Both comments are @internal, and TypeDoc runs with excludeInternal, so the published docs are unaffected.
    • Fix: describe option as the option name as the caller spelled it, and list all four values.

Adjacent findings

None.

Coverage map

  • The test gate passes, with no coverage gaps.
  • I applied nine mutations one at a time, and the existing tests caught every one. The mutated code covered:
    • the canonical encoding and the echo check;
    • recognizing an owner gap and quarantining the orphan slot;
    • binding the owner for the sender and for the orphan drainer;
    • reading only a complete rejection body;
    • removing qwp_owned_by from the browser's REST bootstrap URL;
    • keeping owner gaps out of the durable-ACK events.

Summary

  • Gates: correctness passes; tests pass with no gaps.
  • Findings: 1 Minor, inside the diff. Nothing breaks unchanged callers.
  • Submodules: none changed.
  • PR metadata: the title and all nine commit subjects follow Conventional Commits. One non-blocking gap in the description: its Compatibility section names QwpUpgradeError.reason, but not the two other new optional public fields, QwpNodeUpgradeRejection.body and QwpUpgradeErrorDetails.reason.
  • Deliberate tradeoffs (documented in QWP.md or the PR body):
    • A Sender built from a connect string copies its typed headers, so editing them later no longer reaches reconnects.
    • A memory-replay sender started without async stops on an unconfirmed owner.
    • Orphan slots replay under the adopting sender's owner, and a 403 refusal of that owner quarantines the slot.
    • Rejected-upgrade messages gain [reason=…], and a text/plain rejection is reported one event-loop turn later.
    • Browsers cannot confirm the owner.

What I verified at 38cac008, in scratch worktrees that I have since removed:

  • Unit tests: 1,447 of 1,447 pass. I did not run the Docker-based ILP integration test; this PR does not touch ILP.
    • Two failures in the full run were environmental and passed on rerun. The interop test needed the questdb-client-test submodule checked out. One egress test timed out under full-suite load, then passed on its own in 4.2s against its 5s limit.
  • Static and package checks: all three typechecks, ESLint, Prettier, the build and check:packages pass.
  • Distribution checks: test:dist (39 tests) passes, as do the dist typings, including under TypeScript 4.9.
  • Real browser: the Chromium suite passes, 13 of 13, including the new owner test.
  • Wire format against the server source: I checked against feat(qwp): let QWP senders choose the owner of the tables and columns they auto-create questdb#8504 at 7e1fe35c.
    • encodeQwpOwnedBy matches the server's encodeOwnedBy byte for byte: the same characters stay unescaped and the hex digits are upper case.
    • The server decodes + in the URL parameter as a space, which matches the browser's URLSearchParams encoding.
  • Rejected upgrades: a short text/plain rejection closed normally or reset by the server is classified as at BASE (same kind, status and retry flags), now with the reason added.
  • node:util MIMEType: behaves the same, with no warnings, on Node 20.11, 22.17 and 24.3.
  • Connect-string key owned_by: ;; escapes, = inside the value and surrounding spaces are kept verbatim. An empty or duplicate key is rejected, and the ILP and UDP transports reject the key.

Limitations: I ran nothing against a QuestDB build that includes #8504 or the Enterprise PR, so their server-side behaviour is checked from source only.

@glasstiger glasstiger added enhancement New feature or request READY qwp labels Dec 1, 2026
@kafka1991

Copy link
Copy Markdown

Verdict: approve. I found no Critical or Moderate issues and one Minor doc-comment inaccuracy. This was a level 3 review (full pass) of PR #82 at HEAD 38cac008 against BASE 1d99d3fc. I skipped the generated docs/** and packages/*/dist/**.

PR title and description

  • The title and all nine commits follow Conventional Commits.
  • The description explains the user impact, the retry policy, how this differs from the Java client, and the two behaviour changes.
  • owned_by is wired through client-config.ts, rejected on ILP and UDP connect strings, and documented in QWP.md. The public-API contracts are updated.
  • One small gap: the Compatibility section doesn't mention two other new optional public fields, QwpNodeUpgradeRejection.body and QwpUpgradeErrorDetails.reason. An earlier review on the PR already raised this.

Critical

None.

Moderate

None.

Minor

  1. An internal doc comment lists two of the four option names callers pass (in the diff).
    • packages/client-core/src/_qwp/owned-by.ts:65-66 says option is "ownedBy, or owned_by on a connect string". The comment on assertNoQwpOwnedByHeaderConflict (around :95) points back to that sentence.
    • Callers also pass "qwp.webSocket.ownedBy" (options.ts, validateQwpExtraOptions) and "ingress.ownedBy" (client-config.ts normalizeQwpNodeClientOptions, and the browser's resolveQwpBrowserClientOptions).
    • Both comments are @internal, so the published docs are unaffected. An earlier review comment on the PR raised the same point.
    • Fix: describe option as the option name in the caller's spelling.

Adjacent findings

None.

Coverage map

The test gate passes, with no coverage gaps.

What I ran at 38cac008, in temporary worktrees that I have since removed:

Check Result
Unit tests (all except the Docker ILP integration test) 1,447 of 1,447 pass. The 7 changed or new test files also pass on their own: 702 of 702.
typecheck, typecheck:qwp-browser, typecheck:test, ESLint, Prettier All pass
build, check:packages, test:dist Pass (test:dist: 39 of 39)
typecheck:dist, including TypeScript 4.9 Pass
Browser suite in a real browser (system Chrome) 13 of 13 pass, including the new owner test
util.MIMEType and TextDecoder on the Node 20.18.1 floor Work, no warning

I also checked the wire format against the server source (questdb/questdb branch ia_qwp_owned_by):

  • encodeQwpOwnedBy matches the server's encodeOwnedBy on all five server test vectors: the same unreserved set and upper-case hex.
  • The server sends its owner-refusal 403 as text/plain with a Content-Length, in one write. Replaying those exact bytes, the client fills in reason every time, over TCP and TLS.

Summary

  • Gates: correctness passes; tests pass with no gaps.
  • Findings: 1 Minor, inside the diff. Nothing breaks unchanged callers. I checked every changed signature against all its callers (connectQwpNodeIngressInternal, createQwpNodeConnectionFactory, the orphan drainers, qwpConfig), and the new foreground flag behaves exactly like the old startOrphanDrainer argument for every supported caller.
  • Users who don't set ownedBy: durable-ACK events and episode tracking are identical to BASE. The same scripted sequences produce the same event traces at both revisions.
  • Submodules: none changed.
  • Deliberate tradeoffs, documented in QWP.md or the PR body:
    • A Sender built from a ws/wss connect string now copies qwp.webSocket.headers, so editing that object later no longer reaches reconnects.
    • Rejected-upgrade messages gain [reason=…] on both ingress and egress.
    • A text/plain rejection is now reported one event-loop turn later. Rejections with other content types are still reported straight away.
    • A sender with no journal and no async startup stops when the owner is unconfirmed.
    • An adopted orphan slot replays under the adopting sender's owner.
    • A browser cannot confirm the owner.
  • Not covered:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request qwp READY

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants