mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
Extends the previous commit's classifier so it only judges evidence it can actually attribute to our own write. The classifier judged whatever mode happened to be current when the deadline fired, and never looked at timing, despite the refusal-versus-misreport distinction resting on it. A delayed answer to an earlier write, or a mode change made on the pods themselves mid-request, could be taken for the answer to the outstanding write. Now the first report after a write is recorded with its latency, and that recorded frame is what gets classified. A write is left alone entirely when it was superseded by another listening mode write or by a stem press, since its echoes can no longer be attributed. An answer arriving faster than 500ms is a refusal, never a change: captures put refusals at 25-267ms and real changes at 815-1010ms. A re-send restamps its own send time and drops the previous attempt's echo, so a retry is never judged on stale evidence. Latency is measured with the monotonic clock, so a wall clock correction cannot turn a fast refusal into an apparent change. A misattribution is still possible, because AAP reports carry no correlation id and a change made from iOS or another paired phone is invisible here. That is why nothing is learned or persisted from this: the worst case is one wrong reading that the device's next report corrects. An earlier version of this work also carried a session-scoped remap, so that a stem-initiated switch could be read correctly after our own write had proven the device mislabels a value (issue #594). It is not included. The same unattributability that bounds the classifier to a single wrong reading would have let one misattribution rewrite every later report in the session, and a wrongly resolved Off could persist AllowOffOption into the device profile, outliving the session that produced it. Stem-initiated switches on an affected session are therefore still not shown correctly. Refs #594