Repository navigation
Fix flaky link-up reconfigure test by parking the retry poll - #20
Merged
Merged
Conversation
testLinkUpAndWirelessStatusTogetherReconfigureOnce counts the reporting writes a wake burst (0x41 link-up plus 0x1D4B reconnect) causes. The retry poll armed at link loss kept running with 0.1-0.2 s delays, so on a slow runner a poll could reconfigure the woken mouse before the debounced reconfiguration ran, doubling the count (8 instead of 4). Park the poll like the neighbouring wake tests do, so the burst is the only source. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Boss
What and why
Before: the Build workflow on main has been red since #19.
ControllerTests.testLinkUpAndWirelessStatusTogetherReconfigureOncefailed with 8 reporting writes instead of 4, although nothing in #19 touched UprightKit.After: the test only measures what it is about, and the suite passes.
The test checks that a wake burst (the receiver's 0x41 link-up plus the mouse's 0x1D4B reconnect) leads to one reconfiguration. But the retry poll armed when the link dropped kept running with 0.1 to 0.2 s delays. On a slow runner a poll could fire after the mouse woke, reconfigure it on its own (4 writes), and then the debounced link-up reconfiguration ran as well (4 more). The fix parks the retry poll in this test, as the neighbouring wake tests already do, so the burst is the only thing that can reconfigure. No sleep was lengthened and nothing is skipped.
How I tested it
swift testinUprightKitpasses twice in a row: 395 tests, 0 failures each runmake appbuilds (no app or project changes)Checklist
Platform/uses Foundation only (test-only change)@MainActortest class isasyncCHANGELOG.md(test-only, no user-facing change)🤖 Generated with Claude Code