mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
Refs #4848 ## Problem With the table at version 2, `branches.create("exp", undefined, 1.5)` silently forked from version 1 and left the new branch missing the second row. With `exp` at version 3, both `branches.checkout("exp", 2.5)` and `openTable("my_table", undefined, { branch: "exp", version: 2.5 })` returned version 2 and its two rows. N-API coerced these arguments to `i64` before Rust could validate them (`nodejs/src/table.rs:2698` and `nodejs/src/table.rs:2743`). ## Change `Branches.create` and `Branches.checkout` now use the existing TypeScript integer validator before calling N-API (`nodejs/lancedb/table.ts:2759` and `nodejs/lancedb/table.ts:2773`). Creation rejects with `fromVersion must be a non-negative integer` and creates no branch. Both reads reject with `version must be a non-negative integer` because opening a named branch delegates to the same checkout method (`nodejs/lancedb/connection.ts:830`). Tag-based creation rejects a simultaneous source version through the native source conflict check (`nodejs/src/table.rs:2701`). With no branch or with `branch: "main"`, `openTable` uses `Table.checkout` (`nodejs/lancedb/connection.ts:832`). That separate numeric checkout path and tag version validation are covered by #4916. ## Tests Ran from `nodejs` on macOS arm64 using the published beta.26 native binding built from the base revision. The two regressions failed on the base. The patched branch run passed 34 tests, and the Node suite passed 1,885 tests with 27 skipped. Live Enterprise and S3 integrations were outside this run. ```sh env -u OPENAI_API_KEY -u LANCEDB_API_KEY -u S3_TEST ./node_modules/.bin/jest --runInBand --runTestsByPath __test__/table.test.ts --testNamePattern='branch' --no-verbose env -u OPENAI_API_KEY -u LANCEDB_API_KEY -u S3_TEST ./node_modules/.bin/jest --runInBand --no-verbose ./node_modules/.bin/tsc -b ./node_modules/.bin/tsc --noEmit -p __test__/tsconfig.json ./node_modules/.bin/biome ci . ``` The package's TypeDoc and postprocessing commands also passed, and the generated JavaScript API reference matched the checked-in files. Prepared with AI assistance (Codex and Claude Code) and reviewed with GitHub Copilot. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>