PROD-2201: fix interrupted asset download poisoning the pull cache#174
Merged
Conversation
An interrupted asset pull wrote the metadata JSON before the binary downloaded. Change detection then skipped the asset forever (it only checked the JSON's existence + dateModified), and later pushes failed with "Local asset file not found". - shouldDownloadAsset now takes binaryExists; a present metadata JSON with a missing binary returns shouldDownload: true (reason: "missing binary"), so an already-poisoned cache self-heals on the next pull. - Write the metadata JSON only after downloadFile succeeds, so an interrupted run can no longer leave a metadata-only (poisoned) entry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Covers both halves of the fix: - unchanged metadata + missing binary -> re-download; + present binary -> skip - metadata JSON not written when downloadFile fails; written only after it resolves Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jules-exel
approved these changes
Jul 8, 2026
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.
PROD-2201
When an asset pull is interrupted (or a single file download fails), the CLI wrote the asset's metadata JSON before the binary downloaded. Change detection then skipped the asset forever — it only checked the JSON's existence +
dateModified, never the binary on disk — and later pushes failed withLocal asset file not found.Fix (
src/lib/downloaders/download-assets.ts)shouldDownloadAssetnow takesbinaryExists; a present metadata JSON with a missing binary returnsshouldDownload: true(reason:"missing binary"). This lets an already-poisoned cache self-heal on the next pull — no manual JSON deletion needed.exportFiles(...)for the metadata JSON now runs only inside thedownloadFilesuccess branch, so an interrupted run can no longer leave a metadata-only (poisoned) entry.Tests
src/lib/downloaders/tests/download-assets.test.ts— 4 new cases:downloadFilefails → metadata JSON not writtendownloadFilesucceeds → metadata written, and only after the download resolvesFull suite green (97 suites / 1689 tests).
🤖 Generated with Claude Code