fix: silence zip output when creating source zips#8323
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
Walkthrough
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
ebb6bdf to
78c34c2
Compare
474a2d4 to
b915667
Compare
This code path is the cause of a bunch of SWAR errors. Logs don't provide enough information for us to debug this right now, so this PR does two things: - Adds the `-q` flag to `zip` to quiet its output. (We pass this flag everywhere else we call out to `zip`.) I have a weak suspicion the root cause here could be a too-much-output error (but that seems unlikely). - Improves the error output when we hit this error. This should let us debug the issue if it comes up again in the future.
b915667 to
b9049ab
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/unit/utils/deploy/upload-source-zip.test.ts (1)
335-338: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueInconsistent mock return type across tests.
These two
execamocks return a synchronous{} as ExecaReturnValue, whereas the other tests (Lines 64, 127, 286) returnPromise.resolve(...). The awaited call tolerates both, but aligning them avoids confusion about whatexecaresolves to.♻️ Optional alignment
- vi.mocked(mockExeca.default).mockImplementation((..._args) => { - return {} as ExecaReturnValue - }) + vi.mocked(mockExeca.default).mockImplementation((..._args) => { + return Promise.resolve({} as ExecaReturnValue) + })Also applies to: 374-377
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/utils/deploy/upload-source-zip.test.ts` around lines 335 - 338, The execa mocks in the upload-source-zip tests are inconsistent with the other cases, returning a synchronous cast instead of a resolved promise. Update the mockImplementation blocks for the affected execa stubs to match the existing Promise.resolve pattern used elsewhere in upload-source-zip.test.ts, so the mocked behavior is consistent across all tests and easier to understand.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/utils/deploy/upload-source-zip.ts`:
- Around line 76-89: The zip upload error handling in upload-source-zip should
use the combined execa output instead of stdout alone, since zip -q often leaves
stdout empty. Update the catch block around the execa call to build the thrown
Error message from the ExecaError details using the interleaved output first,
then stderr as fallback, and keep the existing cause chaining. Use the existing
execa invocation and ExecaError handling in upload-source-zip.ts as the place to
make this change.
---
Nitpick comments:
In `@tests/unit/utils/deploy/upload-source-zip.test.ts`:
- Around line 335-338: The execa mocks in the upload-source-zip tests are
inconsistent with the other cases, returning a synchronous cast instead of a
resolved promise. Update the mockImplementation blocks for the affected execa
stubs to match the existing Promise.resolve pattern used elsewhere in
upload-source-zip.test.ts, so the mocked behavior is consistent across all tests
and easier to understand.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e33820fe-c445-48ee-b472-90460211264a
📒 Files selected for processing (2)
src/utils/deploy/upload-source-zip.tstests/unit/utils/deploy/upload-source-zip.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
netlify/blueprints(manual)
|
Claude:
|
zip writes errors to stderr and -q silences stdout, so appending stdout left the failure reason blank. Use the interleaved output captured by all: true instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/utils/deploy/upload-source-zip.ts (1)
82-89: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winFix undefined
allcausing lint failure and add stderr fallback.
baseErr.allis typedstring | undefined(only populated whenall: true, which is set, but the type still allows undefined for edge cases like early spawn failures), triggering the ESLintrestrict-template-expressionserror. Also, per the PR's own rationale,stderrshould be the fallback whenallisn't populated.🐛 Proposed fix
- message = `${baseErr.shortMessage}\n\n${baseErr.all}` + message = `${baseErr.shortMessage}\n\n${baseErr.all ?? baseErr.stderr ?? ''}`🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/utils/deploy/upload-source-zip.ts` around lines 82 - 89, The error handling in upload-source-zip.ts’s catch block should avoid interpolating the possibly undefined ExecaError.all value and should fall back to stderr when all is unavailable. Update the logic around the _baseErr / baseErr path so the message is built from shortMessage plus a defined output source, using baseErr.all when present and baseErr.stderr otherwise, while preserving the existing throw new Error(..., { cause: _baseErr }) behavior.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/utils/deploy/upload-source-zip.ts`:
- Around line 82-89: The error handling in upload-source-zip.ts’s catch block
should avoid interpolating the possibly undefined ExecaError.all value and
should fall back to stderr when all is unavailable. Update the logic around the
_baseErr / baseErr path so the message is built from shortMessage plus a defined
output source, using baseErr.all when present and baseErr.stderr otherwise,
while preserving the existing throw new Error(..., { cause: _baseErr })
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7b6f7d3f-de3b-4033-880f-a7f0d1380d81
📒 Files selected for processing (1)
src/utils/deploy/upload-source-zip.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
netlify/blueprints(manual)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🤖 I have created a release *beep* *boop* --- ## [26.2.0](v26.1.0...v26.2.0) (2026-07-06) ### Features * add watch-ignore flag ([#8271](#8271)) ([fc30bcc](fc30bcc)) ### Bug Fixes * add a stacktrace for monitoring ([#8301](#8301)) ([30ba6a1](30ba6a1)) * add commandname to error reporting ([#8303](#8303)) ([004df96](004df96)) * **deps:** replace lodash with native utilities ([#8189](#8189)) ([137fbf0](137fbf0)) * **deps:** update dependency @netlify/blobs to ^10.7.9 ([#8291](#8291)) ([419a749](419a749)) * **deps:** update dependency @netlify/dev to ^4.18.7 ([#8292](#8292)) ([1985b3b](1985b3b)) * **deps:** update dependency @netlify/dev-utils to ^4.4.6 ([#8293](#8293)) ([392af83](392af83)) * **deps:** update dependency @netlify/edge-functions to ^3.0.8 ([#8295](#8295)) ([7d00215](7d00215)) * **deps:** update dependency @netlify/functions to ^5.3.0 ([#8296](#8296)) ([42393a4](42393a4)) * **deps:** update dependency @netlify/images to ^1.3.10 ([#8298](#8298)) ([20fb23d](20fb23d)) * **dev:** execute dev command with shell operators (`&&`, `||`, etc.) ([#8234](#8234)) ([d07599e](d07599e)) * silence zip output when creating source zips ([#8323](#8323)) ([e6fbebc](e6fbebc)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
This code path is the cause of a bunch of SWAR errors. Logs don't
provide enough information for us to debug this right now, so this PR
does two things:
-qflag tozipto quiet its output. (We pass this flageverywhere else we call out to
zip.) I have a weak suspicion theroot cause here could be a too-much-output error (but that seems
unlikely).
debug the issue if it comes up again in the future.