mirror of
https://github.com/ruvnet/RuView
synced 2026-07-27 18:11:43 +00:00
cde81b7755
extract() already correctly returned None once the estimated frequency left the breathing band, but filtered_history only cleared by passively flushing sample-by-sample over the full 30s window. That let a decreasingly-accurate estimate keep being accepted as noise diluted the window -- ramping up to and pinning at the range ceiling (30 BPM, the exact value from the GH issue) right before rejection -- and left a returning subject waiting out the rest of that stale window before a clean, undiluted estimate could dominate again (measured: ~29s recovery pre-fix vs ~6s post-fix). Fix: track consecutive_rejections and reset() the window/filter state immediately on the first out-of-band rejection instead of waiting for FIFO eviction to drain it. Note: the "pins forever" framing in the reported repro is partly a caller-side artifact -- a `last = extract(...) or last` driver holds the last non-None reading across every subsequent None, which this fix cannot change without breaking the Option<VitalEstimate> contract. What's fixed here is the real defect underneath: the stale window no longer lingers, and reacquisition after a dropout is fast. Fixes #1422 Co-Authored-By: claude-flow <ruv@ruv.net>