From 2624d1d342f9d3d88e224b82a202144dd8b63fc4 Mon Sep 17 00:00:00 2001 From: mptyl Date: Sun, 12 Jul 2026 05:26:11 +0200 Subject: [PATCH] test: assert removed evidence stays hidden --- .superpowers/sdd/evidence-task-5d-report.md | 8 ++++++ .../l0/test_pgvector_corpus_lifecycle.py | 25 ++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.superpowers/sdd/evidence-task-5d-report.md b/.superpowers/sdd/evidence-task-5d-report.md index a46ac58c..9d87b141 100644 --- a/.superpowers/sdd/evidence-task-5d-report.md +++ b/.superpowers/sdd/evidence-task-5d-report.md @@ -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. diff --git a/harness/tests/l0/test_pgvector_corpus_lifecycle.py b/harness/tests/l0/test_pgvector_corpus_lifecycle.py index 5c63555d..d2dec02d 100644 --- a/harness/tests/l0/test_pgvector_corpus_lifecycle.py +++ b/harness/tests/l0/test_pgvector_corpus_lifecycle.py @@ -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", ) == ""