Skip to content

feat: mark document as deleted instead of removing from database#991

Merged
iziang merged 1 commit into
mainfrom
bugfix/document
Jun 25, 2025
Merged

feat: mark document as deleted instead of removing from database#991
iziang merged 1 commit into
mainfrom
bugfix/document

Conversation

@iziang
Copy link
Copy Markdown
Contributor

@iziang iziang commented Jun 25, 2025

No description provided.

@apecloud-bot apecloud-bot added the size/XS Denotes a PR that changes 0-9 lines. label Jun 25, 2025
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Bug: Quota Violation from Soft-Deleted Documents

Document deletion now marks documents as DELETED instead of physically removing them from the database. However, existing query methods (e.g., list_documents, get_document) and document count for quota checks do not filter out DELETED documents. This results in soft-deleted documents still being returned to users and counted towards quotas, breaking expected behavior.

aperag/service/document_service.py#L282-L288

# Mark document as deleted
document.status = db_models.DocumentStatus.DELETED
document.gmt_deleted = utc_now()
session.add(document)
await session.flush()
logger.info(f"Successfully marked document {document.id} as deleted.")

Fix in Cursor


BugBot free trial expires on July 22, 2025
You have used $0.00 of your $1.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

@iziang iziang merged commit 869abd9 into main Jun 25, 2025
7 of 9 checks passed
@iziang iziang deleted the bugfix/document branch June 25, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Denotes a PR that changes 0-9 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants