-
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: Only fetch actions available to an entity during schema validation #1095
Open
tushar-composio
wants to merge
14
commits into
master
Choose a base branch
from
ENG-3203
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9fe5466
wip
tushar-composio 3fda8b6
fix: default entity id
tushar-composio e71c298
prevent example test running from modifying the test files
tushar-composio 5af820b
Merge branch 'master' into ENG-3203
tushar-composio 2a33873
fix: changed comparison field to clientUniqueUserId
Devanshusisodiya 20ca66c
Update python/tests/test_example.py
angrybayblade 3848355
Update python/composio/tools/toolset.py
angrybayblade 590f9e8
Merge branch 'master' into ENG-3203
Devanshusisodiya fefebc2
fix: check for entity id
Devanshusisodiya 301a07d
Merge branch 'master' into ENG-3203
Devanshusisodiya bc5ba62
Merge branch 'master' into ENG-3203
Devanshusisodiya e193bfd
test: fix tests
Devanshusisodiya 419aa66
test: fix tests
Devanshusisodiya 5722fd9
test: fix ci tests
Devanshusisodiya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1659,7 +1659,9 @@ def _validate_connection_ids( | |
return valid | ||
raise InvalidConnectedAccount(f"Invalid connected accounts found: {invalid}") | ||
|
||
def check_connected_account(self, action: ActionType) -> None: | ||
def check_connected_account( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new parameter |
||
self, action: ActionType, entity_id: t.Optional[str] = None | ||
) -> None: | ||
"""Check if connected account is required and if required it exists or not.""" | ||
action = Action(action) | ||
if action.no_auth or action.is_runtime: | ||
|
@@ -1677,6 +1679,7 @@ def check_connected_account(self, action: ActionType) -> None: | |
if action.app not in [ | ||
connection.appUniqueId.upper() # Normalize app names/ids coming from API | ||
for connection in self._connected_accounts | ||
if entity_id is None or connection.clientUniqueUserId == entity_id | ||
]: | ||
raise ConnectedAccountNotFoundError( | ||
f"No connected account found for app `{action.app}`; " | ||
|
@@ -1790,7 +1793,7 @@ def _execute_remote( | |
action=action | ||
) | ||
if auth is None: | ||
self.check_connected_account(action=action) | ||
self.check_connected_account(action=action, entity_id=entity_id) | ||
|
||
output = self.client.get_entity( # pylint: disable=protected-access | ||
id=entity_id | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Refactor: The change from an optional
entityId
to a default value ofDEFAULT_ENTITY_ID
enhances consistency across the codebase. This aligns with thecheck_connected_account
function, which now expects anentity_id
parameter. This change ensures logical consistency and reduces potential errors related to missingentityId
values.