fix(adr-115/test): topic substring filter — '/inttest3/...' vs 'wifi_densepose_inttest3/...'

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 <ruv@ruv.net>
This commit is contained in:
ruv 2026-05-23 16:08:16 -04:00
parent 26e00e6910
commit 0328b2c991
1 changed files with 7 additions and 1 deletions

View File

@ -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_<node>/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<String> = 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();