Skip to content

[Bug]: topic purge #6

Closed
Closed

Description

@iamlinjunhong

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Environment (optional)

No response

Actual behavior

purge topic="%" 删除所有记忆
先存几条测试数据:
Called MCP tool
memory_store
Called MCP tool
memory_store
Called MCP tool
memory_store
现在用 % 作为 topic purge — 这应该只删包含 "%" 字符的记忆,但实际上会删掉所有:
Called MCP tool
memory_purge
3 条记忆全被删了,但没有一条包含 "%" 字符。topic="%" 变成了 LIKE "%%%",匹配所有行。

Expected behavior

No response

Steps to reproduce

purge topic="%" 删除所有记忆
先存几条测试数据:
Called MCP tool
memory_store
Called MCP tool
memory_store
Called MCP tool
memory_store
现在用 % 作为 topic purge — 这应该只删包含 "%" 字符的记忆,但实际上会删掉所有:
Called MCP tool
memory_purge
3 条记忆全被删了,但没有一条包含 "%" 字符。topic="%" 变成了 LIKE "%%%",匹配所有行。

Additional information

No response

Activity

  1. added a commit that references this issue on Mar 12, 2026
    cc82cf9
  2. loveRhythm1990 commented on Nov 17, 2026

    @loveRhythm1990
    Collaborator

    Suggest closing: this is fixed on current main and I could not reproduce it.

    Fix. #298 (bbddf7b, "match purge topics literally in LIKE (escape % and _)") escapes %, _ and \ in sanitize_like_pattern (memoria-storage/src/store.rs), so a topic is matched as literal text. find_ids_by_topic also rejects topics shorter than 3 characters.

    Reproduction on main (3a58488). I stored three memories (alpha note, beta note, gamma note) against a MatrixOne v4.2.8 container and called memory_purge through the MCP tool entry point, as in this report:

    topic result memories left
    % Validation error: topic must be at least 3 characters 3
    %%% Purged 0 memory(s) 3
    _ Validation error: topic must be at least 3 characters 3
    ___ Purged 0 memory(s) 3
    a%e Purged 0 memory(s) 3

    The checks above were a throwaway test and are not committed.

    Existing regression test. test_purge_by_topic_treats_like_wildcards_literally_verify_db in memoria-api/tests/api_db_verify.rs covers the REST path. cfg_key must not delete cfgXkey, and 50% must not delete 500 units. It passes on main.

    This was checked against main, not against any deployed instance. If the original environment still shows the problem, it is running a build from before #298.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions