Skip to content

Conversation

@danoctua
Copy link
Collaborator

Fix: Update Delete Method to be Asynchronous and Improve Group Removal Logic

Description

This pull request updates the delete method in the chat action base class to be asynchronous, aligning it with the asynchronous nature of the application and improving overall performance. Additionally, it refactors the group removal logic to ensure that groups are only removed when appropriate, handling edge cases where conditions might prevent immediate deletion.

Checklist

Before submitting your pull request, please ensure the following:

  • I have read the contributing guidelines.
  • I ran all tests and they passed successfully.
  • I added/updated documentation (if applicable).
  • I reviewed my own code and followed the project's code style.
  • I included relevant details in the PR description or commit messages.

Changes

The following changes have been made:

  • Async Delete Refactor: Converted the delete method in backend/core/src/core/actions/chat/base.py to be async, enabling non-blocking database operations.
  • Group Removal Logic: Enhanced backend/core/src/core/actions/chat/rule/blockchain.py to correctly handle group deletions, checking for dependencies or remaining conditions before removal.
  • Test Coverage: Added backend/tests/unit/core/actions/chat/rule/test_blockchain_delete.py with extensive tests covering success paths, failure scenarios, and edge cases for rule deletions.
  • Factory Updates: Updated nft.py and rule/base.py factories to support new test requirements.
  • Dev Environment: Minor update to backend/docker-compose.dev.yml to support the changes.

How Has This Been Tested?

I tested these changes by running the newly created unit tests and existing related tests:

  • Ran pytest backend/tests/unit/core/actions/chat/rule/test_blockchain_delete.py to verify the new deletion logic.
  • Ran pytest backend/tests/unit/core/actions/chat/rule/test_blockchain.py to ensure no regressions in existing blockchain rule functionality.

Additional Notes

The shift to async delete might require updates in other parts of the system if they rely on the synchronous behavior of the delete action, though this PR attempts to cover the immediate dependencies.

@danoctua danoctua self-assigned this Jan 23, 2026
@danoctua danoctua added the bug Something isn't working label Jan 23, 2026
@danoctua danoctua merged commit 60589f3 into main Jan 23, 2026
2 checks passed
@danoctua danoctua deleted the fix/remove-condition-non-empty-group branch January 23, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant