[BUGFIX] : Persistent Storage Leak of Knowledge Graphs (GraphRAG)#546
Open
hrshjswniii wants to merge 8 commits into
Open
[BUGFIX] : Persistent Storage Leak of Knowledge Graphs (GraphRAG)#546hrshjswniii wants to merge 8 commits into
hrshjswniii wants to merge 8 commits into
Conversation
…resolve schemas conflict
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issue
Closes #539
📝 What does this PR do?
This PR implements multi-document chat capabilities, introduces a Recycle Bin trash/restore flow, and resolves a critical persistent storage leak in GraphRAG background cleanup:
1. GraphRAG Persistent Storage Leak Fix (Bug Fix)
delete_graphtry-except block call insidedocument_cleanup_job()to automatically clean up persisting knowledge graph JSON files of expired/inactive documents (which previously caused disk leaks on the server).test_cleanup_old_deleted_documents_purges_graphandtest_document_cleanup_job_purges_graphin [test_documents.py]to assert correct file removal, database purging, vector cleanup, and graph cleanup.2. Multi-Document Selection Chat (New Feature)
retrieve(),PDFSearchTool,_candidate_graphs,get_entity_context, and agent execution helper signatures to acceptdocument_ids: List[str]and verify user access for each. Updated tracing decorator signatures to support keyword arguments dynamically.document_ids, validate readiness, save multi-doc messages underdocument_id = None, and cache query results under a sorted comma-joined key.document_ids.3. Recycle Bin / Trash Modal (New Feature)
TrashModal.tsxand custom routing to list, restore, or immediately purge soft-deleted files.🗂️ Type of Change
🧪 How was this tested?
test_cleanup_old_deleted_documents_purges_graphandtest_document_cleanup_job_purges_graphintest_documents.py.test_retrieve_with_document_ids_list_and_rbac_checksintest_retriever.py.test_chat_ask_success_with_document_idsintest_chat.py.backend\.venv\Scripts\python -m pytest backend/testsnpx tsc --noEmitcompleted with no compilation errors)main.py, thedelete_graphimport and invocation is wrapped in a try-except block to prevent database updates or file deletions from failing if a document doesn't have an associated graph yet.test_documents.py,MockDbSessionContexthas been updated to commit transactions on context exit so that database purging side effects are accurately tracked by the tests.