Skip to main content

Module liveness

Module liveness 

Source
Expand description

Did this command actually reach a speaker?

SonosSystem::new() can hand back a full speaker list without a single packet leaving the machine: discovery is cached on disk for 24h, and on a cache hit no SSDP sweep is attempted at all. Commands that only read state — speakers, groups, status — then discard every failed fetch with .ok() and print whatever they still have, which on a machine with broken SSDP is a list of names from a weeks-old cache. stdout looked exactly like success and the exit code was 0.

The fix does not need new data. Those commands already make the calls that answer the question; they just threw the answers away. This module is the bookkeeping (Probes) plus the two pure decisions — did anything come back (verdict), and what should main do about it (disposition) — kept free of I/O so both are unit-testable with no network.

Structs§

CommandOutput
A command’s stdout together with whether it was validated against a live speaker.
Probes
Running tally of probes attempted versus probes that returned.

Enums§

Disposition
What main should do with a finished command.
Liveness
Whether a command established contact with at least one speaker.

Functions§

disposition
Map a verdict plus the two opt-in flags onto what main does.
verdict
Decide liveness from the probes a command attempted and the ones that came back.