fix(memory): paginate delete_all past list() top_k default - #6629
Open
Bartok9 wants to merge 1 commit into
Open
Conversation
Closes mem0ai#6627 Root cause: delete_all called vector_store.list without top_k; most stores default top_k=100 so only the first page was deleted while the API still reported full success (privacy/GDPR hazard). Fix: page list() with top_k=1000 until a short/empty page for sync and async Memory.delete_all. Verification: pytest tests/test_main.py::test_delete_all tests/test_main.py::test_delete_all_paginates_beyond_default_top_k TestEntityIdValidation delete_all cases — 4 passed.
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.
Summary
delete_all()only deleted the first page ofvector_store.list()(defaulttop_k=100) but still returned success.Motivation
Closes #6627. Silent partial delete is a data-retention/privacy hazard.
Fix
Page
list(filters=..., top_k=1000)until a short/empty page in sync and asyncMemory.delete_all.Verification
pytest tests/test_main.py::test_delete_all tests/test_main.py::test_delete_all_paginates_beyond_default_top_k(+ entity-id delete_all cases) — passed.