test: assert removed evidence stays hidden

This commit is contained in:
2026-07-12 05:26:11 +02:00
parent 9a9acbd122
commit 2624d1d342
2 changed files with 27 additions and 6 deletions
@@ -40,3 +40,11 @@ generation-management privileges. Runtime application code was not redesigned.
- `git diff --check`: passed.
The existing Pydantic serialization and legacy-workspace deprecation warnings remain unchanged.
## Follow-up assertion correction
The removal phase now retains the removed canonical document ID/ref before publication and
asserts both fields are absent from post-resume ACTIVE Evidence hits. It reruns the real
search-pack fusion after removal, proves active fourth-generation content is positively
returned in both paths, and proves the removed content remains absent. The owned session
artifact lookup for the retained removed ID remains empty.
@@ -129,6 +129,12 @@ def test_real_pgvector_corpus_job_lifecycle(tmp_path, persistent_pgvector):
result = _publish(_pipeline(tmp_path, source_root, vectors), tmp_path, serial + 1)
assert result.status == "succeeded"
generations.append(result.generation)
removed_document = next(
doc for doc in CorpusStore(tmp_path / "corpus").active_manifest().documents
if "removed.md" in doc.source_uri
)
removed_document_id = removed_document.document_id
removed_ref = removed_document.document_id
# A stale, closer row must not consume LIMIT before ACTIVE filtering.
stale_generation = generations[-2]
@@ -190,14 +196,21 @@ def test_real_pgvector_corpus_job_lifecycle(tmp_path, persistent_pgvector):
assert duplicate_count == 0
runtime = ActiveEvidenceSearcher(CorpusStore(tmp_path / "corpus"), EvidenceDelegate(vectors))
assert all(hit.ref != "doc:stale" for hit in runtime.search(query, top_n=20, kinds=["evidence"]))
manifest = CorpusStore(tmp_path / "corpus").active_manifest()
removed_document = next(
doc for doc in _pipeline(tmp_path, source_root, vectors).store.manifest(generations[-2]).documents
if "removed.md" in doc.source_uri
active_hits = runtime.search(query, top_n=20, kinds=["evidence"])
assert active_hits
assert any("active fourth generation" in hit.content for hit in active_hits)
assert all(hit.ref not in {"doc:stale", removed_ref} for hit in active_hits)
assert all(hit.metadata.get("document_id") != removed_document_id for hit in active_hits)
active_pack = combined_search(
"active", lsh_hits=None, store=runtime, embedder=DeterministicEmbedder(),
top=20, rrf_k=60, kinds=["evidence"], query_vec=query,
)
assert active_pack
assert any("active fourth generation" in result.content for result in active_pack)
assert all(removed_document.content not in result.content for result in active_pack)
manifest = CorpusStore(tmp_path / "corpus").active_manifest()
assert resolve_evidence_file(
CorpusStore(tmp_path / "corpus"), removed_document.document_id,
CorpusStore(tmp_path / "corpus"), removed_document_id,
materialized_root=tmp_path / "session",
) == ""