Summary
RvfStore::create(path, options) honors options.metric (e.g. DistanceMetric::Cosine).
RvfStore::open(path) constructs:
let opts = RvfOptions {
domain_profile,
..Default::default() // metric: L2
};
// last_witness_hash: [0u8; 32]
boot() restores dimension and profile from the MANIFEST, but never restores metric. Metric is not written into the manifest. A reopen silently switches distance ranking to L2 and restarts the witness chain at zeros.
Affected versions
- Confirmed: 0.2.0
store.rs open / boot
- Still present in spirit: 0.3.0 (
open still ..Default::default(), no metric on parsed manifest)
Repro
use rvf_runtime::{DistanceMetric, RvfOptions, RvfStore};
fn main() {
let dir = tempfile::tempdir().unwrap();
let path = dir.path().join("metric.rvf");
{
let opts = RvfOptions {
dimension: 3,
metric: DistanceMetric::Cosine,
..Default::default()
};
let mut s = RvfStore::create(&path, opts).unwrap();
let a = [1.0f32, 0.0, 0.0];
let b = [10.0f32, 10.0, 0.0];
s.ingest_batch(&[&a, &b], &[1, 2], None).unwrap();
// If metric() accessor exists (0.3+): assert_eq!(s.metric(), Cosine);
let _ = s.last_witness_hash(); // non-zero after witness_ingest
}
let s2 = RvfStore::open(&path).unwrap();
// Actual: distance path uses L2; last_witness_hash() == [0; 32]
// Expected: Cosine preserved; witness chain tip restored from file
let _ = s2;
}
Expected
- Persist
metric (and other durable options) in MANIFEST.
- Restore on
open/boot.
- Restore or recompute
last_witness_hash from the latest WITNESS segment so reopen continues the chain.
Optional API: open_with_options only for non-persisted overrides.
Downstream impact
WeftOS never uses Cosine at create time: we L2-normalize all vectors and always create with L2 (agenticow pattern) so reopen cannot change ranking. Witness restart on reopen is documented as a residual. Prefer a durable metric so other consumers are not foot-gunned.
Reported from WeftOS WEFT-662.
Summary
RvfStore::create(path, options)honorsoptions.metric(e.g.DistanceMetric::Cosine).RvfStore::open(path)constructs:boot()restoresdimensionandprofilefrom the MANIFEST, but never restoresmetric. Metric is not written into the manifest. A reopen silently switches distance ranking to L2 and restarts the witness chain at zeros.Affected versions
store.rsopen/bootopenstill..Default::default(), no metric on parsed manifest)Repro
Expected
metric(and other durable options) in MANIFEST.open/boot.last_witness_hashfrom the latest WITNESS segment so reopen continues the chain.Optional API:
open_with_optionsonly for non-persisted overrides.Downstream impact
WeftOS never uses Cosine at create time: we L2-normalize all vectors and always create with L2 (agenticow pattern) so reopen cannot change ranking. Witness restart on reopen is documented as a residual. Prefer a durable metric so other consumers are not foot-gunned.
Reported from WeftOS WEFT-662.