Skip to content

test(deploy): guard upload retries, failures, and concurrency - #8525

Open
netlify-coding[bot] wants to merge 1 commit into
mainfrom
netliloop/run-203/upload-integration-coverage
Open

netlify-coding[bot] wants to merge 1 commit into
mainfrom
netliloop/run-203/upload-integration-coverage

Conversation

@netlify-coding

@netlify-coding netlify-coding Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Opened by Netliloop run #203 (reduce-change-failure-risk)

Why

The upload unit tests stub the API and never consume file streams. All three still pass when retries drop a byte, permanent errors resolve successfully, the retry budget grows, concurrency becomes unlimited, or completion is reported early.

What changed

  • Exercise static, function, and edge-function uploads through the real API client and local HTTP server, checking complete binary bodies on retry.
  • Assert that HTTP 400/422 reject immediately and exhausted retries retain the final server error, without reporting completion.
  • Hold HTTP responses open to check the concurrency limit, result order, and completion only after every upload settles.

How we verified

  • GitHub checks — 34 successful, 3 neutral; none pending or failing.
  • CI=true npm run test:unit — 640 passed.
  • npm exec vitest -- run tests/integration/commands/deploy/upload-files.test.ts tests/unit/utils/deploy/ — 31 passed.
  • npm run typecheck and focused ESLint/oxfmt checks — passed.
  • Five injected production regressions passed the old tests and failed the new tests; production code was restored and the suite passed again.
  • Independent HTTP smoke with production backoff delays — complete 524,305-byte retries for all three asset types, connection-loss recovery, terminal errors, and concurrency checks passed.
  • deploy --json --no-build --dir public through the TypeScript command entry — successful deploy JSON after two complete 262,181-byte upload attempts, with a 6,183 ms retry gap.
  • These checks connect the real filesystem, uploader, API client, and HTTP transport. The remote deploy API is a local fixture; the command smoke also stubs the extensions lookup. The committed tests shorten backoff delays.

What is left to test

Live Netlify API failure behavior is unverified; these tests deliberately supply controlled HTTP failures locally. The local command smoke bypasses the compiled launcher/update notifier; CI E2E jobs pass. No live deployment is needed to validate this test-only change.

Run the upload checks locally
npm ci
npm exec vitest -- run tests/integration/commands/deploy/upload-files.test.ts tests/unit/utils/deploy/
npm run typecheck
npm exec eslint -- tests/integration/commands/deploy/upload-files.test.ts
npm exec oxfmt -- --check tests/integration/commands/deploy/upload-files.test.ts

Expected: 31 tests pass and all three quality checks exit successfully.

Risk

Low — test-only coverage can fail CI but cannot change production upload behavior.

@netlify-coding
netlify-coding Bot requested a review from a team as a code owner September 24, 2026 04:17
@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 5ba0f60f-8a14-4b00-bbe3-90a635d0cbf5

📥 Commits

Reviewing files that changed from the base of the PR and between f5dc78a and a773ebf.

📒 Files selected for processing (1)
  • tests/integration/commands/deploy/upload-files.test.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • netlify/blueprints (manual)

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Tests
    • Added coverage for deploy uploads involving files, functions, and edge functions.
    • Added checks for retry handling, permanent failures, exhausted retries, and concurrent upload limits.

Walkthrough

Adds integration tests for deploy uploads. The tests cover successful retries for files, functions, and edge functions; non-retryable HTTP 400 and 422 responses; retry-budget exhaustion; and concurrent uploads with results returned in input order.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: amun-sihra

Merge Risk: ⚪ Minimal · up to a773e

The upload tests cover the described behaviors, including completion after outstanding uploads settle. No identified issue prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the change as deploy upload tests that cover retries, failures, and concurrency. It matches the main purpose of the changeset.
Description check ✅ Passed The description directly explains the integration test coverage, verification steps, scope, and remaining limitations. It is related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📊 Benchmark results

Comparing with f5dc78a

  • Dependency count: 1,073 (no change)
  • Package size: 422 MB (no change)
  • Number of ts-expect-error directives: 346 (no change)

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/netlify-cli@8525

commit: a773ebf

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.

0 participants