Repository navigation
refactor(deploy): consolidate deploy creation logic - #8605
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
📊 Benchmark resultsComparing with 336e09e
|
commit: |
- Create deploys through a single helper, instead of duplicating across `--build` and `--no-build`
- Behaviour change (technically): with `--build`, a deploy response without an `id` no longer
falls back to an empty-string deploy ID; the deploy ID is passed through as returned by the API,
matching the `--no-build` path.
- Use optional chaining where we now can.
- Behaviour change (technically): a non-object `published_deploy` (for example a
function) with a truthy `locked` property now counts as locked.
- Remove optional chaining now revealed to be unnecessary.
- Behaviour change (technically) if the types are wrong (they aren't).
d5abf07 to
a5c7b12
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
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.
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.
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.
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.
Summary
Batch 1 of 3 of follow-ups to #8599. Out of an abundance of caution, that PR was kept purely focused on type changes.
--buildand--no-build--build, a deploy response without anidno longer falls back to an empty-string deploy ID; the deploy ID is passed through as returned by the API, matching the--no-buildpath. ✅ Verified not possible in backend code.published_deploy(for example a function) with a truthylockedproperty now counts as locked. ✅ Verified not possible in backend code.