Repository navigation
fix(test): fail fast on bad fixture downloads in downloadToFile - #552
Merged
Merged
Conversation
downloadToFile never checked response.statusCode, so a failed GitHub-release download saved the HTML/JSON error body as a .dcm and poisoned every later run from the fixture cache. Now a non-2xx status rejects with the URL and status in the message, nothing is written to disk until a 2xx arrives, any partial file is removed on failure, and one retry absorbs transient upstream hiccups. Co-Authored-By: Claude Fable 5 <[email protected]>
…ad a partial file The CI failures on this branch showed the second half of the poisoning bug: data.test.js and async-data.test.js download the same fixtures into the same cache path from different jest workers, and the existsSync gate in getTestDataset can observe another worker's half-written file. Stream into a worker-private .partial name and rename into place on completion, so the cache path only ever holds a complete download. Co-Authored-By: Claude Fable 5 <[email protected]>
awatson1978
added a commit
that referenced
this pull request
Sep 30, 2026
…ne and event-stream findings Engine findings 1/3/4/24/25/27/28/32 landed as PRs #544-#551; the writers wave (#552-#557) fixed 5/6/7/11/22/23 in the ports and retired 14 by trimming the video factories from the core facade. Master verdicts are now verified against origin/master, not just triaged. Co-Authored-By: Claude Fable 5 <[email protected]>
|
🎉 This PR is included in version 1.0.0-beta.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
This is the small hygiene fix behind this week's CI flakes:
downloadToFilein the test utilities now refuses to save anything that isn't a real, complete fixture.The old implementation piped whatever came back from GitHub straight into the target file without ever looking at
response.statusCode. When a release-asset download failed — rate limiting, a transient 5xx, an expired redirect — the error body itself got saved as a.dcmfile. And because the fixture cache treats any existing file as a valid download, that poisoned file then failed every later run on the same machine with a confusing parse error, far away from the real cause.This PR's own first CI run then demonstrated the second half of the bug, live.
test/data.test.jsandtest/async-data.test.jsboth downloadmultiframe-ultrasound.dcmandlarge-private-tags.dcmto the same cache path, from different jest worker processes. The dedup map ingetTestDatasetis per-process, so worker B'sfs.existsSyncgate can see worker A's half-written file and read a truncated stream — which is exactly the "expected header is missing" / "Invalid tag in sequence" flake pattern, and what the first run of this PR hit twice.So the fix has two parts, both in
downloadToFile:<name>.<pid>.partialfile and atomically rename into place on completion, so the cache path only ever holds a complete download — no matter how many workers race.On testing without network access: the new
test/downloadToFile.test.jsspins up a localhttp.Serverthat scripts the interesting responses — a clean 200, a 302 redirect, a 404, a slow two-chunk body (to pin that the target path never exists mid-download), and a 503-then-200 sequence for the retry. To make that possible I letdownloadToFilepick thefollow-redirectstransport by URL scheme (it was hard-coded to https); real fixture downloads still go over https exactly as before.🤖 Generated with Claude Code