Skip to content

The agent that grows with you

test(memory): fold the two-heading-shape assert into the repeated-bullet test

kshitijk4poor47a6f2aaf3c8
diff --git a/tests/agent/test_memory_context_dedupe.py b/tests/agent/test_memory_context_dedupe.py
index 6771d3f9c53..6ad7bf03e51 100644
--- a/tests/agent/test_memory_context_dedupe.py
+++ b/tests/agent/test_memory_context_dedupe.py
@@ -20,6 +20,10 @@ def _body(block: str) -> str:
def test_a_repeated_bullet_is_kept_once_in_first_position():
+ """Within a section a repeat is dropped; a section is delimited by a heading of ANY style.
+ RetainDB writes prose headings (``Profile:`` / ``Relevant memories:``); other providers write
+ markdown ones. In both shapes a placeholder bullet repeated under the second heading belongs to
+ that heading and must stay, or the heading is left claiming nothing."""
raw = "- alpha\n- beta\n- alpha\n- gamma\n"
body = _body(build_memory_context_block(raw))
@@ -27,6 +31,12 @@ def test_a_repeated_bullet_is_kept_once_in_first_position():
# First-occurrence order, not a re-sort, and nothing else moved.
assert body.splitlines() == ["- alpha", "- beta", "- gamma"]
+ prose = "Profile:\n- None\nRelevant memories:\n- None\n"
+ markdown = "## A\n- (none recorded)\n\n## B\n- (none recorded)\n"
+
+ assert _body(build_memory_context_block(prose)) == prose
+ assert _body(build_memory_context_block(markdown)) == markdown
+
def test_a_bullet_with_continuation_lines_is_never_touched():
"""Two entries can share a headline and differ underneath it. Dropping one would re-parent its
@@ -35,15 +45,3 @@ def test_a_bullet_with_continuation_lines_is_never_touched():
"- prefers draft PRs\n (logged 3 Feb, source: builtin)\n")
assert _body(build_memory_context_block(raw)) == raw
-
-
-def test_identical_placeholder_bullets_under_different_headings_both_survive():
- """A section is delimited by a heading of ANY style. RetainDB writes prose headings
- (``Profile:`` / ``Relevant memories:``); other providers write markdown ones. In both shapes a
- placeholder bullet repeated under the second heading belongs to that heading and must stay, or
- the heading is left claiming nothing."""
- prose = "Profile:\n- None\nRelevant memories:\n- None\n"
- markdown = "## A\n- (none recorded)\n\n## B\n- (none recorded)\n"
-
- assert _body(build_memory_context_block(prose)) == prose
- assert _body(build_memory_context_block(markdown)) == markdown