test: ignore latest_version_hint.json in manifest dir assertions

Lance v7.0.0-rc.1 writes _versions/latest_version_hint.json on
non-lexically-ordered stores (e.g. the local filesystem) to speed up
latest-version lookup. The V2-manifest-path tests iterate the whole
_versions directory and asserted every entry matches the manifest
filename pattern; filter to *.manifest files so the hint file is ignored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Will Jones
2026-05-22 12:54:31 -07:00
parent 05504f280a
commit 02b112e931
2 changed files with 21 additions and 7 deletions

View File

@@ -7,6 +7,13 @@ import * as tmp from "tmp";
import { Connection, Table, connect, connectNamespace } from "../lancedb";
import { LocalTable } from "../lancedb/table";
// The `_versions` directory may also contain `latest_version_hint.json`, which
// Lance writes on non-lexically-ordered stores (e.g. the local filesystem) to
// speed up latest-version lookup. Only assert on manifest files.
function manifestFiles(versionsDir: string): string[] {
return readdirSync(versionsDir).filter((f) => f.endsWith(".manifest"));
}
describe("when connecting", () => {
let tmpDir: tmp.DirResult;
beforeEach(() => {
@@ -171,7 +178,7 @@ describe("given a connection", () => {
let manifestDir =
tmpDir.name + "/test_manifest_paths_v2_empty.lance/_versions";
readdirSync(manifestDir).forEach((file) => {
manifestFiles(manifestDir).forEach((file) => {
expect(file).toMatch(/^\d{20}\.manifest$/);
});
@@ -180,7 +187,7 @@ describe("given a connection", () => {
})) as LocalTable;
expect(await table.usesV2ManifestPaths()).toBe(true);
manifestDir = tmpDir.name + "/test_manifest_paths_v2.lance/_versions";
readdirSync(manifestDir).forEach((file) => {
manifestFiles(manifestDir).forEach((file) => {
expect(file).toMatch(/^\d{20}\.manifest$/);
});
});
@@ -199,14 +206,14 @@ describe("given a connection", () => {
const manifestDir =
tmpDir.name + "/test_manifest_path_migration.lance/_versions";
readdirSync(manifestDir).forEach((file) => {
manifestFiles(manifestDir).forEach((file) => {
expect(file).toMatch(/^\d\.manifest$/);
});
await table.migrateManifestPathsV2();
expect(await table.usesV2ManifestPaths()).toBe(true);
readdirSync(manifestDir).forEach((file) => {
manifestFiles(manifestDir).forEach((file) => {
expect(file).toMatch(/^\d{20}\.manifest$/);
});
});