Skip to content

[SEA-NodeJS] Rename SEA → kernel across the driver (useSEA → useKernel)#428

Merged
msrathore-db merged 1 commit into
mainfrom
msrathore/kernel-rename-v2
Jun 9, 2026
Merged

[SEA-NodeJS] Rename SEA → kernel across the driver (useSEA → useKernel)#428
msrathore-db merged 1 commit into
mainfrom
msrathore/kernel-rename-v2

Conversation

@msrathore-db

Copy link
Copy Markdown
Contributor

Why

The kernel backend can sit on top of any wire protocol (today SEA / Statement Execution API, later others), so the driver shouldn't brand its path "SEA". This renames the driver-layer surface to kernel, matching the Python connector's use_kernel=True, while preserving genuine references to the SEA wire protocol the kernel speaks.

What changed (mechanical, no behavior change)

  • Public option useSEAuseKernel.
  • lib/sea/lib/kernel/; Sea* classes/types → Kernel*; seaCancel/seaClose/seaFinished/seaServerInfoValuekernel*; SEA_DBMS_*/SEA_SERVER_NAMEKERNEL_*.
  • tests/unit/sea/tests/unit/kernel/, tests/e2e/sea/tests/e2e/kernel/ (+ Sea*-named test files).
  • native/sea/native/kernel/build:native, prepack, loader require path, .gitignore, .prettierignore, .npmignore, .gitattributes, and kernel-e2e.yml updated. index.d.ts/index.js regenerated from a fresh build, so the kernel-e2e drift-guard still matches.
  • Driver-prose comments / binding error messages → "kernel".
  • Dropped the dead 'sea' telemetry backend literal (nothing emits it).

Deliberately preserved

The genuine protocol references — "Statement Execution API (SEA)", "SEA REST protocol", "SEA wire", SEA CreateSession wire fields — and the native-packaging regression-guard for the historical garbled @databricks/sea-native-* npm prefix (renaming it would make the guard vacuous).

On the kernel repo

No kernel-repo changes needed. The kernel's own sea naming (SeaRestTransport, etc.) is the genuine SEA wire-protocol implementation — preserved by design. This rename is entirely the Node driver's path branding.

Base

