mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-09-14 14:01:28 +08:00
4b55fb0fc7
* fix(embeddings): de-Lattice the WASM tier (no such package) + enforceable no-stub mode Two honest corrections after discovering @ruvector/lattice-wasm does not exist (npm 404; no 'Lattice' embedder package in the ruvector ecosystem): 1. DE-LATTICE the optional WASM embedder tier. Renamed lattice-wasm.ts → wasm-embedder.ts; removed the fictional 'Lattice' branding and the 404 default package. It is now OPT-IN: EMBED_WASM_PKG defaults to EMPTY (with RUFLO_EMBED_WASM_PKG / back-compat RUFLO_LATTICE_WASM_PKG to point it at a real wasm-bindgen embedder). Unset ⇒ tier is INERT ⇒ embeddings resolve to ruvector ONNX exactly as before (verified _realEmbedding:true). Still fail-closed + tolerant-probing. This turns dead-misleading code into a real, honest, opt-in pluggable primary-tier seam. (The published 3.25.0 release notes + gist were also corrected to state the tier is inactive.) 2. ENFORCEABLE 'no more stubs' — embedding-policy.ts: RUFLO_REQUIRE_REAL_EMBEDDINGS makes every hash last-resort THROW loudly instead of silently returning a semantically-meaningless vector. Guards the three TS embedder sites (neural-tools, vector-db, memory-initializer). Off by default (unchanged degrade behavior); set it in any env that must never serve pseudo-embeddings. Full replacement of the sync/128-dim/native-Rust fallbacks with real vectors is a dims-consistency refactor — this fail-or-serve policy is the safe, enforceable step. Additive · backwards-compatible · fail-closed. Build clean; 47 embedding/policy/ router tests green; flywheel-proof + clean-room-replay guards pass. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01S7GYqnVUVxBfZ5W8znqry3 * chore: untrack runtime proven-config adoption state accidentally swept into the no-stub commit .claude/proven-config.json + .claude/.proven-config-version are per-install runtime adoption state (written by the ADR-177 startup adopt/apply), not source — they were accidentally staged by 'git add -A'. Untrack + gitignore them; revert the runtime change to the tracked agentdb.rvf.lock. No code change.
23 lines
990 B
TypeScript
23 lines
990 B
TypeScript
/**
|
|
* Optional WASM embedder tier — opt-in + fail-closed degradation.
|
|
* Not configured (no RUFLO_EMBED_WASM_PKG) ⇒ inert; callers fall through to
|
|
* ruvector ONNX → hash with zero regression.
|
|
*/
|
|
import { describe, it, expect } from 'vitest';
|
|
import {
|
|
wasmEmbedderAvailable, wasmEmbed, wasmEmbedderModels, EMBED_WASM_PKG, DEFAULT_EMBED_MODEL,
|
|
} from '../src/ruvector/wasm-embedder.js';
|
|
|
|
describe('optional wasm embedder (opt-in, fail-closed)', () => {
|
|
it('is INERT when no package is configured (no 404-by-default)', async () => {
|
|
expect(EMBED_WASM_PKG).toBe(''); // no default package — opt-in only
|
|
expect(await wasmEmbedderAvailable()).toBe(false);
|
|
expect(await wasmEmbed('hello world')).toBeNull(); // → caller falls through to next tier
|
|
expect(wasmEmbedderModels()).toEqual([]);
|
|
});
|
|
|
|
it('exposes a default model + is env-configurable', () => {
|
|
expect(DEFAULT_EMBED_MODEL).toBeTruthy(); // via RUFLO_EMBED_MODEL
|
|
});
|
|
});
|