fix(memory): match memory ID prefixes literally 🤖🤖🤖 - #278
Conversation
Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughChangesThe memory store now escapes Memory ID resolution
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Memory ID prefixes containing SQL wildcard or escape characters now resolve literally, preventing unintended updates or archival of unrelated records. The targeted regression coverage reports passing results, and no current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
What does this PR do?
resolve_id()treats%and_in an ID prefix as SQL LIKE wildcards. With one stored memory,update_memory("%%%%%%", ...)updates that record, andforget("______")can archive it even though neither is a prefix of its ID.Escape LIKE metacharacters and the escape character so prefixes are matched literally. Keep exact matches, abbreviated IDs, and ambiguous-prefix errors. This is incorrect wildcard interpretation in a parameterized query, not SQL injection.
Validation
Eight new regression cases fail before the fix; a ninth verifies literal escape-character handling. Store and public-tool tests cover literal special characters and preservation of records after invalid update/forget requests.
uv run pytest -q packages/nooa-memory/tests/memory/test_memory_store.py packages/nooa-memory/tests/memory/test_memory_contract.py— 35 passed.Windows/Python 3.12 with external import-only helpers for #84/#85. A broader run also passed 19 reference tests; the existing POSIX absolute-path error-message assertion fails on Windows. Helpers are not included and do not validate POSIX locks/signals.
Related issues
No matching open issue found.
Checklist
Summary by CodeRabbit
Bug Fixes
%,_, and!are treated as literal characters rather than wildcard patterns.Tests