From 0328b2c991aaf483d49a1379c934fac025cf0b6a Mon Sep 17 00:00:00 2001 From: ruv Date: Sat, 23 May 2026 16:08:16 -0400 Subject: [PATCH] =?UTF-8?q?fix(adr-115/test):=20topic=20substring=20filter?= =?UTF-8?q?=20=E2=80=94=20'/inttest3/...'=20vs=20'wifi=5Fdensepose=5Fintte?= =?UTF-8?q?st3/...'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause #5 of state_messages_published_on_snapshot_broadcast (the real one, found by reading the diag dump from 636ca7b52). The publisher WAS publishing presence state messages correctly. The test's filter was the bug: .filter(|(t, _, _)| t.contains("/inttest3/presence/state")) The actual topic is: homeassistant/binary_sensor/wifi_densepose_inttest3/presence/state `wifi_densepose_inttest3` is ONE path segment with an underscore separator. There's no `/` before `inttest3`. The substring `/inttest3/presence/state` (with leading slash) never matches. The 4 prior surgical fixes (cargo filter, timing, client_id, subscriber eventloop drain) all addressed *real* publisher/subscriber lifecycle issues that were ALSO contributing — but the *primary* reason the test saw `presence_states = []` was a stupid substring-match bug in the test's own assertion logic. Found by reading the diagnostic dump landed in 636ca7b52: [diag] retain=false topic=homeassistant/binary_sensor/wifi_densepose_inttest3/presence/state payload=OFF There it is — the publisher is publishing OFF, just like the test expects ON/OFF. The filter just couldn't see it. Fixed by changing the filter to look for `wifi_densepose_inttest3/ presence/state` (no leading slash, with the prefix). This is iteration 5 of CI-debug. Lesson preserved in [[feedback-mqtt-integration-test-patterns]]: always include the wider subscription + the diagnostic dump on first failure of any publisher/subscriber test. Saves the 4 wrong-hypothesis iterations. Refs PR #778, issue #776. Co-Authored-By: claude-flow --- .../tests/mqtt_integration.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/v2/crates/wifi-densepose-sensing-server/tests/mqtt_integration.rs b/v2/crates/wifi-densepose-sensing-server/tests/mqtt_integration.rs index 4edb8a7c..e625efad 100644 --- a/v2/crates/wifi-densepose-sensing-server/tests/mqtt_integration.rs +++ b/v2/crates/wifi-densepose-sensing-server/tests/mqtt_integration.rs @@ -323,9 +323,15 @@ async fn state_messages_published_on_snapshot_broadcast() { ); } + // Filter for THIS test's presence state messages. The topic format + // is `homeassistant/binary_sensor/wifi_densepose_/presence/state` + // — `wifi_densepose_inttest3` is one path segment with an underscore + // separator, NOT slash-separated. The previous version looked for + // `/inttest3/presence/state` (with leading slash) which is the bug + // that took 5 commits + a diagnostic dump to find. let presence_states: Vec = msgs .iter() - .filter(|(t, _, _)| t.contains("/inttest3/presence/state")) + .filter(|(t, _, _)| t.contains("wifi_densepose_inttest3/presence/state")) .map(|(_, p, _)| String::from_utf8_lossy(p).into_owned()) .collect();