-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: filter connections by entity [ENG-2523] #1200
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to 6579900 in 14 seconds
More details
- Looked at
13
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. python/composio/tools/toolset.py:1363
- Draft comment:
Ensure that theentity_id
is correctly set and used throughout the class to avoid unexpected behavior when filtering connected accounts. This change assumes thatself.entity_id
is always correctly initialized and available. - Reason this comment was not posted:
Confidence changes required:50%
The change in the PR modifies theget_connected_accounts
method to filter connections byentity_id
. This is a logical change to ensure that only connections related to the specific entity are retrieved. However, the change should be verified for potential issues.
Workflow ID: wflow_mc8ATjPfKYBrs8vm
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
python/composio/tools/toolset.py
Outdated
def get_connected_accounts(self) -> t.List[ConnectedAccountModel]: | ||
return self.client.connected_accounts.get() | ||
return self.client.connected_accounts.get(entity_ids=[self.entity_id] if self.entity_id else None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing None for entity_ids parameter may behave differently than omitting it entirely. Consider skipping the parameter when entity_id is None rather than passing None explicitly. Additionally, the change introduces a potential issue where 'entity_ids' could be set to None, which might not be handled by the 'get' method, leading to unexpected behavior.
📝 Committable Code Suggestion
‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.
def get_connected_accounts(self) -> t.List[ConnectedAccountModel]: | |
return self.client.connected_accounts.get() | |
return self.client.connected_accounts.get(entity_ids=[self.entity_id] if self.entity_id else None) | |
def get_connected_accounts(self) -> t.List[ConnectedAccountModel]: | |
return self.client.connected_accounts.get(entity_ids=[self.entity_id] if self.entity_id else []) |
@@ -1360,7 +1360,7 @@ def get_connected_account(self, id: str) -> ConnectedAccountModel: | |||
return self.client.connected_accounts.get(connection_id=id) | |||
|
|||
def get_connected_accounts(self) -> t.List[ConnectedAccountModel]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding docstring to clarify the behavior of entity filtering:
def get_connected_accounts(self) -> t.List[ConnectedAccountModel]:
"""
Retrieve connected accounts filtered by the current entity ID.
Returns:
List[ConnectedAccountModel]: List of connected accounts for the current entity.
If no entity_id is set, returns all accounts.
"""
Code Review SummaryThe changes look good and fix an important issue with entity-based filtering of connected accounts. Here's my assessment: Strengths:✅ Properly implements entity-based filtering Suggestions:
Overall code quality: 8/10 - Clean fix that improves data isolation between entities. |
return self.client.connected_accounts.get( | ||
entity_ids=[self.entity_id] if self.entity_id else None | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The refactored code introduces a potential issue with readability due to inconsistent indentation, which may lead to confusion during maintenance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 8583f3a in 11 seconds
More details
- Looked at
15
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. python/composio/tools/toolset.py:1363
- Draft comment:
Reformatting for readability is good, but ensure that the logic remains unchanged. This change is non-functional and only affects code style. - Reason this comment was not posted:
Confidence changes required:0%
The change in the PR is a simple reformatting of the code for better readability. It doesn't introduce any functional changes or bugs.
Workflow ID: wflow_UThCqvsQxEBVDSQY
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Modify
get_connected_accounts()
intoolset.py
to filter connected accounts byentity_id
if set.get_connected_accounts()
intoolset.py
to filter connected accounts byentity_id
ifentity_id
is set.This description was created by for 8583f3a. It will automatically update as commits are pushed.