Skip to content

refactor(deploy): simplify deploy polling, retries, streams - #8627

Merged
serhalp merged 1 commit into
serhalp/deploy-types-refactors-batch2from
serhalp/deploy-types-refactors-batch3
Oct 16, 2026
Merged

serhalp merged 1 commit into
serhalp/deploy-types-refactors-batch2from
serhalp/deploy-types-refactors-batch3

Conversation

@serhalp

@serhalp serhalp commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Batch 3 of 3 of follow-ups to #8599 (batch 1, batch 2). Out of an abundance of caution, that PR was kept purely focused on type changes.

  • Share one poller between waitForDiff and waitForDeploy instead of duplicating code
  • Resolve the deploy poll with the ready deploy
    • waitForDropDeploy captured the ready deploy in an outer variable and returned it with a non-null assertion after polling. The poll now resolves with it directly via pWaitFor.resolveWith.
  • Rethrow the final drop upload error from inside the retry loop
    • The file upload retry loop remembered the last error, skipped the backoff on the final
      attempt, and threw the remembered error after the loop. It now throws directly on a permanent failure or on the last attempt, and otherwise backs off and retries. Simplify all this.
  • Don't return the upload promise to the backoff emitter. It wasn't used, resulting in lint errors about promise misuse.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 3d9a303f-87e6-4c44-b626-86daa5c04d70
📥 Commits

Reviewing files that changed from the base of the PR and between 81666c0 and 0bd59b6.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: e799baf9-71e6-40da-a3b8-d325c957c300
📥 Commits

Reviewing files that changed from the base of the PR and between 9f36ceb and 81666c0.

📒 Files selected for processing: 4
  • eslint-suppressions.json
  • src/utils/deploy/drop-api.ts
  • src/utils/deploy/upload-files.ts
  • src/utils/deploy/util.ts
🔗 Linked repositories identified

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

Included review availability: This review used your included allowance. 8 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Deployment uploads now stop retrying immediately for HTTP 400 and 422 errors, and report failures after the final attempt. Other upload errors continue to be retried.
    • Deployment polling now reports an error when a deploy enters an error state, using the API’s message when available or a deploy-specific fallback.

Deploy-state polling now uses a shared poller for waitForDiff and waitForDeploy, with an exported DeployStateError class. waitForDropDeploy returns the polling result directly. Upload handling rethrows HTTP 400 and 422 errors without retrying, and the ready listener passes the retry index to tryUpload.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: eduardoboucas

Merge Risk: ⚪ Minimal · up to 81666

No merge-blocking issue is evident; the change is ready for normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
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 3…
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.
Description check Passed The description directly covers the deploy polling, drop-upload retry, and backoff changes in the changeset.
Title check Passed The title clearly summarizes the main refactoring of deploy polling, retries, and streams.
Full details: Docstring Coverage

Explanation

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 3 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@serhalp
serhalp added this pull request to stack #8628 October 16, 2026 09:45

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Review with "hide whitespace"!

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

📊 Benchmark results

Comparing with 2e5bc91

  • Dependency count: 1,022 (no change)
  • Package size: 381 MB (no change)
  • Number of ts-expect-error directives: 280 (no change)

@pkg-pr-new

pkg-pr-new Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 0bd59b6

// eslint-disable-next-line @typescript-eslint/no-misused-promises -- FIXME: the listener's promise is discarded
fibonacciBackoff.on('ready', tryUpload)
fibonacciBackoff.on('ready', (retryIndex) => {
void tryUpload(retryIndex)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We intentionally don't await this promise. We handle errors via emitted events.

Batch 3 of 3 of follow-ups to #8599 ([batch 1](#8605), [batch 2](#8626)). Out of an abundance of caution, that PR was kept purely focused on type changes.

- Share one poller between `waitForDiff` and `waitForDeploy` instead of duplicating code
- Resolve the drop deploy poll with the ready deploy
  - `waitForDropDeploy` captured the ready deploy in an outer variable and returned it with a
    non-null assertion after polling. The poll now resolves with it directly via
    `pWaitFor.resolveWith`.
- Rethrow the final drop upload error from inside the retry loop
  - The drop file upload retry loop remembered the last error, skipped the backoff on the final
    attempt, and threw the remembered error after the loop. It now throws directly on a permanent
    failure or on the last attempt, and otherwise backs off and retries. The status is read through
    an `instanceof Error` guard instead of a cast.
- Don't return the upload promise to the backoff emitter. It wasn't used, resulting in lint errors
  about promise misuse.
@serhalp
serhalp force-pushed the serhalp/deploy-types-refactors-batch3 branch from 81666c0 to 0bd59b6 Compare October 16, 2026 15:49
@serhalp
serhalp marked this pull request as ready for review October 16, 2026 15:52
@serhalp
serhalp requested a review from a team as a code owner October 16, 2026 15:52
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-16T15:52:46.502136Z 0bd59b6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@serhalp
serhalp merged commit 20e0b51 into main Oct 16, 2026
38 checks passed
@serhalp
serhalp deleted the serhalp/deploy-types-refactors-batch3 branch October 16, 2026 18:03
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.

2 participants