Skip to content

refactor(cli): the cloud upload's PUT and retry code moves to its own file - #7374

Merged
miguel-heygen merged 1 commit into
mainfrom
refactor/cloud-upload-put-file
Nov 7, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
refactor/cloud-upload-put-file

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

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.ts to a new uploadPut.ts. No behavior changes: the moved code is the same, putWithRetry becomes generic over what a try returns (today it returns nothing), and upload.ts re-exports putTimings and UploadFileSource so 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.ts under the size the audit allows.

Test plan

  • src/cloud unit tests unchanged and passing, 3 runs in a row.
  • tsc --noEmit for cli exit 0.
  • bun run format:check exit 0; fallow audit --base origin/main --fail-on-issues exit 0; oxlint exit 0; comment ratchet and citations exit 0.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at dd428193. No blockers.

Verified

  • This is a pure move. I diffed the lines removed from upload.ts against the new uploadPut.ts. The only differences are:
    • the file header comment;
    • export on PutTry, PutRefusedError, putWithRetry, sleep and putStreamToPresignedUrl;
    • putWithRetry made generic, <T> returning Promise<T>, which void callers do not notice.
  • putTimings is re-exported as the same object, so tests that change it still change what the PUT reads.
  • The vi.mock("node:fs") in offload.test.ts covers the whole module graph, so the createReadStream now called in uploadPut.ts is still mocked.
  • CI is green on this head, including the cli unit suite.
  • This is a refactor, not a fix, so no "fails without the fix" line is needed.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit b418bb2 Nov 7, 2026
70 checks passed
@miguel-heygen
miguel-heygen deleted the refactor/cloud-upload-put-file branch November 7, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant