Skip to content

Commit 26be3be

Browse files
authored
[SEA-NodeJS] Rename SEA → kernel across the driver (useSEA → useKernel) (#428)
Rename SEA → kernel across the driver (useSEA → useKernel) 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>
1 parent 4804f1e commit 26be3be

70 files changed

Lines changed: 975 additions & 927 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ Dockerfile* text
3636
# crate; regenerated by `npm run build:native`. Tell git/GitHub they're
3737
# machine-generated so they collapse in diffs and are excluded from
3838
# blame and language stats.
39-
native/sea/index.d.ts linguist-generated=true
40-
native/sea/index.js linguist-generated=true
39+
native/kernel/index.d.ts linguist-generated=true
40+
native/kernel/index.js linguist-generated=true

.github/workflows/kernel-e2e.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
name: Kernel E2E Tests
22

3-
# Runs the SEA backend e2e suite (tests/e2e/sea/**) against a real
3+
# Runs the kernel backend e2e suite (tests/e2e/kernel/**) against a real
44
# Databricks warehouse with a freshly-built napi-rs kernel binding.
55
#
66
# The kernel is a private repo with no published binary artifact. We pin
77
# a kernel SHA in the `KERNEL_REV` file at the repo root, check the kernel
88
# out via a GitHub App token, and run `npm run build:native` to compile
9-
# the napi binding into native/sea/ in the same checkout the tests run
9+
# the napi binding into native/kernel/ in the same checkout the tests run
1010
# against. Bumping `KERNEL_REV` is the ONLY way to pick up a new kernel
1111
# version — this keeps the driver <-> kernel pair bisectable, so a driver
1212
# change and the kernel revision it depends on always land together.
1313
#
14-
# Why this exists: the committed native/sea/index.d.ts + index.js are the
14+
# Why this exists: the committed native/kernel/index.d.ts + index.js are the
1515
# TypeScript declarations and the napi-rs platform router; the actual
1616
# `.node` binary is gitignored (large, per-platform) and is NOT in the
17-
# repo. The standard `main.yml` e2e job has no binary, so its SEA suite
17+
# repo. The standard `main.yml` e2e job has no binary, so its kernel suite
1818
# skips (it gates on DATABRICKS_PECOTESTING_* secrets it doesn't set).
19-
# This workflow is what actually exercises the SEA path end-to-end against
19+
# This workflow is what actually exercises the kernel path end-to-end against
2020
# a known kernel revision.
2121
#
2222
# Gate semantics:
2323
# - Plain PR events post a synthetic-success check so the required
24-
# "Kernel E2E" check doesn't block PRs that don't touch the SEA path.
24+
# "Kernel E2E" check doesn't block PRs that don't touch the kernel path.
2525
# Real tests run in the merge queue.
2626
# - `kernel-e2e` label triggers a preview run on the PR; the label is
2727
# auto-removed on `synchronize` for the same security reason.
28-
# - merge_group fires the real gate — runs when SEA-relevant files
28+
# - merge_group fires the real gate — runs when kernel-relevant files
2929
# changed, auto-passes otherwise.
3030
#
3131
# Required external setup (one-time, by a repo admin):
@@ -81,7 +81,7 @@ jobs:
8181
8282
# ───────────────────────────────────────────────────────────────
8383
# Synthetic success on every non-label PR event so the required
84-
# "Kernel E2E" check doesn't permablock PRs that don't touch SEA
84+
# "Kernel E2E" check doesn't permablock PRs that don't touch kernel
8585
# code. Real run happens in the merge queue (or via explicit label).
8686
# ───────────────────────────────────────────────────────────────
8787
skip-kernel-e2e-pr:
@@ -112,7 +112,7 @@ jobs:
112112
});
113113
114114
# ───────────────────────────────────────────────────────────────
115-
# Detect whether SEA-relevant files changed. Used by both the
115+
# Detect whether kernel-relevant files changed. Used by both the
116116
# labelled-PR path and the merge-queue path to decide between
117117
# "really run the suite" and "auto-pass the check".
118118
# ───────────────────────────────────────────────────────────────
@@ -148,7 +148,7 @@ jobs:
148148
ref: ${{ steps.refs.outputs.head_sha }}
149149
fetch-depth: 0
150150

