fix(evidence): retain referenced vector generations

This commit is contained in:
2026-07-12 05:34:47 +02:00
parent 3a9808f126
commit 92b1d3ccc3
7 changed files with 127 additions and 28 deletions
+30
View File
@@ -220,6 +220,36 @@ def test_explicit_gc_blocks_while_job_holds_corpus_writer_lock(tmp_path):
assert candidate.store.active_generation() is not None
def test_gc_preserves_vector_dependencies_of_retained_manifests(tmp_path):
vectors = Vectors()
one = item("one", "a")
first = pipeline(tmp_path, Source([(one, "stable")]), vectors=vectors, retain=2).run().generation
second = pipeline(
tmp_path, Source([(one, "stable"), (item("two", "b"), "two")]),
vectors=vectors, retain=2,
).run().generation
third = pipeline(
tmp_path, Source([(one, "stable"), (item("two", "c"), "changed")]),
vectors=vectors, retain=2,
).run().generation
assert CorpusStore(tmp_path / "corpus").list_generations() == [second, third]
assert first in vectors.list_evidence_generations("evidence")
def test_active_searcher_without_active_fails_closed_for_evidence(tmp_path):
from types import SimpleNamespace
from tht.search.evidence import active_searcher
class Delegate:
def search(self, embedding, top_n=10, kinds=None, metadata_filter=None):
return ["legacy"]
cfg = SimpleNamespace(paths=SimpleNamespace(artifacts=tmp_path / "artifacts"))
wrapped = active_searcher(cfg, Delegate())
assert wrapped.search([1.0], kinds=["evidence"]) == []
assert wrapped.search([1.0], kinds=["memory"]) == ["legacy"]
def test_unchanged_documents_skip_acquire_normalize_chunk_and_embed(tmp_path):
one = item("one", "a")
first_source = Source([(one, "hello")])