fix(api): keep plugin config loads side-effect free#2025
Conversation
|
Warning Review limit reached
More reviews will be available in 1 hour, 30 minutes, and 47 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2025 +/- ##
=======================================
Coverage 52.63% 52.64%
=======================================
Files 1035 1035
Lines 72033 72034 +1
Branches 8243 8252 +9
=======================================
+ Hits 37914 37921 +7
+ Misses 33993 33987 -6
Partials 126 126 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
1306102 to
13e35dd
Compare
- Keep stale Connect plugin cleanup scoped to the main API process so CLI plugin management commands can load config without mutating plugin registration state. - Preserve plugin entries during install-time config loads, preventing Connect from being removed before the .plg file exists on disk. - Add coverage for both CLI and main-process config loading behavior. - Return Buffer data from config file mocks to match atomically readFile typing. - Build @unraid/shared before API type-check so exported workspace package types are current in CI.
13e35dd to
7686854
Compare
🔄 PR Merged - Plugin Redirected to StagingThis PR has been merged and the preview plugin has been updated to redirect to the staging version. For users testing this PR:
Staging URL: Thank you for testing! 🚀 |
Summary
Makes API config loading side-effect free for CLI plugin management commands, so plugin install operations preserve the plugin list they are updating.
Root Cause
loadApiConfig()always ran the stale Connect cleanup when/boot/config/plugins/dynamix.unraid.net.plgwas not visible. CLI plugin commands also load API config, so an install command could removeunraid-api-plugin-connectwhile trying to add it.During Unraid plugin-manager installation, the Connect
.plgmay not be committed to/boot/config/pluginsyet. That allowed the API package to install and restart successfully whileapi.jsonstill contained"plugins": [], so the Connect Nest module never loaded.Change
environment.IS_MAIN_PROCESS.@unraid/sharedbefore API type-check so workspace package-exported types are current in CI.Validation
pnpm -C api run type-checkpnpm -C api exec vitest run src/unraid-api/config/api-config.test.tspnpm --filter @unraid/connect-plugin test.plgonroot@unraid.localand verified the expected runtime outcome:Added bundled plugin unraid-api-plugin-connectapi.jsoncontained"plugins": ["unraid-api-plugin-connect"]unraid-api plugins listreportedunraid-api-plugin-connect@file:packages/unraid-api-plugin-connect-4.25.3.tgz/var/log/graphql-api.logshowedConnectPluginModuleinitialized and Mothership connectedNote: an accidental full
pnpm --filter ./api test -- api/src/unraid-api/config/api-config.test.tsrun executed the broader API suite and surfaced an existing unrelated metrics spec failure inmetrics.resolver.spec.ts; the focused config test passes.