Make the timing-sensitive tests deterministic !57

merged merged by cmc on 2026-09-07 02:23 UTC · krz/gitbay-ios:test-timing into main

Discussion

cmc

Eleven tests changed something that fires an unstructured task, slept a fixed interval, then asserted on whichever request happened to be last. Two problems at once: a probabilistic wait, and asserting on "the last one" rather than on the request the test is actually about.

Three of them were passing vacuously. Two assert that the reload after a filter change carries no --cursor — but with the reload not yet landed they were asserting against the initial request, which has no cursor either, so they passed whatever the code did. The third asserted the screen was not in a failed state, which is also true of a reload that never started. Each was confirmed failing against injected faults before being trusted.

They now poll for the request they mean, identified by its argv, and assert on that one. A shared until helper replaces the sleeps: faster in the common case, and deterministic rather than merely likely.

Separately, fifteen sites indexed stub.seen directly, so a regression that produced fewer requests crashed the test process instead of failing. They now go through #require, which reports and lets the rest of the suite finish.

No assertion was weakened and no application code changed.