fix: retry Foundry binary downloads - #9854
Draft
davidmurdoch wants to merge 3 commits into
Draft
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.
Explanation
@metamask/foundryupcurrently aborts an installation after a single transient failure while downloading a Foundry release archive. This makes consumers—especially parallel CI jobs—vulnerable to short-lived GitHub release-asset5xx, rate-limit, socket-reset, and truncated-stream failures.This PR retries the complete archive download and extraction operation for errors that are likely transient. Retrying the complete operation ensures a mid-stream failure starts again with a clean temporary directory rather than appending to or consuming a partial archive.
The default policy uses five total attempts with exponential backoff, equal jitter, a 1-second initial delay, and a 30-second delay cap. Permanent HTTP failures and validation errors still fail immediately. No new dependencies are introduced.
Consumers can override the policy with
--max-attempts,--initial-retry-delay-ms, and--max-retry-delay-ms, or with the equivalentFOUNDRYUP_MAX_ATTEMPTS,FOUNDRYUP_INITIAL_RETRY_DELAY_MS, andFOUNDRYUP_MAX_RETRY_DELAY_MSenvironment variables. Setting--max-attempts 1disables retries.References
Checklist
Validation
yarn workspace @metamask/foundryup test:verbose --runInBandyarn eslint packages/foundryup/src/download.ts packages/foundryup/src/download.test.ts packages/foundryup/src/types.ts packages/foundryup/src/options.ts packages/foundryup/src/index.ts packages/foundryup/src/foundryup.test.tsyarn tsc --build packages/foundryup/tsconfig.lint.jsonyarn workspace @metamask/foundryup buildyarn oxfmt --check eslint-suppressions.json packages/foundryup/src/download.ts packages/foundryup/src/download.test.ts packages/foundryup/src/types.ts packages/foundryup/src/options.ts packages/foundryup/src/index.ts packages/foundryup/src/foundryup.test.ts packages/foundryup/README.md packages/foundryup/CHANGELOG.mdyarn workspace @metamask/foundryup changelog:validatenode packages/foundryup/dist/cli.mjs --help