Replace unexplained fixed sleeps in tests with condition waits #186

Closed
opened 2026-10-26 17:56:36 -05:00 by ethan-hann · 1 comment
Owner

.agents/coding-standards/tests-naming-and-structure.md says a test waits on a condition with a deadline (such as UiWait.UntilAsync), and keeps a fixed delay only with a comment that names an outside clock. List them with:

grep -rn -B2 --include=*.cs "Thread.Sleep\|Task.Delay(TimeSpan.FromMilliseconds" tests

Known cases with no stated clock: CaptureBytesTests (Thread.Sleep(500)) and ProfilesCaptureTests (Thread.Sleep(300)). Also check ConsentMarkerTests (Thread.Sleep(holdFor)), AvaloniaCrashPresenterTests, and the retry sleeps in BackendWorkspace, GitWorkspace, and JourneyRig; a retry loop with a deadline is fine, and needs only a comment if the reason is not plain.

`.agents/coding-standards/tests-naming-and-structure.md` says a test waits on a condition with a deadline (such as `UiWait.UntilAsync`), and keeps a fixed delay only with a comment that names an outside clock. List them with: grep -rn -B2 --include=*.cs "Thread.Sleep\|Task.Delay(TimeSpan.FromMilliseconds" tests Known cases with no stated clock: `CaptureBytesTests` (`Thread.Sleep(500)`) and `ProfilesCaptureTests` (`Thread.Sleep(300)`). Also check `ConsentMarkerTests` (`Thread.Sleep(holdFor)`), `AvaloniaCrashPresenterTests`, and the retry sleeps in `BackendWorkspace`, `GitWorkspace`, and `JourneyRig`; a retry loop with a deadline is fine, and needs only a comment if the reason is not plain.
ethan-hann added this to the Code Cleanup milestone 2026-10-26 17:56:36 -05:00
Author
Owner

Shipped in 0.9.17 (PR 227).

Shipped in [0.9.17](https://git.tortal.tech/ethan-hann/SavePoint/releases/tag/v0.9.17) (PR 227).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ethan-hann/SavePoint#186
No description provided.