Skip to content

test(agent): cover a BLE mouse that wakes as a new node - #1649

Open
kohjunhao wants to merge 2 commits into
AprilNEA:masterfrom
kohjunhao:fix/ble-idle-reconnect
Open

kohjunhao wants to merge 2 commits into
AprilNEA:masterfrom
kohjunhao:fix/ble-idle-reconnect

Conversation

@kohjunhao

Copy link
Copy Markdown
Contributor

Summary

Regression coverage for the reconnect path behind #1610: a Bluetooth-direct mouse that sleeps and comes back under a new OS node is published again, including when it comes back while device I/O is paused. Nothing in the inventory needed fixing; reading the reporter's logs, the stuck state matches the pause that never resumed (#1281), fixed by #1323 in 0.8.11, and I have asked them to retest there. These tests pin the path so a regression in either half shows up in CI.

Changes

  • openlogi-agent-core: two replay tests driving the real inventory watcher against the replay backend. a_bluetooth_mouse_that_wakes_as_a_new_node_is_published_again removes the node and adds a new one with I/O open. a_mouse_that_wakes_while_device_io_is_paused_is_published_on_resume does the same with I/O paused and asserts nothing is published until resume, then that the mouse is. The direct probe exchanges are factored into a helper shared with the existing replay test.

Both tests bite: with I/O never resumed the second one times out on an empty inventory (the reported symptom), and with I/O never paused its "not published while paused" assertion fails.

Testing

cargo fmt --all -- --check
cargo clippy -p openlogi-device -p openlogi-agent-core -p openlogi-hid --all-targets -- -D warnings
cargo test -p openlogi-device -p openlogi-agent-core -p openlogi-hid

The two new tests passed 25 repeat runs. Not runtime-tested on hardware; test-only change.

Refs #1610

A Bluetooth-direct mouse that sleeps loses its HID node and comes back
under a new one. Two replay tests drive the real inventory watcher
through that cycle: the mouse is published again when it reappears
while device I/O is open, and a mouse that reappears while device I/O
is paused is published once I/O resumes, not before. The second test
fails when the pause is never lifted, which is the empty `openlogi
list` reported in AprilNEA#1610. The direct probe exchanges move into a shared
helper so both tests and the existing replay test build the same
cassette.

Refs AprilNEA#1610
@kohjunhao
kohjunhao requested a review from AprilNEA as a code owner October 2, 2026 12:40
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Test file refactors cassette data for a BLE mouse scenario.

The PR appears safe to merge.

Summary

This PR adds replay coverage for a Bluetooth-direct mouse that reconnects under a new node, both with device I/O available and while it is paused. The latest change also asserts that the paused watcher does not open the woken node.

Reviews (2) · Last reviewed commit: "test(agent): assert a paused gate never ..."

Comment thread crates/openlogi-agent-core/src/watchers/inventory/replay_tests.rs
The paused test only checked that no snapshot was published. An
enumeration pass could still have opened and probed the woken node
before its snapshot was discarded, which is the HID activity the gate
exists to prevent. Assert the node's open count is still zero before
the gate resumes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant