fix(evidence): reconcile generations safely
This commit is contained in:
@@ -56,7 +56,9 @@ def active_evidence_hits(store: CorpusStore, vector_store, embedding, *, limit:
|
||||
]
|
||||
|
||||
|
||||
def resolve_evidence_file(store: CorpusStore, evidence_id: str) -> str:
|
||||
def resolve_evidence_file(
|
||||
store: CorpusStore, evidence_id: str, *, materialized_root=None,
|
||||
) -> str:
|
||||
manifest = store.active_manifest()
|
||||
if manifest is None:
|
||||
return ""
|
||||
@@ -64,9 +66,8 @@ def resolve_evidence_file(store: CorpusStore, evidence_id: str) -> str:
|
||||
frontmatter = document.metadata.get("frontmatter", {})
|
||||
identifiers = {document.document_id, document.source_id, str(frontmatter.get("id", ""))}
|
||||
if evidence_id in identifiers:
|
||||
# Validate the immutable bytes through the dirfd/O_NOFOLLOW reader before
|
||||
# handing the path to legacy session-artifact consumers.
|
||||
store.read_document(document.document_id)
|
||||
path = store.resolve_document(document.document_id)
|
||||
root = materialized_root or (store.root / "runtime")
|
||||
filename = document.document_id.removeprefix("doc:") + ".md"
|
||||
path = store.materialize_document(document.document_id, root / filename)
|
||||
return str(path) if path else ""
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user