parity: /v1/embed cross-runtime probe (5th probe, 8/8 cosine match)

Today's sidecar drop (lakehouse ba928b1) changed Rust's embed
transport from gateway → sidecar → Ollama (2 hops) to gateway →
Ollama directly. Go's embedd has always been direct. A drift here
would mean: same query, different vector → different HNSW top-K →
different staffing recommendations. This probe is the regression
gate for that surface.

Fixtures cover staffing-domain shapes (forklift, welder, OSHA,
dental, CNC) plus stress shapes (unicode "Café résumé ⭐ 你好",
single char "x", 200-word long fixture).

Match metric: cosine similarity ≥ 0.99999. Byte-equal isn't
expected — Go round-trips through []float32 internally while Rust
stays at Vec<f64>, so JSON serialization introduces small float
drift. What matters operationally is vector direction (HNSW uses
cosine distance), and both runtimes preserve it when calling the
same Ollama with the same model.

Result: **8/8 fixtures match** including the long + unicode cases.
Sidecar drop didn't disturb the embed surface. The probe also
forces both endpoints to use `nomic-embed-text` so the v1-vs-v2-moe
default difference doesn't pollute the comparison.

5th cross-runtime parity probe joining the family:
  - validator_parity (6/6)
  - extract_json_parity (12/12)
  - session_log_parity (4/4)
  - materializer_parity (2/2)
  - embed_parity (8/8) — this commit

Cumulative: 32/32 parity assertions across 5 probes covering
HTTP shape (validator, embed), CLI output (materializer), unit
behavior (extract_json), and persisted shape (session_log).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
root
2026-05-02 06:28:40 -05:00
co-authored by Claude Opus 4.7
parent a21a34b057
commit b314ed1c94
2 changed files with 154 additions and 0 deletions
@@ -0,0 +1,17 @@
# /v1/embed cross-runtime parity probe
**Date:** 2026-05-02T11:28:19Z
**Rust:** `http://127.0.0.1:3100/ai/embed` · **Go:** `http://127.0.0.1:4110/v1/embed`
**Model:** `nomic-embed-text` (forced — overrides each side's default)
**Match metric:** cosine similarity ≥ `0.99999`
Identical text → both endpoints. Cosine compares vector
DIRECTION (the operationally-meaningful property for HNSW
retrieval); byte-equal isn't expected because Go round-trips
through float32 internally while Rust stays at f64.
**Tally:** 8 match · 0 diff (out of 8 fixtures)
_Cosine ≥ 0.99999 on every fixture — embed parity holds_
_post-sidecar-drop. Rust and Go produce vectors that point in_
_the same direction in 768-dim space._