From 4e7d5c0d1a5b0e2abf45b84aa7bce5fc7b985a69 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Tue, 1 Dec 2026 13:16:02 +0800 Subject: [PATCH] fix(node): link standalone Rust tests without Node (#5321) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Node binding's Rust tests construct and drop `napi::Error`. Its cleanup code references Node-API symbols, which Node supplies when it loads the addon. Standalone Rust test executables have no Node host, so `lancedb-nodejs` fails at link time. [Linux `build-no-lock`](https://github.com/lancedb/lancedb/actions/runs/46573309068/job/142389591633) ยท [macOS 15 `--locked` test job](https://github.com/lancedb/lancedb/actions/runs/46574143498/job/142392302720) Enable napi-rs `dyn-symbols` through the dev dependency. Cargo activates it when building the existing Rust tests and uses the original linkage for ordinary addon builds. On `08911d637`, deleting `Cargo.lock` and running `cargo +stable build --profile ci --all-features --tests -p lancedb-nodejs --jobs 2` reproduced the three missing symbols. With the same freshly resolved dependencies, `cargo +stable test --profile ci --all-features --tests -p lancedb-nodejs --jobs 2` linked and passed all 10 tests, including the cause chain and resource metadata assertions. --------- Signed-off-by: Xuanwo --- Cargo.toml | 1 + nodejs/Cargo.toml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 61dfb0e89..aca8b593f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,6 +73,7 @@ log = "0.4" metrics = "0.24" metrics-util = "0.19" moka = { version = "0.12", features = ["future"] } +napi = { version = "3.15.0", default-features = false } object_store = "0.14.1" pin-project = "1.0.7" prost = "0.14" diff --git a/nodejs/Cargo.toml b/nodejs/Cargo.toml index 7cfb2535c..ff3a4e179 100644 --- a/nodejs/Cargo.toml +++ b/nodejs/Cargo.toml @@ -23,7 +23,7 @@ env_logger.workspace = true futures.workspace = true lancedb.workspace = true lance-namespace.workspace = true -napi = { version = "3.15.0", default-features = false, features = [ +napi = { workspace = true, features = [ "napi9", "async", "chrono_date", @@ -45,6 +45,10 @@ aws-lc-rs = "=1.18.1" [build-dependencies] napi-build = "2.3.1" +[dev-dependencies] +# Standalone Rust test binaries have no Node host to resolve Node-API symbols. +napi = { workspace = true, features = ["dyn-symbols"] } + [features] default = ["remote", "lancedb/aws", "lancedb/gcs", "lancedb/azure", "lancedb/dynamodb", "lancedb/oss", "lancedb/huggingface", "lancedb/goosefs", "lancedb/metrics-otel", "lancedb/geo"] fp16kernels = ["lancedb/fp16kernels"]