UN-2888 [FIX] Add hook for setting default triad for invited users#1877
UN-2888 [FIX] Add hook for setting default triad for invited users#1877pk-zipstack wants to merge 3 commits intomainfrom
Conversation
Add setup_default_adapters_for_user() hook to AuthenticationService and call it from set_user_organization() when an invited user joins an existing organization. This allows the cloud plugin to set up default triad adapters (LLM, embedding, vector DB, x2text) for invited users, fixing silent failures in API deployment creation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughCalls to set up default adapters for an existing organization were added: the controller now invokes Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
|
| Filename | Overview |
|---|---|
| backend/account_v2/authentication_controller.py | Adds setup_default_adapters_for_user call in the else branch of set_user_organization for non-new organisations; follows the same try/except + info-log pattern as frictionless_onboarding. |
| backend/account_v2/authentication_service.py | Adds the setup_default_adapters_for_user stub that raises MethodNotImplemented, identical in shape to the existing frictionless_onboarding stub. |
Sequence Diagram
sequenceDiagram
participant Client
participant AuthController as AuthenticationController
participant AuthService as AuthenticationService (base/cloud)
participant OrgService as OrganizationService
Client->>AuthController: set_user_organization(request, org_id)
AuthController->>OrgService: get_organization_by_org_id(org_id)
alt Organization is NEW (first creator)
OrgService-->>AuthController: None
AuthController->>OrgService: create_organization(...)
AuthController->>AuthService: frictionless_onboarding(org, user)
Note over AuthService: Base raises MethodNotImplemented<br/>Cloud creates default adapters for creator
AuthService-->>AuthController: (MethodNotImplemented caught & logged in OSS)
AuthController->>AuthController: create_initial_platform_key(user, org)
else Organization EXISTS (invited user / returning user)
OrgService-->>AuthController: organization
AuthController->>AuthController: create_tenant_user(org, user)
AuthController->>AuthService: setup_default_adapters_for_user(org, user)
Note over AuthService: Base raises MethodNotImplemented<br/>Cloud creates UserDefaultAdapter if missing
AuthService-->>AuthController: (MethodNotImplemented caught & logged in OSS)
end
AuthController-->>Client: HTTP 200 (is_new_org, user, organization)
Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/set-default..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
backend/account_v2/authentication_controller.py (1)
216-222: Consider adding a log message for consistency withfrictionless_onboarding.The
frictionless_onboardingexception handler at line 208 logs"frictionless_onboarding not implemented", but this handler silently passes. Adding a similar log message would improve debugging consistency for OSS deployments.♻️ Suggested change
else: try: self.auth_service.setup_default_adapters_for_user( organization=organization, user=user ) except MethodNotImplemented: - pass + logger.info("setup_default_adapters_for_user not implemented")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@backend/account_v2/authentication_controller.py` around lines 216 - 222, The except block swallowing MethodNotImplemented for self.auth_service.setup_default_adapters_for_user should log a message like the frictionless_onboarding handler does; update the except MethodNotImplemented block in authentication_controller (around setup_default_adapters_for_user) to call the same logger used for frictionless_onboarding and emit a clear message such as "setup_default_adapters_for_user not implemented" and include minimal context (organization id/name and user id/email) to aid debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@backend/account_v2/authentication_controller.py`:
- Around line 216-222: The except block swallowing MethodNotImplemented for
self.auth_service.setup_default_adapters_for_user should log a message like the
frictionless_onboarding handler does; update the except MethodNotImplemented
block in authentication_controller (around setup_default_adapters_for_user) to
call the same logger used for frictionless_onboarding and emit a clear message
such as "setup_default_adapters_for_user not implemented" and include minimal
context (organization id/name and user id/email) to aid debugging.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 708b08ff-27b6-4bb5-b5a2-12840cd88c63
📒 Files selected for processing (2)
backend/account_v2/authentication_controller.pybackend/account_v2/authentication_service.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Praveen Kumar <praveen@zipstack.com>
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|
|



What
setup_default_adapters_for_user()hook method toAuthenticationService(raisesMethodNotImplemented)set_user_organization()inAuthenticationControllerfor non-new organizations (invited user flow)Why
UserDefaultAdapterrecord is missingHow
setup_default_adapters_for_user()to the baseAuthenticationServicefollowing the same plugin pattern asfrictionless_onboarding()(raisesMethodNotImplementedin base, implemented in cloud)set_user_organization(), aftercreate_tenant_user(), the hook is called in theelsebranch (non-new org) with a try/except forMethodNotImplementedUserDefaultAdapterfor the invited userCan this PR break any existing features? If yes, please list possible items. If no, please explain why.
MethodNotImplementedin the base implementation, which is caught and silently ignored. This is the same pattern used byfrictionless_onboarding(). OSS deployments are unaffected.Database Migrations
Env Config
Related Issues or PRs
fix/set-default-triad-for-invited-userDependencies Versions
Notes on Testing
pluggable_apps/platform_admin/tests/test_set_default_adapters.pycovering:Checklist
🤖 Generated with Claude Code