151-
- name: Detect SEA-relevant changes
151+
- name: Detect kernel-relevant changes
152152
id: changed
153153
env:
154154
HEAD_SHA: ${{ steps.refs.outputs.head_sha }}
@@ -157,18 +157,18 @@ jobs:
157157
CHANGED=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
158158
echo "Changed files:"
159159
echo "$CHANGED"
160-
# Run when the SEA driver layer, the napi binding contract, SEA
160+
# Run when the kernel driver layer, the napi binding contract, kernel
161161
# e2e tests, this workflow, the kernel revision pin, or core deps
162162
# move.
163-
if echo "$CHANGED" | grep -qE "^(lib/sea/|native/sea/|tests/e2e/sea/|tests/unit/sea/|\.github/workflows/kernel-e2e\.yml|KERNEL_REV|package\.json|package-lock\.json)"; then
163+
if echo "$CHANGED" | grep -qE "^(lib/kernel/|native/kernel/|tests/e2e/kernel/|tests/unit/kernel/|\.github/workflows/kernel-e2e\.yml|KERNEL_REV|package\.json|package-lock\.json)"; then
164164
echo "run_tests=true" >> "$GITHUB_OUTPUT"
165165
else
166166
echo "run_tests=false" >> "$GITHUB_OUTPUT"
167167
fi
168168
169169
# ───────────────────────────────────────────────────────────────
170170
# Real test job. Builds the napi binding from the pinned kernel SHA
171-
# and runs the SEA e2e suite against the dogfood warehouse.
171+
# and runs the kernel e2e suite against the dogfood warehouse.
172172
# ───────────────────────────────────────────────────────────────
173173
run-kernel-e2e:
174174
needs: detect-changes
@@ -182,17 +182,17 @@ jobs:
182182
checks: write
183183
id-token: write
184184
env:
185-
# The tests/e2e/sea suite reads creds from TWO sources, so we set both:
185+
# The tests/e2e/kernel suite reads creds from TWO sources, so we set both:
186186
#
187-
# 1. Most SEA tests (execution, results, interval-*) read the
187+
# 1. Most kernel tests (execution, results, interval-*) read the
188188
# DATABRICKS_PECOTESTING_* vars directly and skip when absent.
189189
DATABRICKS_PECOTESTING_SERVER_HOSTNAME: ${{ secrets.DATABRICKS_HOST }}
190190
DATABRICKS_PECOTESTING_HTTP_PATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }}
191191
DATABRICKS_PECOTESTING_TOKEN_PERSONAL: ${{ secrets.DATABRICKS_TOKEN }}
192192
#
193193
# 2. `e2e-smoke.test.ts` imports tests/e2e/utils/config.ts, which
194194
# `process.exit(1)`s at module load if ANY E2E_* var is unset — which
195-
# would abort the whole `tests/e2e/sea/**` mocha run before it starts.
195+
# would abort the whole `tests/e2e/kernel/**` mocha run before it starts.
196196
# Mirror main.yml's e2e-test job mapping so the suite loads + runs.
197197
E2E_HOST: ${{ secrets.DATABRICKS_HOST }}
198198
E2E_PATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }}
@@ -304,31 +304,31 @@ jobs:
304304

305305
- name: Build napi binding from pinned kernel
306306
# build:native cd's into ${DATABRICKS_SQL_KERNEL_REPO}/napi, runs the
307-
# napi-rs build, and copies index.* into native/sea/. Pointing it at
307+
# napi-rs build, and copies index.* into native/kernel/. Pointing it at
308308
# the SHA-pinned kernel checkout is what makes the binary match
309309
# KERNEL_REV exactly.
310310
env:
311311
DATABRICKS_SQL_KERNEL_REPO: ${{ github.workspace }}/databricks-sql-kernel
312312
run: npm run build:native
313313

314314
- name: Assert committed binding matches KERNEL_REV
315-
# The committed native/sea/index.d.ts + index.js are the consumer-facing
315+
# The committed native/kernel/index.d.ts + index.js are the consumer-facing
316316
# type contract + platform router; they MUST correspond to the pinned
317317
# kernel. build:native just regenerated them from the KERNEL_REV
318318
# checkout, so any diff means the committed contract drifted from the
319319
# pin — fail loudly and tell the author to commit the regenerated files.
320320
# (The .node binaries are gitignored, so git diff only sees the contract.)
321321
run: |
322-
if ! git diff --exit-code -- native/sea/index.d.ts native/sea/index.js; then
323-
echo "::error::native/sea/index.d.ts / index.js are out of sync with KERNEL_REV ($(tr -d '[:space:]' < KERNEL_REV)). Run 'npm run build:native' against that kernel SHA and commit native/sea/index.*."
322+
if ! git diff --exit-code -- native/kernel/index.d.ts native/kernel/index.js; then
323+
echo "::error::native/kernel/index.d.ts / index.js are out of sync with KERNEL_REV ($(tr -d '[:space:]' < KERNEL_REV)). Run 'npm run build:native' against that kernel SHA and commit native/kernel/index.*."
324324
exit 1
325325
fi
326326
echo "Committed binding matches KERNEL_REV."
327327
328328
- name: Smoke-check binding loads
329-
run: node -e "const b=require('./native/sea'); if(typeof b.version!=='function'){throw new Error('napi binding failed to load')} console.log('kernel binding ok:', b.version())"
329+
run: node -e "const b=require('./native/kernel'); if(typeof b.version!=='function'){throw new Error('napi binding failed to load')} console.log('kernel binding ok:', b.version())"
330330

