fix: retry plugin install/build on transient npm failures - #16
Conversation
A scheduled deploy run failed because npm silently resolved only the production dependency subtree for two plugins (missing tsup), while 14 prior runs of the same workflow succeeded — a one-off npm registry flake, not a code bug. Wipe node_modules and retry install+build up to 3 times so a transient hiccup no longer fails the whole deploy.
📝 WalkthroughWalkthroughPlugin builds now use up to three installation/build attempts, remove partial ChangesPlugin build retry handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@quartz/plugins/loader/gitLoader.ts`:
- Around line 422-427: Update the failure reporting in the catch block around
the plugin installation workflow to use phase-neutral wording instead of
identifying every error as a post-install build failure. Adjust both the
console.error message and the thrown Error in the relevant loader flow, while
preserving the attempt count, plugin name, and original error message.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b2920229-7e23-41e5-8b1f-ff869b146b78
📒 Files selected for processing (1)
quartz/plugins/loader/gitLoader.ts
| const message = lastError instanceof Error ? lastError.message : String(lastError) | ||
| console.error( | ||
| styleText("red", `✗`), | ||
| `${name}: post-install build failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`, | ||
| ) | ||
| throw new Error(`Failed to build plugin ${name}: ${message}`) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use a phase-neutral failure message.
This catch also handles install, prune, and peer-link failures, so reporting every failure as a build failure misdirects troubleshooting.
Proposed fix
- `${name}: post-install build failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`,
+ `${name}: plugin setup failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`,
...
- throw new Error(`Failed to build plugin ${name}: ${message}`)
+ throw new Error(`Failed to set up plugin ${name}: ${message}`)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const message = lastError instanceof Error ? lastError.message : String(lastError) | |
| console.error( | |
| styleText("red", `✗`), | |
| `${name}: post-install build failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`, | |
| ) | |
| throw new Error(`Failed to build plugin ${name}: ${message}`) | |
| const message = lastError instanceof Error ? lastError.message : String(lastError) | |
| console.error( | |
| styleText("red", `✗`), | |
| `${name}: plugin setup failed after ${INSTALL_BUILD_ATTEMPTS} attempts: ${message}`, | |
| ) | |
| throw new Error(`Failed to set up plugin ${name}: ${message}`) |
🤖 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 `@quartz/plugins/loader/gitLoader.ts` around lines 422 - 427, Update the
failure reporting in the catch block around the plugin installation workflow to
use phase-neutral wording instead of identifying every error as a post-install
build failure. Adjust both the console.error message and the thrown Error in the
relevant loader flow, while preserving the attempt count, plugin name, and
original error message.
A scheduled deploy run failed because npm silently resolved only the production dependency subtree for two plugins (missing tsup), while 14 prior runs of the same workflow succeeded — a one-off npm registry flake, not a code bug. Wipe node_modules and retry install+build up to 3 times so a transient hiccup no longer fails the whole deploy.
Summary by CodeRabbit