Skip to content

Retry SwiftPM artifact version lookups on transient failures - #59955

Open
lazerg wants to merge 4 commits into
react:mainfrom
lazerg:fix/issue-59942-retry-spm-lookups
Open

lazerg wants to merge 4 commits into
react:mainfrom
lazerg:fix/issue-59942-retry-spm-lookups

Conversation

@lazerg

@lazerg lazerg commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary:

#59214 made download() retry transport errors and HTTP 408/429/5xx, but the lookups that run before the downloads (resolveNightlyVersion, resolveLatestV1Version and the maven-metadata.xml fetch in resolveSnapshotUrl) still call fetch once. One dropped connection to npm or Sonatype ends the SwiftPM setup with fetch failed, which is what took down the CI lanes linked in the issue.

This adds a small fetchWithRetry that uses the same attempts, backoff and retryable statuses as download(), and the three lookups go through it. 404s and other client errors still fail on the first try.

Fixes #59942

Changelog:

[INTERNAL] [FIXED] - Retry SwiftPM artifact version lookups on transient failures

Test Plan:

Added tests to download-spm-artifacts-test.js for a dropped connection on the nightly lookup and a 503 on the snapshot metadata, and the latest-v1 failure test now checks it gives up after 3 attempts. The two tests that used a 5xx to mean "lookup failed" now use a 404. All 78 tests in the file pass, and the new ones fail without the change. I don't have Xcode on this machine, so I didn't run the full SwiftPM setup.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 12, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SwiftPM artifact setup gives up on the first dropped connection to a version lookup

1 participant