test: cover qdrant delete-kinds scoping
This commit is contained in:
@@ -307,6 +307,51 @@ def test_existing_hashes_health_and_exact_generation_inventory_and_delete():
|
||||
assert health.dimension_compatible is True
|
||||
|
||||
|
||||
def test_delete_kinds_is_workspace_scoped_and_preserves_other_semantic_kinds():
|
||||
fake = FakeQdrantHttp()
|
||||
store = _store(fake)
|
||||
|
||||
store.upsert("memory", [_write_record("memory:1", "memory")])
|
||||
store.upsert("memory", [_write_record("solved:1", "solved_question")])
|
||||
store.upsert("schema_records", [_write_record("schema_table:patients", "schema_table")])
|
||||
|
||||
other_workspace_memory = next(
|
||||
point for point in fake.points.values() if point["payload"]["record_key"] == "memory:1"
|
||||
).copy()
|
||||
other_workspace_memory["id"] = point_id("other", "memory", "memory:other")
|
||||
other_workspace_memory["payload"] = {
|
||||
**other_workspace_memory["payload"],
|
||||
"workspace_id": "other",
|
||||
"record_key": "memory:other",
|
||||
"title": "title:memory:other",
|
||||
"content": "content:memory:other",
|
||||
"ref": "ref:memory:other",
|
||||
}
|
||||
fake.points[other_workspace_memory["id"]] = other_workspace_memory
|
||||
|
||||
assert store.delete_kinds("memory", ["memory"]) == 1
|
||||
|
||||
delete_call = next(
|
||||
call
|
||||
for call in fake.calls
|
||||
if call[0] == "POST" and call[1].endswith("/points/delete?wait=true")
|
||||
)
|
||||
assert delete_call[2]["filter"] == {
|
||||
"must": [
|
||||
{"key": "workspace_id", "match": {"value": "demo"}},
|
||||
{"key": "record_kind", "match": {"any": ["memory"]}},
|
||||
]
|
||||
}
|
||||
assert {
|
||||
point["payload"]["record_key"]: point["payload"]["record_kind"]
|
||||
for point in fake.points.values()
|
||||
} == {
|
||||
"solved:1": "solved_question",
|
||||
"schema_table:patients": "schema_table",
|
||||
"memory:other": "memory",
|
||||
}
|
||||
|
||||
|
||||
def test_sanitizes_timeout_and_malformed_responses():
|
||||
fake = FakeQdrantHttp()
|
||||
store = _store(fake)
|
||||
|
||||
Reference in New Issue
Block a user