mirror of
https://github.com/ruvnet/RuView
synced 2026-07-22 17:23:19 +00:00
7ed57f0415
Root cause (investigated, not assumed): the heavy deps in a [mat] wheel were NOT on the survivor-detection/triage path the Python binding uses. `wifi-densepose-mat` pulled `wifi-densepose-nn` as a NON-optional dep, and nn's default `onnx` feature drags in `ort` (ONNX Runtime) + its download/reqwest/hyper stack. But nn is used ONLY by mat's `src/ml/` module (debris + vital-signs ONNX classifiers), which is an OPTIONAL runtime enhancement: `DetectionPipeline.ml_pipeline` is `Option<_>`, created only when `DetectionConfig::enable_ml` is set, and `from_disaster_config` (the DisasterResponse path) never enables it. So the ONNX stack was compiled-and-linked but never executed by the binding. Fix = feature-gating (not a hoist — a hoist was unnecessary): - `wifi-densepose-nn` made optional; new `ml` Cargo feature gates it. - `default = [..., "ml"]` so existing consumers are unchanged; `api` implies `ml` (the REST surface exposes `ml_ready`). - `#[cfg(feature = "ml")]` on the `ml` module, its crate-root + prelude re-exports, the `MatError::Ml` variant, and every ml touchpoint in detection/pipeline.rs (ml_config/ml_pipeline fields, constructor, process_zone enhancement block, enhance_with_ml/get_ml_results/ initialize_ml/ml_ready/ml_pipeline accessors, update_config). - Fixed a latent feature-unification bug surfaced by dropping nn: integration/hardware_adapter.rs uses `tokio::select!`, which needs `tokio/macros`. That was only satisfied transitively via nn; now declared explicitly on mat's own tokio dep so --no-default-features builds compile. The ADR-185 [mat] wheel already depended on mat with `default-features = false, features = ["std"]`, so no python/ change was needed — dropping `ml` from the default now actually removes ort. Measured (maturin build --release --features mat --strip): BEFORE (ml/ort in wheel): 8.4 MB (over the ADR-117 §5.4 <=5 MB budget) AFTER (ml gated off): 2.0 MB (under budget) — 76% smaller Verified: cargo build -p wifi-densepose-mat (default+ml) OK cargo build -p wifi-densepose-mat --no-default-features --features std OK cargo test --features mat --test mat_parity 2/2 pass maturin develop --features mat + pytest tests/test_mat.py 7/7 pass (same detection result: 1 survivor, triage Delayed — behavior-transparent)