test: fix a race in the storage tab's unavailable-storage test - #198
Merged
Conversation
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.
What happened
The
coveragejob failed on an unrelated PR (#195) with:Every other job on that PR passed, and the same suite passed locally —
including a full
vitest run --coverage. So it is a flake, not aregression, and it is worth fixing rather than re-running because it
blocks merges at random.
The race
"Regenerable" is static markup, so it renders on the first pass. The count
beside "Editor scripts" starts at
…and settles a tick later. Waiting forthe heading and then asserting the count synchronously only worked when
the query happened to resolve first — usually true locally, intermittently
false under CI's slower coverage-instrumented run.
The fix
Await the thing actually being asserted. The assertion moves inside
waitFor, so it retries until the count settles.This is strictly stronger, not weaker: the test's stated intent is "zeroes,
not a crash and not
…forever", and it now verifies exactly that insteadof accidentally depending on scheduling order. A genuinely stuck
…stillfails it, on the
waitFortimeout.Evidence
CI itself produced the failing-without-the-fix proof — it observed
…atthat assertion. Locally the suite is green before and after, which is the
whole problem with the old form.