Skip to content

feat(napi): napi-rs binding crate skeleton (re-targets #27 against main) - #66

Merged
vikrantpuppala merged 1 commit into
mainfrom
msrathore/kernel-napi-skeleton-to-main
May 25, 2026
Merged

vikrantpuppala merged 1 commit into
mainfrom
msrathore/kernel-napi-skeleton-to-main

Conversation

@msrathore-db

Copy link
Copy Markdown
Collaborator

Re-targets #27 against main.

What happened

PR #27 was stacked on PR #26's branch (msrathore/kernel-async-public-api). When PR #26 squash-merged into main (commit f4a18ba), PR #27's base was not re-pointed to main, so merging PR #27 landed its content on the now-stale msrathore/kernel-async-public-api branch (merge commit b73a688) rather than on main. Result: the napi-skeleton content is not on main despite #27 being marked as merged.

What this PR does

Cherry-picks the squash commit from #27 (b73a688) onto a fresh branch from current main. Content is identical to what #27 should have landed — same 12 files, same +3771 / -2 line counts.

Review history

All review approval is on #27; this PR carries the identical diff. Re-review is not required but pre-commit gate has been verified:

  • cargo fmt --all -- --check — clean
  • cargo clippy --all-targets --locked -- -D warnings — clean
  • cargo test --locked — 14 / 14 pass
  • cargo build --release --locked — clean

Stack context

This is the second of an 8-PR kernel stack (PR #26 was the first; #25/#29/#28/#30/#24/#23 follow). Each subsequent PR's base will need to be updated to point at this PR's branch (msrathore/kernel-napi-skeleton-to-main) once it merges to main, mirroring the same re-target pattern.

Files

  • .github/workflows/napi-checks.yml — CI workflow for the napi crate (fmt + clippy + test + release-build with --locked)
  • Cargo.toml — root workspace tweak so the napi sub-crate's standalone-workspace pattern works
  • napi/.gitignore, napi/Cargo.toml, napi/Cargo.lock, napi/build.rs, napi/package.json — crate manifest + napi-rs build glue
  • napi/src/lib.rs — crate root, version() napi export
  • napi/src/error.rs — kernel Error → napi Error envelope mapper + pyo3 field-parity guards
  • napi/src/util.rs — guarded() panic-catching wrapper + panic = "abort" compile-time guard
  • napi/src/runtime.rs — captured tokio Handle accessor + PERF NOTE + async-cleanup-hook TODO for PR feat(napi): openSession / Connection / Statement napi surface (stack 3/8) #25
  • napi/src/logger.rs — Round-3 logger bridge stub with inline design sketch

…lope + util + runtime + logger (stack 2/8) (#27)

## Stack

Linear stack of 8 PRs on `databricks/databricks-sql-kernel` landing the
**SEA-driver kernel-side enablement** work. Merge in order from base ↑
to tip. The tip branch (`msrathore/krn-status-fields`, PR
[#23](#23)) is
the single snapshot containing every kernel-side change in flight.

| Pos | PR | Branch | Scope |
|---|---|---|---|
| 1/8 |
[#26](#26) |
`kernel-async-public-api` | Remove `block_on` from ResultStream +
Send-safety on Statement + rustls-tls + e2e test ported from
[#20](#20) |
| 2/8 |
[#27](#27) |
`kernel-napi-skeleton` | napi-rs binding crate skeleton: Cargo manifest
+ lib + error envelope + util + runtime + logger |
| 3/8 |
[#25](#25) |
`kernel-napi-classes` | Database / Connection / Statement / ResultStream
napi classes |
| 4/8 |
[#29](#29) |
`kernel-napi-statement-validity` | StatementInner ValidityFlag fix
propagated from sea-operation |
| 5/8 |
[#28](#28) |
`kernel-oauth-error-class` | Reclassify OAuth token-exchange failures as
`Error::unauthenticated()` (2-line fix in auth/oauth/m2m.rs + u2m.rs) |
| 6/8 |
[#30](#30) |
`krn-connection-pool-default-bump` | Bump
`HttpConfig.pool_max_idle_per_host` default from 10 → 100 |
| 7/8 |
[#24](#24) |
`krn-tls-public-api` | Expose `TlsConfig` fields (custom_ca_cert +
accept_self_signed + skip_hostname_verification) + stop discarding in
session.rs |
| 8/8 |
[#23](#23) |
`krn-status-fields` **← TIP** | Expose 5 status accessors on
`ExecutedStatement` (num_modified_rows / progress / display_message /
diagnostic_info / error_details_json) |

**Companion NodeJS stack** (`databricks/databricks-sql-nodejs`): 8 PRs —
root
[#378](databricks/databricks-sql-nodejs#378)
(sea-abstraction) →
[#380](databricks/databricks-sql-nodejs#380) →
[#377](databricks/databricks-sql-nodejs#377) →
[#379](databricks/databricks-sql-nodejs#379) →
[#382](databricks/databricks-sql-nodejs#382) →
[#381](databricks/databricks-sql-nodejs#381) →
[#384](databricks/databricks-sql-nodejs#384) →
[#383](databricks/databricks-sql-nodejs#383)
(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 2/8.**

## Summary

Lands the napi-rs binding crate as a workspace member with
**infrastructure only**: no exported classes yet. ~442 LOC across 10
files.

**Files added:**
- `Cargo.toml` — workspace membership declaration
- `napi/Cargo.toml`, `napi/build.rs`, `napi/package.json`,
`napi/.gitignore` — crate manifest + napi-rs build glue
- `napi/src/lib.rs` — entry point declaring 4 infra modules (no class
modules yet); exports a smoke-test `version()` fn
- `napi/src/error.rs` — formatter for the `__databricks_error__:<json>`
napi error envelope decoded by the JS-side adapter
- `napi/src/util.rs` — shared helpers
- `napi/src/runtime.rs` — tokio multi-thread runtime helper
- `napi/src/logger.rs` — `tracing`-to-JS logger bridge stub

## Compilability

`cargo check -p databricks-sea-native` is clean. The crate compiles
standalone and exposes only the `version()` probe — the JS-side loader
would find a valid `.node` but no functional API yet. This split makes
the infra layer reviewable on its own; the next PR adds the user-facing
surface.

## Tracking

- [PECOBLR-2670](https://databricks.atlassian.net/browse/PECOBLR-2670) —
Make the async interface for rust kernel — napi crate skeleton
- Parent epic:
[PECOBLR-2666](https://databricks.atlassian.net/browse/PECOBLR-2666)

Co-authored-by: Isaac

[PECOBLR-2670]:
https://databricks.atlassian.net/browse/PECOBLR-2670?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
@msrathore-db
msrathore-db requested a review from a team as a code owner May 25, 2026 07:25
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