RuView
RuView copied to clipboard
fix(sensing-server): filter burst arrivals from CSI fps EMA
Fixes #1180.
Root cause
update_csi_fps_ema() converted every accepted host arrival delta into 1 / dt before folding it into the per-node CSI fps EMA. UDP / OS buffering can deliver same-node frames in tight sub-millisecond bursts, so a burst delta such as 36 us becomes an instantaneous rate near 27 kHz and pulls csi_fps_ema far above the node's real frame-production cadence.
Fix
Filter implausibly small arrival deltas before computing the instantaneous rate.
- Add explicit CSI fps sample bounds:
10 ms <= dt < 1 s. - Keep the documented ESP32 CSI range up to 100 Hz valid: the 10 ms boundary is accepted.
- Preserve the existing long-gap rejection and EMA formula.
- Add regression coverage for sub-ms burst deltas interleaved with a nominal 40 Hz cadence, asserting the EMA stays near the true rate instead of inflating into the kHz range.
Safety
This is intentionally scoped to the measured-fps estimator in v2/crates/wifi-densepose-sensing-server/src/main.rs. It does not change the REST / Prometheus field names, the sync packet format, or NodeState::observe_csi_frame_arrival() call sites.
Validation
cargo test -p wifi-densepose-sensing-server fps_ema_tests --no-default-features --no-fail-fast- 6 passed, 0 failed.cargo test -p wifi-densepose-sensing-server --no-default-features --no-fail-fast- 455 lib tests passed / 1 ignored, 169 main tests passed, integration tests passed, doc test ignored as before.git diff --check