fix: deflake MemoryRecord embedding serialization test

Substring checks like `'0.1' not in json_str` collided with timestamps
such as `2026-04-10T13:00:50.140557` on CI. Round-trip through
`model_validate_json` to verify structurally that the embedding field
is absent from the serialized output.
This commit is contained in:
Greyson LaLonde
2026-04-11 02:01:23 +08:00
committed by GitHub
parent ea58f8d34d
commit 7e1672447b

View File

@@ -51,14 +51,13 @@ def test_memory_record_embedding_excluded_from_serialization() -> None:
dumped = r.model_dump()
assert "embedding" not in dumped
assert dumped["content"] == "hello"
# model_dump_json excludes embedding
json_str = r.model_dump_json()
assert "0.1" not in json_str
assert "embedding" not in json_str
rehydrated = MemoryRecord.model_validate_json(json_str)
assert rehydrated.embedding is None
# repr excludes embedding
assert "0.1" not in repr(r)
assert "embedding=" not in repr(r)
# Direct attribute access still works for storage layer
assert r.embedding is not None