ci: wire up CI, fix no_std build, fix stale package names in scripts
CI / test (push) Failing after 15s
CI / test (push) Failing after 15s
- Add .gitea/workflows/ci.yml running scripts/ci-test.sh (fmt, clippy,
test, no_std check) on push/PR to main.
- Fix stale rustyhdf5-py/rustyhdf5-format package names in
ci-test.sh/check-nostd.sh, which had been silently no-op'ing those
checks (cargo warns but doesn't fail on an unknown --exclude/-p
target).
- With those checks actually running, fix the real issues they surface:
- clippy: useless_conversion in chunked_write.rs, byte_char_slices in
global_heap.rs/object_header.rs.
- cargo fmt: apply formatting across the workspace (whitespace only).
- no_std (thumbv7em-none-eabihf) build errors in clawhdf5-format:
core::sync::atomic::AtomicU64 doesn't exist on that target (no
native 64-bit atomics) — switch profiling.rs's counters to
portable-atomic, which falls back to a CAS-based emulation there
and is a no-op wrapper elsewhere. Add missing alloc imports for
Box (filters.rs), Vec (filters_szip.rs), and format! (dict_encoding.rs)
on no_std paths. Replace f64::powi (std/libm-only) with a small
local exponentiation-by-squaring helper in the scale-offset filter.
This commit is contained in:
@@ -80,8 +80,7 @@ fn hnsw_matches_bruteforce_oracle() {
|
||||
oracle.sort_by(|a, b| b.1.partial_cmp(&a.1).unwrap());
|
||||
let oracle_ids: std::collections::HashSet<usize> =
|
||||
oracle.iter().take(k).map(|(i, _)| *i).collect();
|
||||
let hnsw_ids: std::collections::HashSet<usize> =
|
||||
results.iter().map(|r| r.index).collect();
|
||||
let hnsw_ids: std::collections::HashSet<usize> = results.iter().map(|r| r.index).collect();
|
||||
|
||||
let overlap = oracle_ids.intersection(&hnsw_ids).count();
|
||||
assert!(
|
||||
@@ -127,17 +126,19 @@ fn incremental_inserts_after_search_are_found() {
|
||||
// First batch, then a search to force the index to build.
|
||||
for i in 0..40 {
|
||||
let v = make_vector(&mut seed, dim);
|
||||
mem.save(entry(&format!("a{i}"), v, &format!("a{i}"))).unwrap();
|
||||
mem.save(entry(&format!("a{i}"), v, &format!("a{i}")))
|
||||
.unwrap();
|
||||
}
|
||||
let _ = mem.hybrid_search(&make_vector(&mut seed, dim), "", 1.0, 0.0, 5);
|
||||
|
||||
// Now insert a distinctive vector incrementally and confirm we can find it.
|
||||
let needle = vec![10.0f32; dim];
|
||||
let idx = mem
|
||||
.save(entry("needle", needle.clone(), "needle"))
|
||||
.unwrap();
|
||||
let idx = mem.save(entry("needle", needle.clone(), "needle")).unwrap();
|
||||
let hits = mem.hybrid_search(&needle, "", 1.0, 0.0, 1);
|
||||
assert_eq!(hits[0].index, idx, "incrementally inserted vector must be found");
|
||||
assert_eq!(
|
||||
hits[0].index, idx,
|
||||
"incrementally inserted vector must be found"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -158,6 +159,9 @@ fn save_batch_then_search_is_consistent() {
|
||||
// Exact-match queries should resolve to themselves after a batch insert.
|
||||
for probe in [0usize, 17, 49] {
|
||||
let hits = mem.hybrid_search(&vectors[probe], "", 1.0, 0.0, 1);
|
||||
assert_eq!(hits[0].index, probe, "batch-inserted vector {probe} not found");
|
||||
assert_eq!(
|
||||
hits[0].index, probe,
|
||||
"batch-inserted vector {probe} not found"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user