Repository navigation
refactor(cli): the cloud upload's PUT and retry code moves to its own file - #7374
Merged
Merged
Conversation
Merged
5 of 6 tasks
Contributor
There was a problem hiding this comment.
Approve at dd428193. No blockers.
Verified
- This is a pure move. I diffed the lines removed from
upload.tsagainst the newuploadPut.ts. The only differences are:- the file header comment;
exportonPutTry,PutRefusedError,putWithRetry,sleepandputStreamToPresignedUrl;putWithRetrymade generic,<T>returningPromise<T>, whichvoidcallers do not notice.
putTimingsis re-exported as the same object, so tests that change it still change what the PUT reads.- The
vi.mock("node:fs")inoffload.test.tscovers the whole module graph, so thecreateReadStreamnow called inuploadPut.tsis still mocked. - CI is green on this head, including the
cliunit suite. - This is a refactor, not a fix, so no "fails without the fix" line is needed.
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.
What
The cloud upload's PUT code (one try with a stall watch, the retry loop around it, the progress sampling and the streamed body) moves from
packages/cli/src/cloud/upload.tsto a newuploadPut.ts. No behavior changes: the moved code is the same,putWithRetrybecomes generic over what a try returns (today it returns nothing), andupload.tsre-exportsputTimingsandUploadFileSourceso callers and tests import what they did before.Why
The next PR sends a big file in parts, and each part goes through this same PUT and retry. Moving it first keeps that PR to the feature and keeps
upload.tsunder the size the audit allows.Test plan
src/cloudunit tests unchanged and passing, 3 runs in a row.tsc --noEmitforcliexit 0.bun run format:checkexit 0;fallow audit --base origin/main --fail-on-issuesexit 0; oxlint exit 0; comment ratchet and citations exit 0.