mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-27 19:25:15 +02:00
feat: add memory document model and parsing functionality for markdown handling
This commit is contained in:
parent
fe07de3f9c
commit
a0ff86e0e8
5 changed files with 241 additions and 37 deletions
|
|
@ -64,6 +64,27 @@ def test_validate_bullet_format_warns_on_nonstandard_bullet() -> None:
|
|||
assert "Non-standard memory bullet" in warnings[0]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_save_memory_normalizes_legacy_marker_bullets(monkeypatch) -> None:
|
||||
target = type("Target", (), {"memory_md": ""})()
|
||||
session = _FakeSession()
|
||||
|
||||
async def fake_load_target(**_kwargs):
|
||||
return target
|
||||
|
||||
monkeypatch.setattr("app.services.memory.service._load_target", fake_load_target)
|
||||
|
||||
result = await save_memory(
|
||||
scope=MemoryScope.USER,
|
||||
target_id="00000000-0000-0000-0000-000000000000",
|
||||
content="- (2026-04-10) [fact] Legacy fact is preserved\n",
|
||||
session=session,
|
||||
)
|
||||
|
||||
assert result.status == "saved"
|
||||
assert target.memory_md == "## Memory\n- 2026-04-10: Legacy fact is preserved"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_save_memory_blocks_new_personal_heading_in_team_before_commit(
|
||||
monkeypatch,
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ async def test_save_memory_accepts_legacy_marker_payload(monkeypatch) -> None:
|
|||
)
|
||||
|
||||
assert result.status == "saved"
|
||||
assert "[fact]" in target.memory_md
|
||||
assert target.memory_md == "## Memory\n- 2026-05-19: Legacy marker memory"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue