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

Community deletion #1720

Merged
merged 1 commit into from
Dec 22, 2024
Merged

Community deletion #1720

merged 1 commit into from
Dec 22, 2024

Conversation

NolanTrem
Copy link
Collaborator

@NolanTrem NolanTrem commented Dec 22, 2024

Important

Enhance error handling and add community deletion functionality in graphs.py, with minor refactoring in conversations.py and management_service.py.

  • Error Handling:
    • Use contextlib.suppress for json.JSONDecodeError in graphs.py for cleaner error handling.
    • Add from e to raise HTTPException for better exception chaining in graphs.py.
  • Functionality:
    • Add delete_all_communities method in PostgresCommunitiesHandler in graphs.py to delete all communities for a given parent_id.
    • Update reset method in PostgresGraphsHandler to use delete_all_communities.
  • Refactoring:
    • Remove unused import KGEnrichmentStatus in graphs.py.
    • Minor import reordering in conversations.py and management_service.py.

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

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! Reviewed everything up to b49dacc in 59 seconds

More details
  • Looked at 332 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. py/core/database/graphs.py:971
  • Draft comment:
    The new method delete_all_communities is a good addition for handling bulk deletions of communities associated with a parent_id. This improves code clarity and reusability.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR introduces a new method delete_all_communities in PostgresCommunitiesHandler to delete all communities for a given parent_id. This method is used in reset method of PostgresGraphsHandler.
2. py/core/database/graphs.py:131
  • Draft comment:
    Using contextlib.suppress(json.JSONDecodeError) is a cleaner approach than try-except for ignoring JSON decode errors. This change is applied consistently across the file.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR replaces try-except blocks with contextlib.suppress for JSONDecodeError, which is a cleaner approach for handling exceptions when the intent is to ignore them.
3. py/core/database/graphs.py:321
  • Draft comment:
    Using raise ... from e for exception chaining provides better context for debugging. This change is consistently applied across the file.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR modifies exception handling to use raise ... from e for better exception chaining, which is a good practice for debugging.
4. py/core/database/graphs.py:950
  • Draft comment:
    The delete method now accepts an optional community_id, allowing for targeted deletions. This enhances the method's flexibility.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR modifies the delete method in PostgresCommunitiesHandler to accept an optional community_id parameter, allowing for more flexible deletion operations.
5. py/core/database/graphs.py:1179
  • Draft comment:
    The reset method now uses delete_all_communities, aligning with the new method addition for bulk community deletions.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR modifies the reset method in PostgresGraphsHandler to use the new delete_all_communities method, which aligns with the new method addition.

Workflow ID: wflow_HmuUITKIxefaWAHx


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

@NolanTrem NolanTrem merged commit 53a0c3d into main Dec 22, 2024
14 checks passed
@NolanTrem NolanTrem deleted the Nolan/FixCommunityDeletion branch December 22, 2024 18:47
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.

1 participant