Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

log(rag): name the document in the verification-skip warning (#7551)

Masyarakat AI5051de120506
diff --git a/src/local_deep_research/research_library/deletion/services/document_deletion.py b/src/local_deep_research/research_library/deletion/services/document_deletion.py
index af7e0fb69e..924def92de 100644
--- a/src/local_deep_research/research_library/deletion/services/document_deletion.py
+++ b/src/local_deep_research/research_library/deletion/services/document_deletion.py
@@ -120,8 +120,11 @@ class DocumentDeletionService:
continue
except Exception:
logger.warning(
- "Could not verify research document removal; "
- "skipping RAG cleanup"
+ f"Could not verify research document removal; "
+ f"skipping RAG cleanup for document "
+ f"{short_id(document_id)} "
+ f"({len(collection_ids)} collection"
+ f"{'s' if len(collection_ids) != 1 else ''})"
)
continue
self._purge_document_rag(
diff --git a/tests/web/routers/test_delete_research_cascade.py b/tests/web/routers/test_delete_research_cascade.py
index 6004e97c01..49ac74e015 100644
--- a/tests/web/routers/test_delete_research_cascade.py
+++ b/tests/web/routers/test_delete_research_cascade.py
@@ -849,7 +849,9 @@ class TestClearHistoryRouteWithFKEnforcement:
class TestResearchRagPurgeRoutes:
"""History deletion purges chunk text only after the guarded commit."""
- def test_unverified_document_removal_does_not_purge_search_data(self):
+ def test_unverified_document_removal_does_not_purge_search_data(
+ self, loguru_caplog
+ ):
from local_deep_research.research_library.deletion.services import (
document_deletion,
)
@@ -862,9 +864,28 @@ class TestResearchRagPurgeRoutes:
side_effect=RuntimeError("database unavailable"),
),
patch.object(service, "_purge_document_rag") as purge,
+ loguru_caplog.at_level("WARNING"),
):
- service.purge_deleted_research_documents([("doc", ["collection"])])
+ service.purge_deleted_research_documents(
+ [
+ ("0123456789abcdef-document", ["collection"]),
+ ("fedcba9876543210-second", ["one", "two"]),
+ ]
+ )
purge.assert_not_called()
+ # The skip is actionable: every warning names the document and how
+ # many collections were left behind (#7501).
+ skips = [
+ r
+ for r in loguru_caplog.records
+ if "skipping RAG cleanup" in r.message
+ ]
+ assert [r.message for r in skips] == [
+ "Could not verify research document removal; skipping RAG cleanup "
+ "for document 01234567... (1 collection)",
+ "Could not verify research document removal; skipping RAG cleanup "
+ "for document fedcba98... (2 collections)",
+ ]
@pytest.mark.parametrize("entrypoint", ["single", "history", "chat"])
def test_transferred_document_keeps_rag_until_last_reference_deleted(