The siblings of #1586 that 7b151cf54 left alone. Each said "comes back
without waiting" by measuring time.Since(start) against a bound (50ms,
500ms, 1s, 2s, 3s) that a loaded runner can pass and so make red without
the guarantee breaking. Each now holds the slow thing until it has its
answer, so a call that comes back at all came back without waiting for it.
A deadline is kept only so a call that did wait fails as a FAIL rather
than a hang, and each is short of the slow thing's own timeout, so a call
that waited cannot come back in time by having it time out:
- cli_identity_test TestCLIIdentityFirstAskBounded: both looks run while
the ask is held (it was already). The second look is run with firstAsk
set to an hour, so a second look that waited again (not only waited the
whole ask) is caught; 10s guard.
- claude_status_test TestClaudeIdentityServedWhileAsked: the stand-in CLI
now waits for a file instead of `sleep 1`, and writes another when
reached. The stale look must come back while it is held, with the ask
still in flight (claudeStatusBusy), and the CLI must have been asked
again. The guard is 4s, short of askClaudeStatus' own 5s kill. Its
cleanup lets the CLI go and waits for the ask to end.
- partners_test TestPartnersDoesNotWait: the five Partners() calls run
while the site is held; 10s guard (the fetch's own is 20s).
- partners_test TestPartnersNow and plugin_icon_test
TestRepoIconsWaitForFirstFetch had a floor and a ceiling. The floor is
the guarantee that the call waited for its bound, and a busy machine only
lengthens it, so it stays (100ms, and 250ms for a 300ms wait as before).
The ceiling was the "doesn't wait past its bound" half: it is now that
the call comes back while the site/fetch is held; 10s guard (the fetch's
own are 20s and 30s).
- sub2api_usage_test TestKeyAllowanceNeverWaits: the ten looks run while
sub2api is held and report back over a channel, not t.Errorf from a
goroutine that could outlive a failed test; 10s guard (the read's own is
30s).
What was run (temp HOME, caches pinned):
go test -tags nogui -race -count=10 -run '<the six tests>' ./internal/provider ok
go test -tags nogui -count=1 ./internal/provider ok 395.6s
gofmt -l; go vet, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/provider clean
Broken by hand, each red at the new assertion:
cli_identity.go, drop c.waited = true (every look waits):
:124 a second look waited
cli_identity.go, drop the firstAsk case (the first look waits the ask):
:116 the first look waited for the held ask
account.go, askClaudeStatus() in the stale case under the lock:
claude_status_test.go:111 a stale look waited for the held CLI
partners.go, Partners runs refreshPartners in line:
:246 Partners waited for the held site
partners.go, PartnersNow without its time.After(wait):
:316 PartnersNow waited past its bound for the held site
key_allowance.go, KeyAllowance reads in line (lock let go around it):
sub2api_usage_test.go:279 a look waited for the held read
plugin_icon.go, RepoIcons without its timer case:
:168 RepoIcons waited past its 300ms for the held fetch
RepoIcons starts every fetch, then waits for those not in yet, so the
list's first answer has them; one slower than the wait shows the next
time. The fetch takes fetchPluginIcon before its goroutine starts.
Ran: go test ./internal/provider ./internal/gui; the new test -race
-count=10, and red with a 1ns wait. A sandbox build (fresh HOME, real
GitHub): the first /api/plugins/github answer has all 8 icons the 13
tagged repositories give, screenshot in light and dark.