ci: lint all targets, run interop suites for real, compile benches
- clippy --all-targets plus a clawhdf5-format feature matrix (parallel, lz4, zstd, pcodec, fast-checksum); fix the accumulated lint backlog in test, bench and feature-gated code (no behaviour changes). - Install python3 + h5py/numpy/netCDF4/xarray in the CI container and set CLAWHDF5_REQUIRE_INTEROP=1, which makes a missing interop dependency a test failure. Every h5py/netCDF4 interop test used to skip silently in CI. Run the #[ignore]d writer_h5py_tests suite explicitly. - cargo bench --no-run so benches can't rot; fix bench.rs and memory_bench.rs, which no longer compiled against the current strategy/consolidation APIs. - Optional fuzz smoke run via CLAWHDF5_FUZZ_SECONDS. - CHANGELOG and docs/known-issues.md updated. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
706189c3ef
commit
bbe1baa208
@@ -483,7 +483,7 @@ fn rayon_benches(c: &mut Criterion) {
|
||||
use rayon::prelude::*;
|
||||
let query_norm = vector_search::compute_norm(&query);
|
||||
let num_cores = rayon::current_num_threads().max(1);
|
||||
let chunk_size = (n + num_cores - 1) / num_cores;
|
||||
let chunk_size = n.div_ceil(num_cores);
|
||||
let mut results: Vec<(usize, f32)> = vectors
|
||||
.par_chunks(chunk_size)
|
||||
.enumerate()
|
||||
@@ -537,7 +537,7 @@ fn rayon_benches(c: &mut Criterion) {
|
||||
use rayon::prelude::*;
|
||||
let query_norm = vector_search::compute_norm(&query);
|
||||
let num_cores = rayon::current_num_threads().max(1);
|
||||
let chunk_size = (n + num_cores - 1) / num_cores;
|
||||
let chunk_size = n.div_ceil(num_cores);
|
||||
let mut results: Vec<(usize, f32)> = vectors
|
||||
.par_chunks(chunk_size)
|
||||
.enumerate()
|
||||
@@ -766,12 +766,22 @@ fn adaptive_benches(c: &mut Criterion) {
|
||||
.map(|v| vector_search::compute_norm(v))
|
||||
.collect();
|
||||
let tombstones = vec![0u8; n];
|
||||
let flat: Vec<f32> = vectors.iter().flatten().copied().collect();
|
||||
|
||||
c.bench_function("adaptive_search_10k", |b| {
|
||||
let hw = HardwareCapabilities::detect();
|
||||
let strat = strategy::auto_select_strategy(n, &hw);
|
||||
b.iter(|| {
|
||||
strategy::search_with_metrics(&query, &vectors, &norms, &tombstones, 10, strat, None)
|
||||
strategy::search_with_metrics(
|
||||
&query,
|
||||
&vectors,
|
||||
&flat,
|
||||
&norms,
|
||||
&tombstones,
|
||||
10,
|
||||
strat,
|
||||
None,
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -781,6 +791,7 @@ fn adaptive_benches(c: &mut Criterion) {
|
||||
strategy::search_with_metrics(
|
||||
&query,
|
||||
&vectors,
|
||||
&flat,
|
||||
&norms,
|
||||
&tombstones,
|
||||
10,
|
||||
@@ -795,6 +806,7 @@ fn adaptive_benches(c: &mut Criterion) {
|
||||
strategy::search_with_metrics(
|
||||
&query,
|
||||
&vectors,
|
||||
&flat,
|
||||
&norms,
|
||||
&tombstones,
|
||||
10,
|
||||
@@ -809,6 +821,7 @@ fn adaptive_benches(c: &mut Criterion) {
|
||||
strategy::search_with_metrics(
|
||||
&query,
|
||||
&vectors,
|
||||
&flat,
|
||||
&norms,
|
||||
&tombstones,
|
||||
10,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use clawhdf5_agent::bm25::BM25Index;
|
||||
use clawhdf5_agent::consolidation::{
|
||||
ConsolidationConfig, ConsolidationEngine, ImportanceScorer, ImportanceWeights, MemorySource,
|
||||
UntrustedSource,
|
||||
};
|
||||
use clawhdf5_agent::hybrid::{hybrid_search, rrf_hybrid_search};
|
||||
use clawhdf5_agent::knowledge::KnowledgeCache;
|
||||
@@ -285,7 +286,12 @@ fn consolidation_benches(c: &mut Criterion) {
|
||||
for i in 0..n {
|
||||
let embedding = make_vec(&mut rng, DIM);
|
||||
let chunk = format!("memory record {i} with some content");
|
||||
engine.add_memory(chunk, embedding, MemorySource::User, now + i as f64);
|
||||
engine.add_memory(
|
||||
chunk,
|
||||
embedding,
|
||||
UntrustedSource::User,
|
||||
now + i as f64,
|
||||
);
|
||||
}
|
||||
engine
|
||||
},
|
||||
@@ -307,9 +313,10 @@ fn consolidation_benches(c: &mut Criterion) {
|
||||
for i in 0..50usize {
|
||||
let embedding = make_vec(&mut rng, DIM);
|
||||
let chunk = format!("existing record {i}");
|
||||
engine.add_memory(chunk, embedding, MemorySource::User, now + i as f64);
|
||||
engine.add_memory(chunk, embedding, UntrustedSource::User, now + i as f64);
|
||||
}
|
||||
let records = engine.records().to_vec();
|
||||
let record_refs: Vec<&_> = records.iter().collect();
|
||||
let weights = ImportanceWeights::default();
|
||||
let query_embedding = make_vec(&mut rng, DIM);
|
||||
let sample_text =
|
||||
@@ -317,7 +324,7 @@ fn consolidation_benches(c: &mut Criterion) {
|
||||
|
||||
group.bench_function("bench_importance_scoring", |b| {
|
||||
b.iter(|| {
|
||||
let surprise = ImportanceScorer::score_surprise(&query_embedding, &records);
|
||||
let surprise = ImportanceScorer::score_surprise(&query_embedding, &record_refs);
|
||||
let correction = ImportanceScorer::score_correction(&MemorySource::Correction);
|
||||
let length = ImportanceScorer::score_length(sample_text);
|
||||
ImportanceScorer::score_combined(surprise, correction, length, &weights)
|
||||
@@ -354,7 +361,7 @@ fn temporal_benches(c: &mut Criterion) {
|
||||
// Insert benchmark: measure time to insert 10k timestamps one by one
|
||||
group.bench_function("bench_temporal_insert_10k", |b| {
|
||||
b.iter_batched(
|
||||
|| TemporalIndex::new(),
|
||||
TemporalIndex::new,
|
||||
|mut idx| {
|
||||
for i in 0..N {
|
||||
// Shuffle insertion order slightly using a simple offset pattern
|
||||
@@ -442,7 +449,8 @@ fn large_consolidation_benches(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("consolidation_large");
|
||||
group.sample_size(10);
|
||||
|
||||
for (label, n) in [("10k", 10_000usize)] {
|
||||
{
|
||||
let (label, n) = ("10k", 10_000usize);
|
||||
group.bench_with_input(
|
||||
BenchmarkId::new("bench_consolidation_cycle", label),
|
||||
&n,
|
||||
@@ -459,7 +467,12 @@ fn large_consolidation_benches(c: &mut Criterion) {
|
||||
for i in 0..n {
|
||||
let embedding = make_vec(&mut rng, DIM);
|
||||
let chunk = format!("memory record {i} with content");
|
||||
engine.add_memory(chunk, embedding, MemorySource::User, now + i as f64);
|
||||
engine.add_memory(
|
||||
chunk,
|
||||
embedding,
|
||||
UntrustedSource::User,
|
||||
now + i as f64,
|
||||
);
|
||||
}
|
||||
engine
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user