ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import pytest
|
||||
from memory_manager import NotesMemoryManager, MemoryNote
|
||||
|
||||
def test_consolidate_memories_preserves_earliest_created_at():
|
||||
"""Verify deduplicating identical memory notes retains the earliest created_at timestamp."""
|
||||
mgr = NotesMemoryManager(user_id="test_created_at_user")
|
||||
mgr.notes = [
|
||||
MemoryNote(
|
||||
note_id="note_old",
|
||||
content="User prefers Python for AI development",
|
||||
session_id="s1",
|
||||
created_at="2026-01-01T10:00:00",
|
||||
updated_at="2026-01-01T10:00:00",
|
||||
tags=["pref"]
|
||||
),
|
||||
MemoryNote(
|
||||
note_id="note_new",
|
||||
content="User prefers Python for AI development",
|
||||
session_id="s2",
|
||||
created_at="2026-01-10T15:00:00",
|
||||
updated_at="2026-01-10T15:00:00",
|
||||
tags=["language"]
|
||||
)
|
||||
]
|
||||
|
||||
report = mgr.consolidate_memories(resolve_conflicts=False)
|
||||
|
||||
assert len(mgr.notes) == 1
|
||||
assert mgr.notes[0].created_at == "2026-01-01T10:00:00"
|
||||
assert mgr.notes[0].updated_at == "2026-01-10T15:00:00"
|
||||
assert mgr.notes[0].tags == ["language", "pref"]
|
||||
Reference in New Issue
Block a user