Skip to content

refactor(deploy): simplify code post type fixes - #8626

Merged
serhalp merged 1 commit into
mainfrom
serhalp/deploy-types-refactors-batch2
Oct 16, 2026
Merged

serhalp merged 1 commit into
mainfrom
serhalp/deploy-types-refactors-batch2

Conversation

@serhalp

@serhalp serhalp commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

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

  • Drop runtime checks for options the types now require
  • Remove the unused assetType option from file hashing
  • Only upload in-memory bodies for static files
    • Every upload built its body with body ?? fs.createReadStream(filepath), although only the generated netlify.toml (an InlineUploadFile) ever carries an in-memory body. Static files still upload their inline body when present and stream filepath otherwise; functions, edge functions and servers now always stream from filepath.
  • Build the functions config with Object.fromEntries
    • The per-function config payload sent to the API was accumulated with a spreading reduce. It is now built by a named toFunctionConfigPayload mapper and Object.fromEntries, which also gives the payload a derived type.

@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: 641968a1-5ddb-4b0a-b103-0a414a3acf37
📥 Commits

Reviewing files that changed from the base of the PR and between 9f36ceb and 573165c.

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: 6dd203ae-0280-48a0-9eed-a4b3885d6db0
📥 Commits

Reviewing files that changed from the base of the PR and between 00a2677 and 9f36ceb.

📒 Files selected for processing: 7
  • src/commands/deploy/deploy.ts
  • src/utils/deploy/deploy-site.ts
  • src/utils/deploy/hash-config.ts
  • src/utils/deploy/hash-files.ts
  • src/utils/deploy/hash-fns.ts
  • src/utils/deploy/hasher-segments.ts
  • src/utils/deploy/upload-files.ts
🔗 Linked repositories identified

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

💤 Files with no reviewable changes: 1
  • src/utils/deploy/deploy-site.ts

Included review availability: This review used your included allowance. 7 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

  • Refactor
    • Updated deployment processing for static files and functions. Static uploads continue to use inline content when available or stream from disk; function-related uploads stream from their file paths.
    • Deployment configuration and file hashing now use more specific required inputs. No new deployment options or changes to the visible deployment workflow are included.

Deployment hashing options and types changed for static files, config, and functions. Function configuration entries now use a shared payload helper and Object.fromEntries. Upload body callbacks are created within each asset-type branch, with filepath streams used for function, edge-function, and server uploads.

Priority: ⬇️ Low

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

Change: Refactor

Suggested reviewers: ndhoule

Merge Risk: ⚪ Minimal · up to 9f36c

No actionable merge-blocking risk is established in the reviewed changes; the deploy file filter receives path strings and remains safe without its removed nullish guard.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the deployment refactor and aligns with the stated objectives.
Description check Passed The description directly explains the deployment refactoring, type-driven runtime check removal, upload behavior, and function configuration changes.
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 6…
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.
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 6 files.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 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.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

📊 Benchmark results

Comparing with 00a2677

  • Dependency count: 1,019 (no change)
  • Package size: 380 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@8626

commit: 573165c

@serhalp
serhalp force-pushed the serhalp/deploy-types-refactors-batch2 branch 2 times, most recently from 978ca56 to 9f36ceb Compare October 16, 2026 09:41
@serhalp
serhalp added this pull request to stack #8628 October 16, 2026 09:45
Batch 2 of 3 of follow-ups to #8599 (batch 1 here: #8605). Out of an abundance of caution, that PR was kept purely focused on type changes.

- Drop runtime checks for options the types now require
- Remove the unused `assetType` option from file hashing
- Only upload in-memory bodies for static files
  - Every upload built its body with `body ?? fs.createReadStream(filepath)`, although only the
    generated `netlify.toml` (an `InlineUploadFile`) ever carries an in-memory body. Static files
    still upload their inline `body` when present and stream `filepath` otherwise; functions, edge
    functions and servers now always stream from `filepath`.
- Build the functions config with `Object.fromEntries`
  - The per-function config payload sent to the API was accumulated with a spreading `reduce`. It is
    now built by a named `toFunctionConfigPayload` mapper and `Object.fromEntries`, which also gives
    the payload a derived type.
@serhalp
serhalp force-pushed the serhalp/deploy-types-refactors-batch2 branch from 9f36ceb to 573165c Compare October 16, 2026 15:49
serhalp added a commit that referenced this pull request Oct 16, 2026
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 marked this pull request as ready for review October 16, 2026 15:50
@serhalp
serhalp requested a review from a team as a code owner October 16, 2026 15:50
@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:50:16.312215Z 573165c 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 1bc3772 into main Oct 16, 2026
37 checks passed
@serhalp
serhalp deleted the serhalp/deploy-types-refactors-batch2 branch October 16, 2026 18:03
serhalp added a commit that referenced this pull request Oct 16, 2026
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.
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