331-
- name: Run SEA e2e tests
331+
- name: Run kernel e2e tests
332332
# Run through `nyc` (not bare `mocha`) so the `require: ['ts-node/register']`
333333
# in nyc.config.js loads the .ts specs via the CommonJS ts-node hook —
334334
# exactly how main.yml's e2e job runs them. Bare `mocha` has no ts-node
@@ -340,7 +340,7 @@ jobs:
340340
# index 4 (`mocha --config <file> <glob>`): tests/e2e/.mocharc.js derives
341341
# `spec` from `process.argv.slice(4)`. We invoke mocha directly (not via
342342
# `npm run e2e -- <glob>`, whose inner shell mangles `**` to zero files).
343-
run: NODE_OPTIONS="--max-old-space-size=4096" npx nyc --report-dir coverage_kernel_e2e mocha --config tests/e2e/.mocharc.js "tests/e2e/sea/**/*.test.ts"
343+
run: NODE_OPTIONS="--max-old-space-size=4096" npx nyc --report-dir coverage_kernel_e2e mocha --config tests/e2e/.mocharc.js "tests/e2e/kernel/**/*.test.ts"
344344

345345
- name: Post Kernel E2E check (success)
346346
if: success()
@@ -358,7 +358,7 @@ jobs:
358358
completed_at: new Date().toISOString(),
359359
output: {
360360
title: 'Kernel E2E passed',
361-
summary: 'tests/e2e/sea ran green against the pinned kernel SHA.'
361+
summary: 'tests/e2e/kernel ran green against the pinned kernel SHA.'
362362
}
363363
});
364364
@@ -383,7 +383,7 @@ jobs:
383383
});
384384
385385
# ───────────────────────────────────────────────────────────────
386-
# Auto-pass the Kernel E2E check in the merge queue when no SEA-
386+
# Auto-pass the Kernel E2E check in the merge queue when no kernel-
387387
# relevant files changed.
388388
# ───────────────────────────────────────────────────────────────
389389
auto-pass-merge-queue:
@@ -409,7 +409,7 @@ jobs:
409409
conclusion: 'success',
410410
completed_at: new Date().toISOString(),
411411
output: {
412-
title: 'Skipped — no SEA-relevant changes',
413-
summary: 'No files under lib/sea/, native/sea/, tests/e2e/sea/, tests/unit/sea/, KERNEL_REV, package.json, or package-lock.json changed.'
412+
title: 'Skipped — no kernel-relevant changes',
413+
summary: 'No files under lib/kernel/, native/kernel/, tests/e2e/kernel/, tests/unit/kernel/, KERNEL_REV, package.json, or package-lock.json changed.'
414414
}
415415
});

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
node_modules
44
*.log
55
.nyc_output
6+
coverage
67
coverage_e2e
78
coverage_unit
89
.clinic
@@ -11,11 +12,11 @@ dist
1112
*.DS_Store
1213
lib/version.ts
1314

14-
# SEA native binding — copied/generated from kernel workspace by `npm run build:native`.
15-
# The committed contract is `native/sea/index.d.ts` (TypeScript declarations) and
16-
# `native/sea/index.js` (the napi-rs platform router — small, stable, and required in
15+
# kernel native binding — copied/generated from kernel workspace by `npm run build:native`.
16+
# The committed contract is `native/kernel/index.d.ts` (TypeScript declarations) and
17+
# `native/kernel/index.js` (the napi-rs platform router — small, stable, and required in
1718
# the publish tarball so a missing build step can't ship a tarball that can't load).
1819
# The `.node` binaries are large per-platform artifacts and must NOT be committed;
1920
# in production they arrive via the `@databricks/sql-kernel-<triple>` optional deps.
20-
native/sea/index.node
21-
native/sea/index.*.node
21+
native/kernel/index.node
22+
native/kernel/index.*.node

.npmignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
!dist/**/*
44
!thrift/**/*
55

