- 10638
.await; - 10639
Ok(rx) - 10640
} - 10641
} - 10642
- 10643
#[tokio::test(flavor = "multi_thread", worker_threads = 4)] - 10644
async fn cache_rung_detects_a_provider_reported_hit_and_records_both_rungs_in_signals() { - 10645
super::isolate_global_config(); - 10646
let dir = tempfile::tempdir().unwrap(); - 10647
let core = Core::new_with_trust(dir.path().to_path_buf(), true).unwrap(); - 10648
let unused_port = { - 10649
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap(); - 10650
listener.local_addr().unwrap().port() - 10651
}; - 10652
vak_config::set_override( - 10653
"VAK_OLLAMA_BASE_URL", - 10654
format!("http://127.0.0.1:{unused_port}/v1"), - 10655
); - 10656
core.inner.registry.register("ollama", |_auth| { - 10657
Ok(Arc::new(FollowsProbeAndReportsCacheOnThirdCall { - 10658
calls: std::sync::atomic::AtomicU32::new(0), - 10659
last_fingerprint: std::sync::Mutex::new(None), - 10660
}) as Arc<dyn Provider>) - 10661
}); - 10662
- 10663
let loopback_leg = vak_llm::RouteLeg { - 10664
provider: "ollama".into(), - 10665
model: "fake-ollama-model".into(), - 10666
dialect: vak_llm::EndpointDialect::default(), - 10667
credential_id: None, - 10668
}; - 10669
let session_path = dir.path().join("cache-rung-session.jsonl"); - 10670
let mut session = SessionLog::create(session_path, header()).unwrap(); - 10671
let _ = core.capacity_profile_for(&loopback_leg, &mut session).await; - 10672
core.maybe_start_capacity_probe(&loopback_leg).await; - 10673
let key = vak_context::capacity::ProfileKey { - 10674
provider: "ollama".into(), - 10675
model: "fake-ollama-model".into(), - 10676
quantisation: None, - 10677
}; - 10678
let probed = wait_for_capacity_probe(&core, &key).await; - 10679
- 10680
assert_eq!( - 10681
probed.cache, - 10682
vak_context::capacity::CacheBehaviour::ProviderReported - 10683
); - 10684
assert!( - 10685
probed - 10686
.provenance - 10687
.signals - 10688
.iter() - 10689
.any(|s| s.contains("cache rung") && s.contains("ProviderReported")), - 10690
"both cache-rung latencies and the outcome must be recorded as \ - 10691
provenance signals: {:?}", - 10692
probed.provenance.signals - 10693
); - 10694
- 10695
vak_config::clear_override("VAK_OLLAMA_BASE_URL"); - 10696
} - 10697
} - 10698
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.