wifi-densepose/v2/crates/wifi-densepose-mat
rUv b209b8b778
ci(bench): compile-verify regression gate for v2 criterion benches + ADR-174 (#1094)
* ci(bench): wire v2 criterion benches into CI as a compile-verify regression gate

Sub-deliverable 8.3 of the benchmark/optimization milestone (needs ADR slot 174).

The v2/ workspace ships 26 criterion benches across 18 crates, but benches are
not part of `cargo test`, so nothing in CI compiled them and they silently rot
when a public API they call changes.

Add `.github/workflows/bench-regression.yml`:
  - bench-compile (HARD GATE): `cargo bench --workspace --no-default-features
    --no-run` compiles + links every default-feature bench (no measurement) plus
    the cir-gated cir_bench — a real, deterministic regression guard against
    bench bit-rot.
  - bench-fast-run (INFORMATIONAL, continue-on-error, never gates): runs a
    curated pure-CPU subset (nvsim, ruvector sketch/fusion) in criterion
    quick-mode and uploads logs as an artifact.

No timing-regression gate, by design: wall-clock on shared GitHub runners varies
2-3x run-to-run, so a hard threshold or cross-runner `criterion --baseline`
compare would manufacture false failures. The honest scope is compile-verify +
informational-run; the workflow header documents the self-hosted-runner
condition under which true timing-gating becomes honest. The crv-gated crv_bench
is excluded because its crates.io dep ruvector-crv 0.1.1 fails to build upstream.

Running the gate immediately caught one already-bit-rotted bench:
wifi-densepose-mat/detection_bench failed to compile (E0063: missing field
last_rssi in SensorPosition). Fixed (last_rssi: None) and re-verified.

Validation (MEASURED): mat detection_bench + cir_bench + nvsim + ruvector +
vitals + swarm benches compile under --no-default-features; fast subset runs;
`cargo test -p wifi-densepose-mat --no-default-features` 174 passed / 0 failed;
Python proof PASS, hash f8e76f21...46f7a unchanged.

Co-Authored-By: claude-flow <ruv@ruv.net>

* docs(adr): ADR-174 — CI bench-regression compile-verify gate

Records sub-deliverable 8.3 (bench-regression.yml, committed c4c59e085):
a hard compile-verify gate over all 26 v2 criterion benches (caught + fixed
one real bit-rotted bench, mat/detection_bench E0063) + an informational
fast-run. Documents the honest scope — no timing-regression gate, since
shared-runner wall-clock varies 2-3x; states the self-hosted-runner condition
under which timing gating becomes honest.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-15 08:26:38 -04:00
..
benches ci(bench): compile-verify regression gate for v2 criterion benches + ADR-174 (#1094) 2026-06-15 08:26:38 -04:00
src feat(mat): wire real ESP32/UDP/PCAP CSI ingest; honest typed errors for gated adapters (ADR-158 §3) 2026-06-11 21:54:04 -04:00
tests fix(mat): unify divergent triage engines to single canonical source (ADR-158 §1) 2026-06-11 21:54:03 -04:00
Cargo.toml release: bump 9 crates changed in the beyond-SOTA sweep for crates.io 2026-06-11 22:41:21 -04:00
README.md chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00

README.md

wifi-densepose-mat

Crates.io Documentation License

Mass Casualty Assessment Tool for WiFi-based disaster survivor detection and localization.

Overview

wifi-densepose-mat uses WiFi Channel State Information (CSI) to detect and locate survivors trapped in rubble, debris, or collapsed structures. The crate follows Domain-Driven Design (DDD) with event sourcing, organized into three bounded contexts -- detection, localization, and alerting -- plus a machine learning layer for debris penetration modeling and vital signs classification.

Use cases include earthquake search and rescue, building collapse response, avalanche victim location, flood rescue operations, and mine collapse detection.

Features

  • Vital signs detection -- Breathing patterns, heartbeat signatures, and movement classification with ensemble classifier combining all three modalities.
  • Survivor localization -- 3D position estimation through debris via triangulation, depth estimation, and position fusion.
  • Triage classification -- Automatic START protocol-compatible triage with priority-based alert generation and dispatch.
  • Event sourcing -- All state changes emitted as domain events (DetectionEvent, AlertEvent, ZoneEvent) stored in a pluggable EventStore.
  • ML debris model -- Debris material classification, signal attenuation prediction, and uncertainty-aware vital signs classification.
  • REST + WebSocket API -- axum-based HTTP API for real-time monitoring dashboards.
  • ruvector integration -- ruvector-solver for triangulation math, ruvector-temporal-tensor for compressed CSI buffering.

Feature flags

Flag Default Description
std yes Standard library support
api yes REST + WebSocket API (enables serde for all types)
ruvector yes ruvector-solver and ruvector-temporal-tensor
serde no Serialization (also enabled by api)
portable no Low-power mode for field-deployable devices
distributed no Multi-node distributed scanning
drone no Drone-mounted scanning (implies distributed)

Quick Start

use wifi_densepose_mat::{
    DisasterResponse, DisasterConfig, DisasterType,
    ScanZone, ZoneBounds,
};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let config = DisasterConfig::builder()
        .disaster_type(DisasterType::Earthquake)
        .sensitivity(0.8)
        .build();

    let mut response = DisasterResponse::new(config);

    // Define scan zone
    let zone = ScanZone::new(
        "Building A - North Wing",
        ZoneBounds::rectangle(0.0, 0.0, 50.0, 30.0),
    );
    response.add_zone(zone)?;

    // Start scanning
    response.start_scanning().await?;

    Ok(())
}

Architecture

wifi-densepose-mat/src/
  lib.rs            -- DisasterResponse coordinator, config builder, MatError
  domain/
    survivor.rs     -- Survivor aggregate root
    disaster_event.rs -- DisasterEvent, DisasterType
    scan_zone.rs    -- ScanZone, ZoneBounds
    alert.rs        -- Alert, Priority
    vital_signs.rs  -- VitalSignsReading, BreathingPattern, HeartbeatSignature
    triage.rs       -- TriageStatus, TriageCalculator (START protocol)
    coordinates.rs  -- Coordinates3D, LocationUncertainty
    events.rs       -- DomainEvent, EventStore, InMemoryEventStore
  detection/        -- BreathingDetector, HeartbeatDetector, MovementClassifier, EnsembleClassifier
  localization/     -- Triangulator, DepthEstimator, PositionFuser
  alerting/         -- AlertGenerator, AlertDispatcher, TriageService
  ml/               -- DebrisPenetrationModel, VitalSignsClassifier, UncertaintyEstimate
  api/              -- axum REST + WebSocket router
  integration/      -- SignalAdapter, NeuralAdapter, HardwareAdapter
Crate Role
wifi-densepose-core Foundation types and traits
wifi-densepose-signal CSI preprocessing for detection pipeline
wifi-densepose-nn Neural inference for ML models
wifi-densepose-hardware Hardware sensor data ingestion
ruvector-solver Triangulation and position math
ruvector-temporal-tensor Compressed CSI buffering

License

MIT OR Apache-2.0