6-
# SEA napi-rs router shim + TypeScript declarations. The router (index.js)
6+
# kernel napi-rs router shim + TypeScript declarations. The router (index.js)
77
# selects the per-platform `.node` artifact from `@databricks/sql-kernel-*`
88
# optionalDependencies (populated when the kernel CI publishes them);
99
# the .d.ts is the consumer-facing type contract.
10-
!native/sea/index.js
11-
!native/sea/index.d.ts
10+
!native/kernel/index.js
11+
!native/kernel/index.d.ts
1212

1313
!LICENSE
1414
!NOTICE

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ package-lock.json
1515
# Generated by napi-rs from the kernel's `napi-binding/napi/` crate;
1616
# regenerated by `npm run build:native`. Format follows napi-rs's
1717
# defaults (no semicolons), not this repo's prettier config.
18-
native/sea/index.d.ts
19-
native/sea/index.js
18+
native/kernel/index.d.ts
19+
native/kernel/index.js

KERNEL_REV

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9c2e2378f9a0bcee7d2750371392c07cac38fc3d
1+
b676275f234b11a68cb4c8a2955d69cb3b786d97

lib/DBSQLClient.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { buildUserAgentString } from './utils';
1818
import IBackend from './contracts/IBackend';
1919
import { InternalConnectionOptions } from './contracts/InternalConnectionOptions';
2020
import ThriftBackend from './thrift-backend/ThriftBackend';
21-
import SeaBackend from './sea/SeaBackend';
21+
import KernelBackend from './kernel/KernelBackend';
2222
import PlainHttpAuthentication from './connection/auth/PlainHttpAuthentication';
2323
import DatabricksOAuth, { OAuthFlow } from './connection/auth/DatabricksOAuth';
2424
import {
@@ -634,12 +634,12 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient, I
634634

635635
this.connectionProvider = this.createConnectionProvider(options);
636636

637-
// M0: `useSEA` is consumed via a non-exported internal-options cast so it
638-
// doesn't ship in the public `.d.ts`. Mirrors Python's `kwargs.get("use_sea")`
637+
// M0: `useKernel` is consumed via a non-exported internal-options cast so it
638+
// doesn't ship in the public `.d.ts`. Mirrors Python's `kwargs.get("use_kernel")`
639639
// pattern (see databricks-sql-python/src/databricks/sql/session.py).
640640
const internalOptions = options as ConnectionOptions & InternalConnectionOptions;
641-
const backend = internalOptions.useSEA
642-
? new SeaBackend({ context: this })
641+
const backend = internalOptions.useKernel
642+
? new KernelBackend({ context: this })
643643
: new ThriftBackend({
644644
context: this,
645645
onConnectionEvent: (event, payload) => this.forwardConnectionEvent(event, payload),

lib/DBSQLLogger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class DBSQLLogger implements IDBSQLLogger {
99
file?: winston.transports.FileTransportInstance;
1010
};
1111

12-
// Subscribers notified on `setLevel(...)` — used by the SEA/kernel backend to
12+
// Subscribers notified on `setLevel(...)` — used by the kernel backend to
1313
// keep the kernel-side log bridge's verbosity in lock-step with this logger.
1414
private levelListeners: Array<(level: LogLevel) => void> = [];
1515

lib/DBSQLOperation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export default class DBSQLOperation implements IOperation {
171171
/**
172172
* Requests operation status. Returns the Thrift wire response for
173173
* back-compat with existing user code. On the Thrift backend the response
174-
* is returned verbatim; on any other backend (e.g. SEA) the response is
174+
* is returned verbatim; on any other backend (e.g. kernel) the response is
175175
* synthesized from the neutral {@link IOperationBackend.status} result,
176176
* with Thrift-only fields (`taskStatus`, `numModifiedRows`, etc.) left
177177
* undefined.

lib/contracts/IBackend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import ISessionBackend from './ISessionBackend';
33

44
/**
55
* Top-level backend dispatch handle. One instance per `DBSQLClient`,
6-
* chosen at `connect()` time based on the `useSEA` flag and never
6+
* chosen at `connect()` time based on the `useKernel` flag and never
77
* re-selected per-call.
88
*/
99
export default interface IBackend {
1010
/**
1111
* Establish backend-level state before any session is opened. Implementations
1212
* consume `options` to build backend-specific connection parameters (e.g. the
13-
* SEA backend derives napi-binding `SeaNativeConnectionOptions` from the auth
13+
* kernel backend derives napi-binding `KernelNativeConnectionOptions` from the auth
1414
* + host fields here). Transport-layer connection providers are owned by
1515
* `DBSQLClient` (via `IClientContext`) and exposed to backends through
1616
* constructor injection.

0 commit comments

Comments
 (0)