[MISC] Fixed notification plugin loading related issue#1657
Conversation
Summary by CodeRabbit
WalkthroughRefactors notification plugin integration across multiple backend views, replacing static Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 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 |
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|
|
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/adapter_processor_v2/views.py (1)
348-381: Critical: ResourceType used without notification_plugin check.The code uses
ResourceType(lines 357-365) without verifying thatnotification_pluginis available. SinceResourceTypeis only imported whennotification_pluginexists (line 49-50), this will raise aNameErrorwhen the plugin is unavailable, breaking the entirepartial_updateoperation.Apply this diff to guard the notification logic:
# Send email notifications to newly shared users - if response.status_code == 200 and AdapterKeys.SHARED_USERS in request.data: + if ( + response.status_code == 200 + and AdapterKeys.SHARED_USERS in request.data + and notification_plugin + ): try: adapter.refresh_from_db()
🧹 Nitpick comments (2)
backend/connector_v2/views.py (1)
210-214: Consider removing redundantbool()wrapper for consistency.The explicit
bool()call is unnecessary in Python's truthiness context. For consistency with other files in this PR (e.g.,backend/pipeline_v2/views.py:134), consider simplifying toand notification_plugin.Apply this diff:
if ( response.status_code == 200 and "shared_users" in request.data - and bool(notification_plugin) + and notification_plugin ):backend/workflow_manager/workflow_v2/views.py (1)
151-156: Consider removing redundantbool()wrapper for consistency.The explicit
bool()call is unnecessary and inconsistent with the simple truthiness check used earlier in this same file (line 62:if notification_plugin:).Apply this diff:
if ( response.status_code == 200 and "shared_users" in request.data - and bool(notification_plugin) + and notification_plugin ):
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (5)
backend/adapter_processor_v2/views.py(3 hunks)backend/api_v2/api_deployment_views.py(0 hunks)backend/connector_v2/views.py(4 hunks)backend/pipeline_v2/views.py(2 hunks)backend/workflow_manager/workflow_v2/views.py(2 hunks)
💤 Files with no reviewable changes (1)
- backend/api_v2/api_deployment_views.py
⏰ 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: build
🔇 Additional comments (5)
backend/pipeline_v2/views.py (2)
36-38: LGTM! Clean plugin detection pattern.The module-level plugin detection with conditional import is implemented correctly. The truthiness check is appropriate for testing plugin availability.
131-135: LGTM! Proper runtime plugin check.The condition correctly verifies plugin availability before sending notifications. The simple truthiness check (
and notification_plugin) is idiomatic and sufficient.backend/connector_v2/views.py (1)
28-31: LGTM! Clean plugin detection with conditional imports.The module-level plugin detection and conditional import pattern is correct.
backend/adapter_processor_v2/views.py (1)
48-50: LGTM! Proper module-level plugin detection.The plugin detection and conditional import pattern is correct.
backend/workflow_manager/workflow_v2/views.py (1)
61-63: LGTM! Clean plugin detection pattern.The module-level plugin detection with conditional import is correct.



What
Why
https://unstract.slack.com/archives/C06RL7J6JDS/p1762966396146919
How
bool()instead of testing it withNoneCan this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Related Issues or PRs
Notes on Testing
Screenshots
Checklist
I have read and understood the Contribution Guidelines.