Make plugin loader more robust#1203
Conversation
Against stray folders, leftover artefacts and missing configs
WalkthroughThe plugin configuration loader in server/plugin_utils.py now wraps per-plugin config.json parsing in try/except. On FileNotFoundError, JSONDecodeError, or other Exceptions, it logs the error and skips that plugin. The selection logic for which plugins to consider and the final sorting/return behavior remain the same. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant S as Server
participant PU as PluginUtils.get_plugins_configs
participant FS as FileSystem
participant J as JSON Parser
participant L as Logger
S->>PU: get_plugins_configs()
loop For each candidate plugin
PU->>FS: Read plugin/config.json
alt File present
FS-->>PU: File contents
PU->>J: Parse JSON
alt JSON valid
J-->>PU: Config object
PU-->>PU: Append to pluginsList
else JSONDecodeError
J-->>PU: Error
PU->>L: Log JSON decode error
PU-->>PU: Skip plugin
end
else FileNotFoundError
FS-->>PU: Error
PU->>L: Log missing config
PU-->>PU: Skip plugin
end
opt Unexpected exception
PU->>L: Log unexpected error
PU-->>PU: Skip plugin
end
end
PU-->>S: Sorted pluginsList
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
server/plugin_utils.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{server/**/*.py,front/plugins/*/*.py}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
{server/**/*.py,front/plugins/*/*.py}: Never hardcode ports or secrets; define settings once (core ccd() or plugin manifest) and read via get_setting_value() everywhere
Use logger.mylog(level, [message]) with levels none/minimal/verbose/debug/trace; keep verbose output concise unless debugging
Reuse helpers in helper.py (timeNowTZ, normalize_mac, sanitizers) and prefer server/db/db_helper.py over raw SQL in new paths
Files:
server/plugin_utils.py
🧬 Code graph analysis (1)
server/plugin_utils.py (2)
server/helper.py (1)
get_file_content(255-261)server/logger.py (1)
mylog(86-89)
🪛 Ruff (0.13.1)
server/plugin_utils.py
219-219: Local variable e is assigned to but never used
Remove assignment to unused variable e
(F841)
222-222: Do not catch blind exception: Exception
(BLE001)
223-223: Use explicit conversion flag
Replace with conversion flag
(RUF010)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: docker_dev
Against stray folders, leftover artefacts and missing configs
Ref issue: #1187
Summary by CodeRabbit