Relationships
#3942 swamp-extensions GCS storage test 'put: an abort mid-upload leaves no object and no resumable session' fails about 1 run in 5 (fixed 50 ms sleeps)
Opened by stack72 · 10/25/2026· Shipped 10/26/2026
What happens
In swamp-extensions, datastore/gcs/extensions/datastores/_lib/gcs_storage_test.ts › "put: an abort mid-upload leaves no object and no resumable session" fails intermittently with:
error: AssertionError: Values are not equal.
- true
+ false
at gcs_storage_test.ts:133That is assertEquals(state.objects.has(chunkKey(sha256)), false): the emulator stored the aborted chunk.
Where it was seen
- verify-build for the swamp-club#3941 extension PR failed on it (run a192b1e7). A rerun of verify-build alone passed (cff72f5a).
- On swamp-extensions
origin/main(2026-10-25) the test failed 4 times in 20 when run alone on macOS. The test,gcs_storage.tsandgcs_emulator_test_util.tsare unchanged on that PR's branch, so the flake is pre-existing.
Likely cause
The test aborts the upload, then waits a fixed 50 ms for the emulator to see the connection close, releases the held request, and waits another fixed 50 ms before asserting. When the emulator reads the complete body before it notices the abort (the test's own comment names this case for Windows, where the loopback buffers the body), it commits the object. The fixed sleeps make the outcome timing-dependent.
Fix
Replace the fixed sleeps with a condition: have the emulator report when the held request finished (aborted or completed), and waitFor that, or assert on the request's outcome rather than racing the commit. swamp's test rules forbid fixed sleeps for async work for this reason.
Done when
- The test passes 50 of 50 runs in a loop on macOS and Linux.
Shipped
Click a lifecycle step above to view its details.
system commented 10/25/2026, 9:42:17 PM
Classified automatically when this issue was filed.
- Source: Extensions
If you feel this classification is incorrect, add a ripple to tell us so.
Sign in to post a ripple.