- Preserved fastembed's transitive ONNX Runtime instead of forcing an ABI-mismatched runtime cache install.\n- Repaired stale fastembed model caches by downloading missing tokenizer sidecars from the matching Hugging Face model repo.\n- Added regression coverage for the runtime install plan and tokenizer sidecar repair.\n\nFixes #3054
39 lines
1.8 KiB
TypeScript
39 lines
1.8 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import rootManifest from "../../../package.json" with { type: "json" };
|
|
import packageManifest from "../package.json" with { type: "json" };
|
|
import { fastembedRuntimeInstallPlan } from "../src/core/fastembed-runtime";
|
|
|
|
// The fastembed peer is pinned as an exact version (not `catalog:`) because
|
|
// `core/fastembed-runtime.ts` reads it to `bun install` the on-demand embedding
|
|
// runtime — including from bundles where the inlined manifest would otherwise
|
|
// carry an uninstallable `catalog:` spec (#2389). The runtime cache must keep
|
|
// fastembed's own ORT dependency intact because its native addon links against
|
|
// that exact bundled library name (#3054).
|
|
describe("fastembed runtime version pins", () => {
|
|
const catalog = rootManifest.workspaces.catalog;
|
|
|
|
test("fastembed peer pin matches the workspace catalog", () => {
|
|
expect(packageManifest.peerDependencies.fastembed).toBe(catalog.fastembed);
|
|
});
|
|
|
|
test("pins are exact installable versions, not catalog or range specs", () => {
|
|
expect(packageManifest.peerDependencies.fastembed).toMatch(/^\d+\.\d+\.\d+$/);
|
|
expect(packageManifest.peerDependencies["onnxruntime-node"]).toMatch(/^\d+\.\d+\.\d+$/);
|
|
});
|
|
|
|
test("onnxruntime peer pin matches fastembed's native ABI", () => {
|
|
expect(packageManifest.peerDependencies["onnxruntime-node"]).toBe("1.21.0");
|
|
});
|
|
|
|
test("runtime install preserves fastembed's transitive onnxruntime pin", () => {
|
|
const plan = fastembedRuntimeInstallPlan();
|
|
expect(plan.install.dependencies).toEqual({
|
|
fastembed: packageManifest.peerDependencies.fastembed,
|
|
});
|
|
expect(plan.install.overrides).toBeUndefined();
|
|
expect(plan.install.trustedDependencies).toEqual(["onnxruntime-node"]);
|
|
expect(plan.versionKey).toContain("transitive-ort");
|
|
expect(plan.versionKey).not.toContain("forced-ort");
|
|
});
|
|
});
|