fix(evidence): resolve final review findings

This commit is contained in:
2026-08-25 03:03:11 +02:00
parent d4818c8cc3
commit e9c65ef2db
10 changed files with 686 additions and 20 deletions
+12 -3
View File
@@ -45,8 +45,19 @@ def _evaluation_workspace_root(cfg) -> Path:
return root
def _requires_candidate_evaluation(cfg) -> bool:
evidence = cfg.evidence
if evidence is None or evidence.schema_version != 2:
return False
return evidence.source_root is not None or any(
source.type == "filesystem" for source in evidence.sources
)
def _candidate_evaluator(cfg, *, vector_store, embedder):
"""Bind candidate publication to the same read-only retrieval evaluator as the CLI."""
if not _requires_candidate_evaluation(cfg):
return None
from tht.evidence.canonical import load_curated_tree
from tht.evidence.evaluation import evaluate_retrieval, load_evaluation_fixture
@@ -77,9 +88,7 @@ def _candidate_evaluator(cfg, *, vector_store, embedder):
def _validate_materialized_curated_corpus(cfg) -> None:
"""Fail closed on a v2 pinned filesystem corpus before any vector write is possible."""
if cfg.evidence is None or cfg.evidence.schema_version != 2:
return
if not any(source.type == "filesystem" for source in cfg.evidence.sources):
if not _requires_candidate_evaluation(cfg):
return
from tht.evidence import validate_workspace_evidence