You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MemoryFileStore keys every topic file by _slugify_topic(topic), which strips everything that is not a to z or 0 to 9. The mapping is many to one: C ++ and C # both slug to c, node.js and node js both slug to node-js, and API and api collide too. write_topic then does an unconditional overwrite of the slug path, so writing a second topic that shares a slug with an existing one silently destroys the first topic's memories.
Reproduced on current main: write topic C ++ with the memory Modern C ++ prefers smart pointers, then topic C # with C # 12 primary constructors. Afterwards get_topic("C ++") returns the C # memory, the C ++ memory is gone, and list_topics shows a single topic.
The same file family deliberately uses the injective _storage_key_segment derivation for owner ids, session ids, source ids, and scopes, precisely so two byte distinct values do not share a storage location. The topic filename is the one mapping left below that standard.
Expected Behavior
Distinct topics must never share a memory file. Writing C ++ and C # should persist two files whose contents survive, and get_topic by topic name should keep returning each topic's own memories.
Steps to Reproduce
Create a MemoryFileStore and write two topics whose names share a slug.
Read the first topic back.
Minimal Reproduction
store.write_topic(session, MemoryTopicRecord(topic="C++", summary="cpp", memories=["smart pointers"], updated_at=...), source_id="memory")
store.write_topic(session, MemoryTopicRecord(topic="C#", summary="csharp", memories=["primary constructors"], updated_at=...), source_id="memory")
store.get_topic(session, source_id="memory", topic="C++").memories# returns the C# memory on main
Activity
[-]Python: MemoryFileStore topic slug collisions silently overwrite another topic's memories[/-][+].NET: Python: MemoryFileStore topic slug collisions silently overwrite another topic's memories[/+]