fix: silence zip output when creating source zips#8323
Conversation
📝 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)
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.