From fd32460eac45fd5e2d870cddc45abb9318ac693b Mon Sep 17 00:00:00 2001 From: aaltshuler Date: Sun, 5 Jul 2026 05:07:59 +0300 Subject: [PATCH] fix(engine): loader rejects non-numeric vector elements (parity with mutation) Replace the FixedSizeList arm's as_f64().unwrap_or(0.0) coercion with a loud per-row OmniError::manifest in the loader's own style (property name included, mutation path's "elements must be numeric" phrasing). The red test turns green; the whole validators suite stays green. Closes iss-loader-vector-element-coercion. --- crates/omnigraph/src/loader/mod.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/omnigraph/src/loader/mod.rs b/crates/omnigraph/src/loader/mod.rs index c8e08a47..d0ab9ecb 100644 --- a/crates/omnigraph/src/loader/mod.rs +++ b/crates/omnigraph/src/loader/mod.rs @@ -907,9 +907,18 @@ fn build_column_from_json( ))); } for val in arr { - builder - .values() - .append_value(val.as_f64().unwrap_or(0.0) as f32); + // Parity with the mutation path: non-numeric elements + // (null — what json! emits for a non-finite float — + // strings, bools) are rejected loudly, never coerced + // to 0.0, which would silently corrupt the vector's + // direction while passing every dimension check. + let Some(v) = val.as_f64() else { + return Err(OmniError::manifest(format!( + "vector property '{}' elements must be numeric, got {}", + name, val + ))); + }; + builder.values().append_value(v as f32); } builder.append(true); } else if nullable {