Built on current main (includes directResults #426). Supersedes #415, which was stacked on the now-closed old SEA stack.

Verification

  • tsc clean; npm run lint (eslint lib/** tests/e2e/**) clean; prettier --check clean.
  • Renamed kernel unit suite 261 passing.
  • git grep useSEA0; no stale lib/sea/native/sea/tests/*/sea path refs.
  • useKernel: true validated end-to-end against a live warehouse — SELECT, directResults CREATE+count, and the binding loading from native/kernel/.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

The kernel backend is not restricted to the SEA wire protocol, so the
"SEA" branding on the driver-layer code is misleading. Rename the
driver-side surface to "kernel":

- `lib/sea/Sea*.ts` → `lib/kernel/Kernel*.ts` (backend, session/operation
  backends, auth, native loader, results provider, error mapping, etc.)
- `native/sea/` → `native/kernel/`; `tests/{unit,e2e}/sea/` → `.../kernel/`
- public option `useSEA` → `useKernel`; internal `use_sea` → `use_kernel`;
  telemetry backend tag `'sea'` → `'kernel'`
- config/CI: package.json build:native + prepack paths, .gitignore,
  .npmignore, .prettierignore, .gitattributes, kernel-e2e.yml

Genuine SEA *protocol* references are intentionally preserved (SEA wire
protocol, SEA `row_limit`/`wait_timeout`, "Statement Execution API (SEA)"),
since SEA remains one transport the kernel can sit on.

Bump KERNEL_REV to the current kernel main (b676275); the regenerated
native/kernel/index.{d.ts,js} are byte-identical to the committed
contract, so the kernel-e2e drift-guard stays green.

Verified: build-surface tsc clean, eslint clean, prettier clean, kernel
unit suite green, and a live warehouse run through `useKernel:true`
(SELECT, named-param binding, CREATE/INSERT/SELECT/DROP, async+cancel,
error mapping) all pass.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
@msrathore-db msrathore-db force-pushed the msrathore/kernel-rename-v2 branch from a40b3db to 1969e28 Compare June 9, 2026 10:47
@msrathore-db msrathore-db added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit 26be3be Jun 9, 2026
19 checks passed
msrathore-db added a commit that referenced this pull request Jun 9, 2026
…ssion

Ports the session-level query-tags wiring onto the post-#428 lib/kernel path
(originally lib/sea/SeaBackend, before the SEA→kernel rename). openSession
serializes request.queryTags into the reserved QUERY_TAGS session conf, which
the kernel allowlists (SESSION_CONF_ALLOWLIST) and forwards onto the SEA
CreateSession session_confs — mirroring ThriftBackend.openSession. queryTags
takes precedence over an explicit configuration.QUERY_TAGS.

Verified end-to-end against a live warehouse: the tag lands in
system.query.history.query_tags.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
pull Bot pushed a commit to rebeccalarner/databricks-sql-nodejs that referenced this pull request Jun 10, 2026
…configurable) (databricks#430)

* feat(kernel): wire session-level query tags into KernelBackend.openSession

Ports the session-level query-tags wiring onto the post-databricks#428 lib/kernel path
(originally lib/sea/SeaBackend, before the SEA→kernel rename). openSession
serializes request.queryTags into the reserved QUERY_TAGS session conf, which
the kernel allowlists (SESSION_CONF_ALLOWLIST) and forwards onto the SEA
CreateSession session_confs — mirroring ThriftBackend.openSession. queryTags
takes precedence over an explicit configuration.QUERY_TAGS.

Verified end-to-end against a live warehouse: the tag lands in
system.query.history.query_tags.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>

* fix(kernel): request Thrift-parity OAuth scopes, configurable via oauthScopes

The kernel U2M flow passed no scopes, so it fell through to the kernel's bare
default (all-apis offline_access). The databricks-sql-connector OAuth app is
registered for `sql`, so U2M auth used the wrong scope set. Pass scopes
explicitly from the driver:

  - U2M defaults to ['sql', 'offline_access'] (matches the Thrift driver's
    defaultOAuthScopes), overriding the kernel's all-apis default.
  - M2M defaults to ['all-apis'] (matches Thrift + the kernel's M2M default).
  - Both overridable via a new `oauthScopes` connect option — closing the
    configurability gap with pyo3, which already forwards `scopes` on M2M.

Driver-only change: the napi binding already forwards oauth_scopes and the
kernel's u2m.rs/m2m.rs feed them into the authorize/token request.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>

* fix(kernel): no-op unsupported per-statement options instead of throwing

Per-statement options the kernel backend doesn't honour are now NO-OPs (logged
at warn), not HiveDriverErrors, so call sites written for the Thrift backend are
drop-in on the kernel path:

  - useCloudFetch / useLZ4Compression — kernel-governed perf/format hints
  - stagingAllowedLocalPath — staging not yet exposed on the kernel

Ignoring these can't change query results. Parameter binding (compound/BINARY)
is deliberately NOT no-op'd — a dropped param would silently change results, so
it still throws.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>

* feat(kernel): route OAuth identically to Thrift (strict parity) + custom U2M client id

Make the kernel auth flow selector + client-id resolution byte-for-byte identical
to the Thrift driver (`DBSQLClient.createAuthProvider`):

  - flow     = `oauthClientSecret === undefined ? U2M : M2M`  (strict undefined)
  - clientId = `oauthClientId ?? defaultClientId`             (`??` guards null/undefined only)

No blank/reserved normalization on the OAuth fields — a present-but-degenerate
value (`""` / `"undefined"` / whitespace) is forwarded verbatim, exactly as Thrift
forwards it. This removes every divergence from the Thrift backend across the full
(clientId × clientSecret) input matrix (verified). Consequences vs the prior
id-presence routing:

  - `oauthClientId` + no secret now runs U2M (browser) and forwards the id as a
    custom U2M client (Thrift does the same).
  - M2M with no/blank id no longer throws "id required" — it uses the default
    client (`?? defaultClientId`), matching Thrift.
  - A present-but-empty/`"undefined"` secret routes to M2M (not U2M), matching
    Thrift's strict `=== undefined` check.

Trade-off (accepted for parity): this re-imports Thrift's env-stringification
behaviour — a secret/id env var that resolved to `""`/`"undefined"` is taken
literally rather than treated as unset.

Updated the auth unit tests (u2m/m2m/edge-cases) to assert the strict-parity
matrix.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>

* chore(kernel): bump KERNEL_REV to kernel main (statement-level query tags + proxy + UA)

Bump the pinned kernel from b676275 to 34b4c20 (current kernel main), which
brings:
  - databricks#150 — per-statement query tags on the SEA wire (native query_tags array).
    This is what makes `executeStatement(sql, { queryTags })` actually reach the
    server on the kernel path — bringing statement-level query tags to parity
    with the Thrift backend (the driver already serialized them into
    statement_conf["query_tags"]; the kernel previously dropped that before the
    wire). Verified e2e: the tag now lands in system.query.history.query_tags.
  - databricks#129 — programmatic HTTP/HTTPS proxy + per-connection socket timeout
    (additive optional napi ConnectionOptions fields; refreshed in index.d.ts).
  - databricks#151 — caller User-Agent overwrites the kernel base UA for accurate
    query-source attribution.

Refreshes the committed napi types (native/kernel/index.d.ts) accordingly; the
new fields are optional, so no driver-side change is required.

Co-authored-by: Isaac
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>

---------

Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
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.

2 participants