mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-07-12 03:12:11 +02:00
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.
This commit is contained in:
parent
abc92998bb
commit
fd32460eac
1 changed files with 12 additions and 3 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue