-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: Only fetch actions available to an entity during schema validation #1095
base: master
Are you sure you want to change the base?
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 9fe5466 in 15 seconds
More details
- Looked at
39
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:435
- Draft comment:
Consider refreshing_connected_accounts
to ensure it reflects the latest state, especially after filtering byentity_id
. This prevents potential issues with stale data. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_El7CN0bfStJNmb7r
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@@ -416,7 +416,7 @@ def add_auth( | |||
parameters=parameters, | |||
) | |||
|
|||
def check_connected_account(self, action: ActionType) -> None: | |||
def check_connected_account(self, action: ActionType, entity_id: str) -> 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 docstring should be updated to include the new entity_id
parameter and its purpose. Consider adding:
"""
Args:
action (ActionType): The action to check authorization for
entity_id (str): The ID of the entity to check connected accounts for
"""
@@ -435,6 +435,7 @@ def check_connected_account(self, action: ActionType) -> None: | |||
# Normalize app names/ids coming from API | |||
connection.appUniqueId.upper() | |||
for connection in self._connected_accounts | |||
if connection.entityId == entity_id | |||
]: | |||
raise ComposioSDKError( | |||
f"No connected account found for app `{action.app}`; " |
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 enhancing the error message to include the entity ID for better debugging:
f"No connected account found for app `{action.app}` on entity `{entity_id}`; Run `composio add {action.app.lower()}` to fix this"
Code Review SummaryThe changes look good overall and improve security by adding entity-specific validation for connected accounts. Here's a brief assessment: Strengths:✅ Proper entity-specific validation of connected accounts Suggestions for Improvement:
Code Quality: 8/10The core changes are solid and improve security, with minor documentation improvements needed. The PR is ready to merge after addressing the documentation suggestions. |
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 3fda8b6 in 41 seconds
More details
- Looked at
38
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. python/composio/client/collections.py:94
- Draft comment:
Setting a default value forentityId
inConnectedAccountModel
might lead to unexpected behavior if not intended for all instances. Consider handling defaults explicitly where needed. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment suggests being cautious about setting default values. However, looking at the code:
- This is a Pydantic model for connected accounts
- DEFAULT_ENTITY_ID appears to be a constant imported specifically for this purpose
- The change makes the field required with a default rather than optional
- This seems like an intentional design choice to ensure entityId is always set
- There's no evidence this would cause issues
I could be missing context about how this model is used in practice. The default value could potentially mask bugs where entityId should be explicitly set.
The change from optional to required with default appears intentional and follows good practices of being explicit. The imported constant suggests this is the intended behavior.
The comment should be deleted as it questions an intentional design choice without strong evidence of any actual issues.
2. python/composio/tools/toolset.py:902
- Draft comment:
The addition ofentity_id
parameter incheck_connected_account
ensures entity-specific validation, aligning with the PR description. No issues here. - Reason this comment was not posted:
Confidence changes required:0%
The change in line 902 oftoolset.py
passesself.entity_id
tocheck_connected_account
. This is consistent with the PR description and ensures entity-specific validation. No issues here.
Workflow ID: wflow_xQvcvs5N0cFcfR7T
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
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.
❌ Changes requested. Incremental review on e71c298 in 39 seconds
More details
- Looked at
37
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
0
drafted comments based on config settings.
Workflow ID: wflow_186vXRU5cQwnmntH
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@@ -224,10 +226,11 @@ def test_example( | |||
# Wait for 2 minutes for example to run | |||
proc.wait(timeout=180) | |||
|
|||
filepath.write_text(original_source, encoding="utf-8") |
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 using a finally
block to ensure filepath.write_text(original_source, encoding="utf-8")
is executed even if an exception occurs during the test execution.
Important
Add
entity_id
tocheck_connected_account
for entity-specific validation intoolset.py
and set default inConnectedAccountModel
.entity_id
parameter tocheck_connected_account
intoolset.py
for entity-specific action validation._execute_remote
andget_action_schemas
intoolset.py
to useentity_id
.entityId
toDEFAULT_ENTITY_ID
inConnectedAccountModel
incollections.py
.test_example.py
to restore original file content after test execution.This description was created by for e71c298. It will automatically update as commits are pushed.