Skip to content
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

feat: v1 to v2 shift #1369

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

feat: v1 to v2 shift #1369

wants to merge 5 commits into from

Conversation

Devanshusisodiya
Copy link
Contributor

@Devanshusisodiya Devanshusisodiya commented Feb 27, 2025

This is just a draft PR to check why tests are failing on the original v1->v2 shift PR.


Important

Add two blank lines in collections.py after remove() function.

  • Misc:
    • Add two blank lines in collections.py after remove() function.

This description was created by Ellipsis for 6c79e0f. It will automatically update as commits are pushed.

Copy link

vercel bot commented Feb 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 4:43am

@Devanshusisodiya Devanshusisodiya marked this pull request as ready for review February 27, 2025 04:23
Comment on lines 1531 to 1533
def remove(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
return response.status_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remove() method now returns HTTP status code but doesn't validate if the request was successful (2xx range). Should check status code is in success range before returning.

📝 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.

Suggested change
def remove(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
return response.status_code
def remove(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
if 200 <= response.status_code < 300:
return response.status_code
raise Exception(f"Request failed with status code: {response.status_code}")

@@ -1528,8 +1528,9 @@ def create(
)
return IntegrationModel(**response.json())

def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
def remove(self, id: str) -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding docstring to document the return value and possible exceptions:

def remove(self, id: str) -> int:
    """Remove an integration by its ID.
    
    Args:
        id (str): The ID of the integration to remove
        
    Returns:
        int: HTTP status code of the delete operation
        
    Raises:
        HTTPError: If the delete operation fails
    """

def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
def remove(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling using the existing _raise_if_required method to maintain consistency with the rest of the codebase:

response = self.client.http.delete(url=str(self.endpoint / id))
self._raise_if_required(response, status_code=204)  # 204 is typical for successful DELETE
return response.status_code

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to 448d585 in 1 minute and 24 seconds

More details
  • Looked at 16 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. python/composio/client/collections.py:1532
  • Draft comment:
    Returning response.status_code directly; consider validating the response or handling errors before returning.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    Looking at the code, I see that this is part of a Collection class that handles API requests. The base Collection class likely already handles error responses through self._raise_if_required() which is used in other methods. The change from returning None to returning status_code is reasonable and doesn't necessarily need additional validation since HTTP status codes are well-defined. The comment seems overly cautious without strong evidence of an actual issue.
    I could be wrong about error handling in the base class. Without seeing the implementation of self.client.http.delete(), I can't be 100% sure how errors are handled.
    Looking at the rest of the file, all other API calls use self._raise_if_required() which suggests there is already error handling infrastructure in place. The comment seems unnecessary given the existing patterns.
    Delete this comment. The code follows established patterns in the codebase and returning status codes directly is a common practice. The comment suggests extra validation without clear evidence it's needed.
2. python/composio/client/collections.py:1531
  • Draft comment:
    Changing the return type from None to int may break existing code. Consider reviewing if clients expect None and if additional error handling (e.g. via self._raise_if_required) is needed.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    This is a valid concern - changing return types is a breaking change that could affect clients. However, in Python, many callers may ignore the return value entirely. The change seems intentional to provide more information to callers who want it. The original None return wasn't providing any value. The comment doesn't suggest a clear action - it just raises a vague concern about potential issues.
    I could be underestimating the impact of this change. There could be test code or other clients that explicitly assert the return value is None.
    While possible, explicit assertions on None return values are rare in Python. The benefit of providing status code information outweighs the small risk of breaking edge case usage.
    Delete this comment. While it raises a valid concern, it's speculative and doesn't suggest a clear action. The change appears intentional and beneficial.
3. python/composio/client/collections.py:297
  • Draft comment:
    Typo in the docstring of the AppAuthScheme class: "App authenticatio scheme." should be "App authentication scheme."
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. python/composio/client/collections.py:640
  • Draft comment:
    Typo in the docstring of the 'callback' method in TriggerSubscription: "Register a trigger callaback." should be "Register a trigger callback."
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. python/composio/client/collections.py:501
  • Draft comment:
    Typo in the docstring of _ChunkedTriggerEventData: "Cunked trigger event data model." should be "Chunked trigger event data model."
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. python/composio/client/collections.py:1065
  • Draft comment:
    Typo in SearchResultTask: the field description has a typo in its description string. "Descrption of the subtask." should be "Description of the subtask."
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_kI8nt2xtALQ8pQSf


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.

@@ -1528,8 +1528,9 @@ def create(
)
return IntegrationModel(**response.json())

def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
def remove(self, id: str) -> int:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing return type of remove() from None to int may break callers expecting no return. Update docs if intentional.

@shreysingla11
Copy link
Collaborator

Code Review Summary

Changes Overview

  • Modified remove method to return HTTP status code instead of None
  • Added response handling for delete operation
  • Updated return type annotation

Positive Aspects

✅ Good improvement to return status code for better error handling
✅ Change is minimal and focused
✅ Type hints are properly updated

Suggestions for Improvement

  1. Add proper method documentation (see inline comment)
  2. Implement error handling using _raise_if_required (see inline comment)
  3. Consider validating the id parameter before making the HTTP request

Code Quality Rating: 7/10

The change is good but could be more robust with proper documentation and error handling. The core functionality improvement is valuable for better error handling in client code.

The PR can be merged after addressing the documentation and error handling suggestions.

Comment on lines 1531 to 1532
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
response = self.client.http.delete(url=str(self.endpoint / id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response from the DELETE request is captured but never used or checked for errors. Should validate the response status code to ensure deletion succeeded.

📝 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.

Suggested change
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
response = self.client.http.delete(url=str(self.endpoint / id))
def remove(self, id: str) -> None:
response = self.client.http.delete(url=str(self.endpoint / id))
if response.status_code not in (200, 204):
raise Exception(f"Failed to delete resource. Status code: {response.status_code}")

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 7611298 in 1 minute and 58 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. python/composio/client/collections.py:1532
  • Draft comment:
    Unused 'response' in remove(); if error checking is desired, consider using _raise_if_required(response) or remove the variable.
  • Reason this comment was not posted:
    Marked as duplicate.
2. python/composio/client/collections.py:297
  • Draft comment:
    Typo: In the docstring for AppAuthScheme, 'App authenticatio scheme.' should be 'App authentication scheme.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. python/composio/client/collections.py:500
  • Draft comment:
    Typo: The docstring for _ChunkedTriggerEventData reads 'Cunked trigger event data model.' and should instead be 'Chunked trigger event data model.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. python/composio/client/collections.py:640
  • Draft comment:
    Typo: In the docstring for the callback method of TriggerSubscription, 'Register a trigger callaback.' should be 'Register a trigger callback.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. python/composio/client/collections.py:1066
  • Draft comment:
    Typo: The description for SearchResultTask has 'Descrption of the subtask.' which should be corrected to 'Description of the subtask.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_aFZR59YWb3cz4Aup


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.

@@ -1529,7 +1529,7 @@ def create(
return IntegrationModel(**response.json())

def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
response = self.client.http.delete(url=str(self.endpoint / id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 'response' is now assigned but not used. If the response is important, consider validating its status or content; otherwise, remove the assignment.

Suggested change
response = self.client.http.delete(url=str(self.endpoint / id))
self.client.http.delete(url=str(self.endpoint / id))

Comment on lines 1531 to 1536
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))

def delete(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
return response.status_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate functionality with remove() and delete() methods doing the same thing. remove() should be removed or marked as deprecated since delete() provides more functionality by returning status code.

📝 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.

Suggested change
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
def delete(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
return response.status_code
@deprecated("Use delete() instead as it provides status code information")
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
def delete(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
return response.status_code

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 14452bd in 1 minute and 57 seconds

More details
  • Looked at 16 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. python/composio/client/collections.py:1532
  • Draft comment:
    Duplicate deletion methods: Both 'remove' and 'delete' perform the same HTTP call. Consider consolidating to a single clear method.
  • Reason this comment was not posted:
    Marked as duplicate.
2. python/composio/client/collections.py:468
  • Draft comment:
    Typographical error: 'indetify' should be corrected to 'identify' in the description of the FileType 'name' field.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. python/composio/client/collections.py:297
  • Draft comment:
    Typographical error in the docstring: 'App authenticatio scheme.' should be 'App authentication scheme.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. python/composio/client/collections.py:640
  • Draft comment:
    Typographical error: The docstring 'Register a trigger callaback.' should be corrected to 'Register a trigger callback.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. python/composio/client/collections.py:500
  • Draft comment:
    Typographical error: In the docstring of _ChunkedTriggerEventData, 'Cunked' should be corrected to 'Chunked'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. python/composio/client/collections.py:1066
  • Draft comment:
    Typographical error: In the SearchResultTask model, the field description's text 'Descrption of the subtask.' should be corrected to 'Description of the subtask.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_YlUuC7Y3xxn2qhIH


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.

@@ -1531,6 +1531,10 @@ def create(
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))

def delete(self, id: str) -> int:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new delete() method duplicates the HTTP delete call already used in remove(). Consider refactoring the common deletion logic into a helper (or have remove() delegate to delete()) to avoid duplication and potential inconsistencies. Also, clarify the intended difference between remove() (no return) and delete() (returning status code).

Comment on lines 1531 to 1532
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the delete() method without providing an alternative could break backward compatibility for code that depends on getting the status code. The remove() method should return the status code or document the breaking change.

📝 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.

Suggested change
def remove(self, id: str) -> None:
self.client.http.delete(url=str(self.endpoint / id))
def remove(self, id: str) -> int:
response = self.client.http.delete(url=str(self.endpoint / id))
return response.status_code

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a 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 6c79e0f in 45 seconds

More details
  • Looked at 15 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. python/composio/client/collections.py:1531
  • Draft comment:
    Removed the delete method which previously returned the HTTP status code. Confirm that downstream tests and consumers now only use the remove method (which returns None) or update them accordingly for backward compatibility.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the PR author to confirm that downstream tests and consumers are updated, which violates the rule against asking for confirmation or ensuring behavior is intended. It also suggests updating for backward compatibility, which is not a direct code suggestion or specific request for a test.
2. python/composio/client/collections.py:1531
  • Draft comment:
    Removing the 'delete' method (which returned the status code) may be a breaking change if clients/tests expect its return value. Ensure that dependent code is updated or that a deprecation alias is provided.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment suggests ensuring that dependent code is updated or a deprecation alias is provided, which falls under asking the PR author to ensure behavior is intended or tested. This violates the rules.
3. python/composio/client/collections.py:468
  • Draft comment:
    Typo: In the FileType field description, 'indetify' should be corrected to 'identify'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. python/composio/client/collections.py:1066
  • Draft comment:
    Typo: In the SearchResultTask model, change 'Descrption of the subtask.' to 'Description of the subtask.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. python/composio/client/collections.py:297
  • Draft comment:
    Typo: In the AppAuthScheme class docstring, change 'App authenticatio scheme.' to 'App authentication scheme.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. python/composio/client/collections.py:640
  • Draft comment:
    Typo: In the TriggerSubscription.callback method docstring, change 'Register a trigger callaback.' to 'Register a trigger callback.'
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_dY2z0UYGMMqmBs5Q


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants