Repository navigation
feat(conversations): optionally clean up UMO metadata when deleting conversations #10816
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -910,6 +910,25 @@ async def get_umo_aliases(self, umos: list[str] | None = None) -> list[UmoAlias] | |
| """Get alias metadata, optionally restricted to the given UMO list.""" | ||
| ... | ||
|
|
||
| @abc.abstractmethod | ||
| async def delete_umo_metadata_if_unreferenced(self, umo: str) -> dict: | ||
| """Delete alias and sender metadata for a UMO without conversations. | ||
|
|
||
| The reference check and the deletions run as conditional statements in | ||
| a single transaction, so metadata is not deleted while a committed | ||
| conversation still references the UMO. | ||
|
|
||
| Args: | ||
| umo: Unified message origin whose orphaned metadata should be deleted. | ||
|
|
||
| Returns: | ||
| Mapping with ``alias_deleted`` (whether an alias row was removed), | ||
| ``senders_deleted`` (number of sender rows removed) and | ||
| ``retained`` (True when a conversation still references the UMO and | ||
| nothing was deleted). | ||
| """ | ||
| ... | ||
|
|
||
|
Comment on lines
+913
to
+931
Contributor
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. 🔴 Critical · Missing alias deletion API The issue asks for an official Prompt for AI agentsIn `astrbot/core/db/__init__.py` at lines 897-915:
**Missing alias deletion API**
The issue asks for an official `delete_umo_alias(umo) -> bool` method, or the stated cascade alternative. The change adds only `delete_umo_metadata_if_unreferenced`, which refuses to delete metadata while conversations exist and is only used by the dashboard cleanup flow, leaving the requested reusable API unavailable.From #10704: Expose an official per-UMO alias deletion method (`delete_umo_alias(umo) -> bool`), or the accepted conversation-delete cascade alternative. |
||
| # ==== | ||
| # UMO Sender Management | ||
| # ==== | ||
|
|
||
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.
🟡 Medium · Standalone alias deletion
The issue asks for an official per-UMO alias deletion method, or an equivalent cascade option. The new method only cleans metadata through conversation deletion and retains aliases while any conversation references the UMO, so callers cannot independently delete an alias.
Prompt for AI agents
From #10704: