mirror of
https://github.com/ruvnet/RuView
synced 2026-08-04 19:31:42 +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)
107 lines
4.2 KiB
TOML
107 lines
4.2 KiB
TOML
[package]
|
|
name = "wifi-densepose-mat"
|
|
version = "0.3.1"
|
|
edition = "2021"
|
|
authors = ["rUv <ruv@ruv.net>", "WiFi-DensePose Contributors"]
|
|
description = "Mass Casualty Assessment Tool - WiFi-based disaster survivor detection"
|
|
license = "MIT OR Apache-2.0"
|
|
repository = "https://github.com/ruvnet/wifi-densepose"
|
|
documentation = "https://docs.rs/wifi-densepose-mat"
|
|
keywords = ["wifi", "disaster", "rescue", "detection", "vital-signs"]
|
|
categories = ["science", "algorithms"]
|
|
readme = "README.md"
|
|
|
|
[features]
|
|
default = ["std", "api", "ruvector", "ml"]
|
|
ruvector = ["dep:ruvector-solver", "dep:ruvector-temporal-tensor"]
|
|
std = []
|
|
# ONNX-backed ML detection (debris + vital-signs classifiers). Pulls
|
|
# `wifi-densepose-nn` (and, via its default `onnx` feature, the `ort`
|
|
# ONNX Runtime + its download/reqwest stack) ONLY when enabled. The
|
|
# survivor-detection/triage pipeline works without it (ML is an optional
|
|
# enhancement, off unless `DetectionConfig::enable_ml`), so consumers that
|
|
# don't need ONNX — e.g. the ADR-185 `wifi-densepose-py` `[mat]` wheel —
|
|
# build `--no-default-features` and drop the entire ort/reqwest tree,
|
|
# keeping the wheel within the ADR-117 §5.4 budget.
|
|
ml = ["dep:wifi-densepose-nn"]
|
|
# REST/WebSocket surface. Pulls the web stack (axum, futures-util) only when
|
|
# enabled, and enables the `serde` FEATURE (not just `dep:serde`) so the
|
|
# `cfg_attr(feature = "serde", ...)` derives on domain types are actually
|
|
# active when the API is on (review finding 5: `api = ["dep:serde"]` enabled
|
|
# the dependency but left every `feature = "serde"` cfg dead).
|
|
# The REST surface exposes ML status (`ml_ready`), so `api` implies `ml`.
|
|
api = ["ml", "serde", "dep:axum", "dep:futures-util"]
|
|
# Real ESP32 serial CSI ingest. Pulls the native `serialport` crate (libudev on
|
|
# Linux) only when enabled, so the default/no-default appliance build stays free
|
|
# of native serial deps. With the feature OFF, the ESP32 serial *parser* still
|
|
# works on supplied bytes; only live port reads return UnsupportedAdapter.
|
|
serial = ["dep:serialport"]
|
|
portable = ["low-power"]
|
|
low-power = []
|
|
distributed = ["tokio/sync"]
|
|
drone = ["distributed"]
|
|
serde = ["dep:serde", "chrono/serde", "geo/use-serde"]
|
|
|
|
[dependencies]
|
|
# Workspace dependencies
|
|
wifi-densepose-core = { version = "0.3.0", path = "../wifi-densepose-core" }
|
|
wifi-densepose-signal = { version = "0.3.0", path = "../wifi-densepose-signal", default-features = false }
|
|
wifi-densepose-nn = { version = "0.3.0", path = "../wifi-densepose-nn", optional = true }
|
|
ruvector-solver = { workspace = true, optional = true }
|
|
ruvector-temporal-tensor = { workspace = true, optional = true }
|
|
|
|
# Async runtime — required by the core integration layer (UDP CSI receiver,
|
|
# hardware adapter, scan loop in `DisasterResponse::start_scanning`), not just
|
|
# the REST API, so it is deliberately NOT gated behind `api`.
|
|
# `macros` is needed by `tokio::select!` in integration/hardware_adapter.rs.
|
|
# It was previously satisfied only by feature-unification from the (now
|
|
# optional) `wifi-densepose-nn` dep; declare it explicitly so a
|
|
# `--no-default-features` build (the ADR-185 [mat] wheel) still compiles.
|
|
tokio = { version = "1.35", features = ["rt", "sync", "time", "macros"] }
|
|
async-trait = "0.1"
|
|
|
|
# Web framework (REST API) — only compiled with the `api` feature.
|
|
axum = { version = "0.7", features = ["ws"], optional = true }
|
|
futures-util = { version = "0.3", optional = true }
|
|
|
|
# Error handling
|
|
thiserror = "2.0"
|
|
anyhow = "1.0"
|
|
|
|
# Serialization
|
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
|
serde_json = "1.0"
|
|
|
|
# Time handling
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
|
|
# Math and signal processing
|
|
num-complex = "0.4"
|
|
ndarray = "0.15"
|
|
rustfft = "6.1"
|
|
|
|
# Utilities
|
|
uuid = { version = "1.6", features = ["v4", "serde"] }
|
|
tracing = "0.1"
|
|
parking_lot = "0.12"
|
|
|
|
# Geo calculations
|
|
geo = "0.27"
|
|
|
|
# Real serial CSI ingest (ESP32) — optional, native deps gated behind `serial`.
|
|
serialport = { version = "4.3", optional = true }
|
|
|
|
[dev-dependencies]
|
|
tokio-test = "0.4"
|
|
criterion = { version = "0.5", features = ["html_reports"] }
|
|
proptest = "1.4"
|
|
approx = "0.5"
|
|
|
|
[[bench]]
|
|
name = "detection_bench"
|
|
harness = false
|
|
|
|
[package.metadata.docs.rs]
|
|
all-features = true
|
|
rustdoc-args = ["--cfg", "docsrs"]
|