From 0008f2bef5c531784d2cda2500ba80c7288a251a Mon Sep 17 00:00:00 2001 From: alexeybe1kin <210597588+alexeybe1kin@users.noreply.github.com> Date: Fri, 13 Nov 2026 12:51:59 +0200 Subject: [PATCH] test: leak checks match whole words, not letters inside random key hashes --- services/api/tests/memory_stack.py | 7 +++++++ services/api/tests/test_boundary_forget.py | 6 +++--- services/api/tests/test_boundary_scope.py | 4 ++-- services/api/tests/test_boundary_supersede.py | 10 ++++++++-- services/api/tests/test_refusal_and_pending_search.py | 3 ++- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/services/api/tests/memory_stack.py b/services/api/tests/memory_stack.py index 1c71777..4da24fc 100644 --- a/services/api/tests/memory_stack.py +++ b/services/api/tests/memory_stack.py @@ -244,6 +244,13 @@ def stored_text(self) -> str: return "\n".join(found) +def holds_word(text_dump: str, word: str) -> bool: + """Whether `word` appears in `text_dump` as a whole word, ignoring case. A dump of every + stored value also holds random key hashes and ids, whose letters can spell a short word + ("bus" in "...GdGbusxe..."); a stored sentence or token still has a boundary around it.""" + return re.search(rf"(?