Repository navigation
fix(napi): propagate StatementInner ValidityFlag fix from sea-operation (re-target to main) - #78
Merged
Conversation
When the binding's Statement wrapper was first written it held only
the kernel's ExecutedStatement. The sea-operation feature surfaced a
bug: kernel Statement::Drop invalidates its produced ExecutedStatement
via a shared ValidityFlag, so the parent kernel Statement constructed
in Connection::execute_statement was dropping at the end of that
function and rendering every subsequent cancel()/close() on the
executed handle a no-op throwing InvalidStatementHandle.
Fix: introduce StatementInner { _parent: KernelStatement, executed }
in the wrapper so both lifetimes are tied. Statement::from_executed
now takes the parent statement alongside the executed handle.
Connection::execute_statement passes both in. ValidityFlag stays set
for as long as JS holds the wrapper.
Originally landed in the nodejs sea-operation worktree (e06a5e8);
relocated here as part of the napi-source move into the kernel
workspace. The integration branch's version was the authoritative one
because it had all downstream feature merges layered in.
Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
Files modified are pre-existing on main (`ea4d398`) — confirmed by running cargo fmt --check against origin/main. Applying canonical rustfmt to clear the workspace-wide `cargo fmt --check` failure that was blocking DA approval on this PR. Pure mechanical fmt; no semantic change. Co-authored-by: Isaac Signed-off-by: Madhavendra Rathore <madhavendra.rathore@databricks.com>
vikrantpuppala
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-targets the StatementInner ValidityFlag fix that was originally landed in PR #29 against
main.PR #29 (
fix(napi): propagate StatementInner ValidityFlag fix from sea-operation (stack 4/8)) was inadvertently merged into the stack-parent branchmsrathore/kernel-napi-classesinstead of intomain. Sincemsrathore/kernel-napi-classes(PR #25) has since been squash-merged intomain, the validity fix never reachedmain—ea4d398onmainis just the PR #25 squash, missing the validity flag fix.What's in this PR
Two commits:
bdc1e2a— cherry-pick of PR fix(napi): propagate StatementInner ValidityFlag fix from sea-operation (stack 4/8) #29's commit4acde6a("napi: propagate StatementInner ValidityFlag fix from sea-operation"). Untouched content; pure cherry-pick. Changesnapi/src/connection.rs+napi/src/statement.rs(90 lines).4245a2c—cargo fmt --allchore-fixup to clear inherited rustfmt drift onsrc/metadata/static_data.rs,src/metadata/type_mapping.rs,src/reader/mod.rs. These files are pre-existing onmainatea4d398(confirmed by runningcargo +stable fmt --all -- --checkagainstorigin/main). Pure mechanical fmt; no semantic change.Why the validity fix matters
From PR #29's commit message: kernel
Statement::Dropinvalidates its producedExecutedStatementvia a sharedValidityFlag. The parent kernelStatementconstructed inConnection::execute_statementwas dropping at the end of that function, rendering every subsequentcancel()/close()on the executed handle a no-op throwingInvalidStatementHandle.This PR introduces
StatementInner { _parent: KernelStatement, executed }so both lifetimes are tied.Statement::from_executednow takes the parent statement alongside the executed handle.Connection::execute_statementpasses both in.ValidityFlagstays set for as long as JS holds the wrapper.Gates
Verified on this branch (
4245a2c):cargo +stable fmt --all -- --check— EXIT 0cargo clippy --all-targets -- -D warnings— EXIT 0cargo test --lib— 441/441 passingHistory
msrathore/kernel-napi-classesatf4fa428instead ofmain).