Skip to content

[SEA-NodeJS] (7/8) Operation lifecycle — cancel / close / finished + INTERVAL parity + napi relocation#384

Draft
msrathore-db wants to merge 3 commits into
msrathore/sea-resultsfrom
msrathore/sea-operation
Draft

[SEA-NodeJS] (7/8) Operation lifecycle — cancel / close / finished + INTERVAL parity + napi relocation#384
msrathore-db wants to merge 3 commits into
msrathore/sea-resultsfrom
msrathore/sea-operation

Conversation

@msrathore-db
Copy link
Copy Markdown
Contributor

@msrathore-db msrathore-db commented May 16, 2026

Stack

Linear stack of 8 PRs landing the M0 + M1 Phase 1 SEA NodeJS work. Merge in order from base ↑ to tip. The tip branch (msrathore/sea-auth-u2m, PR #383) is the single snapshot containing everything in flight — point your test or benchmark harness at it for an end-to-end check.

Pos PR Branch Scope
1/8 #378 sea-abstraction IBackend / ISessionBackend / IOperationBackend interfaces
2/8 #380 sea-napi-binding TS loader + build script for the kernel-provided .node artifact
3/8 #377 sea-errors-logging Kernel ErrorCode → JS error-class mapping (M0 minimum)
4/8 #379 sea-auth PAT auth via useSEA: true
5/8 #382 sea-execution executeStatement + openSession (sessionConfig, initialCatalog/Schema)
6/8 #381 sea-results CloudFetch + Inline Arrow result fetching
7/8 #384 sea-operation cancel / close / finished lifecycle + INTERVAL parity + napi-relocation acceptance (absorbed sea-integration content)
8/8 #383 sea-auth-u2m ← TIP M1 Phase 1 OAuth M2M + U2M (5 review rounds, ZERO HIGH at close)

Companion kernel stack (databricks/databricks-sql-kernel): 8 PRs — root #26 (async-public-api) → #27#25#29#28#30#24#23 (tip).

Policy: new PRs always stack on the current tip. No sibling/parallel topology. No force-pushes on existing PRs unless absolutely necessary; if a PR's content is wrong, add a fix-up commit on top of the stack tip rather than rewriting history.


This PR is position 7/8.

Summary

Operation lifecycle (cancel / close / finished) plus content absorbed from the now-closed PR #385 (sea-integration) during the 2026-05-17 linear-stack restack.

Size note (2533 LOC, over the 800 cap)

This PR is large because three conceptually distinct concerns were stacked together during the linear-stack rebase. Reviewers should walk it commit-by-commit:

Group 1 — Operation lifecycle (~300 LOC, ~3 files)

  • lib/sea/SeaOperationLifecycle.ts
  • lib/sea/SeaOperationBackend.ts
  • cancel() / close() / finished() synthesised behavior
  • Original sea-operation contribution

Group 2 — INTERVAL Y-M + D-T parity (~1274 LOC, ~4 files)

  • lib/sea/SeaArrowIpcDurationFix.ts — JS-side IPC FlatBuffer rewrite for Arrow Duration → Int64 with metadata
  • Conversion of kernel's Duration columns to thrift's "Y-M" and "D HH:mm:ss.fffffffff" text format
  • Absorbed from sea-integration@4d80267 during the linear-stack rebase
  • Tracked for a kernel-side cleanup in Phase 2 backlog (kernel.md Some CI improvements #19 krn-interval-text-format)

Group 3 — napi source relocation acceptance (~900 LOC, ~6 files, mostly deletions)

  • Deletion of vendored native/sea/src/*.rs (Rust napi binding source)
  • Kernel's #25 napi-classes adds the canonical napi crate; this drops the duplicate JS-side copy
  • Absorbed from sea-integration@1226b62 during the linear-stack rebase
  • The cross-repo split (NodeJS deletion + kernel addition) ideally would've been one coordinated change; tracked as a topology artifact in the workflow docs

Test plan

  • ✅ M0 unit tests (~95 SEA tests at sea-integration anchor)
  • ✅ Cancel/close lifecycle e2e (cancel observed 64–80ms)
  • ✅ 25/25 datatype parity tests including INTERVAL Y-M + D-T (byte-identical vs thrift)
  • ✅ Native artifact built from kernel's napi/ crate (kernel PR #25); no JS-side Rust source needed

Draft until you give the go for review.

Co-authored-by: Isaac

@github-actions
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).

Rust source changes (native/sea/src/connection.rs + statement.rs) deferred to kernel repo PR #29 (kernel-napi-statement-validity) since napi/src now lives in databricks-sql-kernel/napi/.

SeaOperationBackend.ts conflict resolved using integration commit 3da7aa7 (combining sea-results fetch pipeline with sea-operation lifecycle helpers).
- YEAR-MONTH: convert Arrow Interval[YearMonth] to thrift "N-M" string
  format (with leading "-" for negatives) in Phase 1 of converter
- DAY-TIME: pre-process IPC schema bytes before apache-arrow@13 decode
  (which predates the Arrow Duration type id 18) to remap Duration ->
  Int64 with original time unit preserved in `databricks.arrow.duration_unit`
  field metadata; convert Int64 duration values to thrift
  "D HH:mm:ss.fffffffff" string format

Both interval flavours are formatted by the same converter helper
(formatDayTimeFromTotal); the duration_unit metadata gates between the
native Arrow Interval Int32Array path and the rewritten Duration Int64
path. No apache-arrow bump, no node_modules edits, no kernel-side change.

New: lib/sea/SeaArrowIpcDurationFix.ts (FlatBuffer rewriter using
apache-arrow's internal fb/* accessors).

M0 datatype parity now 25/25.
Resolves the modify/delete conflict from merging sea-napi-binding:
sea-integration had the StatementInner ValidityFlag fix in
native/sea/src/statement.rs (inherited via sea-operation merge), while
sea-napi-binding wants those files deleted because the Rust source
now lives in the kernel workspace at databricks-sql-kernel/napi/.

Resolution: propagate the StatementInner fix to the kernel napi crate
(commit a8d8df7 on krn-napi-binding), then accept the deletion here.
Built artifacts (.node, .d.ts) are repopulated by
`npm run build:native` which delegates to the kernel workspace.

native/sea/ now contains only README.md and the generated index.d.ts;
index.linux-x64-gnu.node sits next to it as a build artifact.
@msrathore-db msrathore-db force-pushed the msrathore/sea-operation branch from e06a5e8 to 9b057f0 Compare May 17, 2026 13:22
@msrathore-db msrathore-db changed the base branch from main to msrathore/sea-results May 17, 2026 13:22
@github-actions
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).

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.

1 participant