mirror of
https://github.com/ruvnet/RuView
synced 2026-06-09 10:13:17 +00:00
004a63e82d
- Upgrade openssl to 0.10.78 (CVE-2026-41676), jsonwebtoken to 9.4 - Suppress unmaintained-only/no-CVE advisories in .cargo/audit.toml with per-entry rationale - Fix all `cargo clippy --all-targets -- -D warnings` errors across 35 crates: derivable_impls, needless_range_loop, map_or→is_some_and/ is_none_or, await_holding_lock (drop MutexGuard before .await), ptr_arg (&mut Vec→&mut [T]), useless_conversion, approximate_constant (2.718→E, 3.14→PI), field_reassign_with_default, manual_inspect, useless_vec, lines_filter_map_ok, print_literal, dead_code - Apply `cargo fmt --all` - Pre-existing test failure in wifi-densepose-signal (test_estimate_occupancy_noise_only) is not introduced by this PR
74 lines
2.5 KiB
Rust
74 lines
2.5 KiB
Rust
//! Smoke tests for the cog-pose-estimation crate.
|
|
//!
|
|
//! These are deliberately tight — full inference integration tests
|
|
//! depend on a trained safetensors blob that doesn't live in-repo yet.
|
|
|
|
use cog_pose_estimation::{
|
|
inference::{
|
|
InferenceEngine, SyntheticInput, INPUT_SUBCARRIERS, INPUT_TIMESTEPS, OUTPUT_KEYPOINTS,
|
|
},
|
|
manifest::ManifestSpec,
|
|
};
|
|
|
|
#[test]
|
|
fn synthetic_window_has_correct_shape() {
|
|
let syn = SyntheticInput;
|
|
let window = syn.as_window();
|
|
assert_eq!(window.data.len(), INPUT_SUBCARRIERS * INPUT_TIMESTEPS);
|
|
}
|
|
|
|
#[test]
|
|
fn engine_produces_finite_output_for_synthetic_input() {
|
|
let engine = InferenceEngine::new().expect("engine init");
|
|
let out = engine.infer(&SyntheticInput.as_window()).expect("infer");
|
|
assert!(
|
|
out.is_finite(),
|
|
"synthetic input must produce finite output"
|
|
);
|
|
assert_eq!(out.keypoints.len(), OUTPUT_KEYPOINTS * 2);
|
|
}
|
|
|
|
#[test]
|
|
fn engine_rejects_wrong_shape_input() {
|
|
let engine = InferenceEngine::new().expect("engine init");
|
|
let bad = cog_pose_estimation::inference::CsiWindow {
|
|
data: vec![0.0; 10],
|
|
};
|
|
assert!(engine.infer(&bad).is_err());
|
|
}
|
|
|
|
#[test]
|
|
fn real_weights_load_when_available() {
|
|
use cog_pose_estimation::inference::InferenceEngine;
|
|
let weights = std::path::Path::new("cog/artifacts/pose_v1.safetensors");
|
|
if !weights.exists() {
|
|
// Skip when running outside the repo (e.g. on a fresh appliance install).
|
|
eprintln!("(skipping — cog/artifacts/pose_v1.safetensors not present in cwd)");
|
|
return;
|
|
}
|
|
let engine = InferenceEngine::with_weights(Some(weights)).expect("load real weights");
|
|
assert!(
|
|
engine.backend().starts_with("candle-"),
|
|
"expected real Candle backend, got {}",
|
|
engine.backend()
|
|
);
|
|
let out = engine.infer(&SyntheticInput.as_window()).expect("infer");
|
|
assert!(out.is_finite());
|
|
// Real model emits the published validation PCK@50 as its self-reported
|
|
// confidence — stub returns 0.0. This is the key assertion that proves
|
|
// the cog isn't silently falling back to the stub.
|
|
assert!(
|
|
out.confidence > 0.0,
|
|
"real model should emit non-zero confidence"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn manifest_roundtrips() {
|
|
let spec = ManifestSpec::embedded("pose-estimation", "0.0.1");
|
|
let s = serde_json::to_string(&spec).unwrap();
|
|
let back: ManifestSpec = serde_json::from_str(&s).unwrap();
|
|
assert_eq!(back.id, "pose-estimation");
|
|
assert_eq!(back.version, "0.0.1");
|
|
}
|