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.
25 lines
964 B
TypeScript
25 lines
964 B
TypeScript
/**
|
|
* Embedding policy — "no more stubs" enforcement (RUFLO_REQUIRE_REAL_EMBEDDINGS).
|
|
*/
|
|
import { describe, it, expect, afterEach } from 'vitest';
|
|
import { requireRealEmbeddings, enforceNoStub } from '../src/memory/embedding-policy.js';
|
|
|
|
const KEY = 'RUFLO_REQUIRE_REAL_EMBEDDINGS';
|
|
afterEach(() => { delete process.env[KEY]; });
|
|
|
|
describe('embedding policy (no-stub strict mode)', () => {
|
|
it('is off by default — enforceNoStub is a no-op (degrade allowed)', () => {
|
|
delete process.env[KEY];
|
|
expect(requireRealEmbeddings()).toBe(false);
|
|
expect(() => enforceNoStub('x')).not.toThrow();
|
|
});
|
|
|
|
it('when strict, a hash last-resort THROWS loudly instead of returning a stub', () => {
|
|
for (const v of ['1', 'true', 'strict', 'on']) {
|
|
process.env[KEY] = v;
|
|
expect(requireRealEmbeddings()).toBe(true);
|
|
expect(() => enforceNoStub('neural-tools.generateEmbedding')).toThrow(/no-stub.*real embeddings required/i);
|
|
}
|
|
});
|
|
});
|