fix(evidence): index only curated legacy documents

This commit is contained in:
2026-08-25 01:02:41 +02:00
parent f1a9b567ba
commit d5d65f3659
2 changed files with 24 additions and 1 deletions
@@ -117,6 +117,25 @@ def test_source_factory_preserves_legacy_first_order_and_filesystem_configuratio
assert current[1].max_bytes == 1024
def test_legacy_source_discovers_only_curated_evidence_units(tmp_path):
legacy_root = tmp_path / "legacy"
(legacy_root / "evidence" / "source").mkdir(parents=True)
(legacy_root / "evidence" / "source" / "raw.md").write_text("raw source")
(legacy_root / "evidence" / "curated" / "domain").mkdir(parents=True)
(legacy_root / "evidence" / "curated" / "domain" / "patient.md").write_text("curated")
cfg = SimpleNamespace(evidence=SimpleNamespace(
source_root=legacy_root,
evidence_dir="evidence",
sources=[],
))
source = build_sources(cfg.evidence)[0]
assert [item.metadata["relative_path"] for item in source.discover()] == [
"curated/domain/patient.md"
]
def test_preprocessing_factory_forwards_only_evidence_pipeline_dependencies(monkeypatch):
captured = {}
+5 -1
View File
@@ -18,7 +18,11 @@ def build_sources(evidence: EvidenceSourcesConfig | None) -> list[EvidenceSource
return []
sources: list[EvidenceSource] = []
if evidence.source_root is not None:
sources.append(FilesystemEvidenceSource(evidence.source_root / evidence.evidence_dir))
legacy_root = evidence.source_root / evidence.evidence_dir
legacy_patterns = (
("**/*.md",) if legacy_root.name == "curated" else ("curated/**/*.md",)
)
sources.append(FilesystemEvidenceSource(legacy_root, patterns=legacy_patterns))
for resource in evidence.sources:
match resource.type:
case "filesystem":