feat(adr-115): P4 — broker integration tests + mosquitto CI workflow

Adds three integration tests (`v2/crates/wifi-densepose-sensing-server/
tests/mqtt_integration.rs`) that prove the publisher works against a
real broker, gated behind `--features mqtt` + `RUVIEW_RUN_INTEGRATION=1`:

1. `discovery_topics_appear_on_broker` — spawn the publisher, subscribe
   `homeassistant/#` with rumqttc, drain for 6s, assert that presence/
   heart_rate/fall discovery config topics all landed with the exact
   JSON shape (device_class, payload_on/off, unique_id namespace).

2. `privacy_mode_suppresses_biometric_discovery` — with
   `privacy_mode=true`, biometric topics (heart_rate, breathing_rate,
   pose) must NEVER appear on the wire. Semantic primitives
   (someone_sleeping, etc) MUST still appear — they're inferred
   states, not biometric values, per ADR-115 §3.12.3.

3. `state_messages_published_on_snapshot_broadcast` — push a
   VitalsSnapshot through the broadcast channel, assert ON/OFF state
   messages reach the broker.

Plus `.github/workflows/mqtt-integration.yml` — spins up Mosquitto
2.0.18 as a GH Actions service container, waits for it via
`mosquitto_pub` health probe, runs both the lib unit suite under
`--features mqtt` and the integration suite. Dumps broker logs on
failure for debugging.

Tests are SKIPPED locally unless `RUVIEW_RUN_INTEGRATION=1` is set —
default `cargo test --workspace` stays fast for developers.

Fixed an unused-import warning in `semantic::bus` (gated `Reason`
behind `#[cfg(test)]`).

Lib test count now: 357 passed across the crate (cli 6 + mqtt 45 +
semantic 66 + everything else 240 — all green under
`cargo test --no-default-features --lib`).

Refs #776.

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
ruv
2026-05-23 14:14:21 -04:00
parent 15755fd8a4
commit b68f130ce4
3 changed files with 395 additions and 1 deletions
@@ -8,7 +8,9 @@
//! holds a list of trait objects so the call site doesn't grow when we
//! add primitives in P4.5b.
use super::common::{PrimitiveConfig, PrimitiveState, RawSnapshot, Reason};
use super::common::{PrimitiveConfig, PrimitiveState, RawSnapshot};
#[cfg(test)]
use super::common::Reason;
use super::{
bathroom::BathroomOccupied,
bed_exit::BedExit,