feat(api): expose the §5 provenance stamp on IngestResult

The stamp ({stem}@{sha256(raw)[:16]}) was computed internally but only
written into frontmatter, forcing consumers to recompute it from the
manifest bytes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-07-17 03:46:52 +02:00
commit d3a3bccfbb
2 changed files with 14 additions and 2 deletions

View file

@ -42,9 +42,11 @@ _MANAGED_LINE_RE = re.compile(r"^- \[(?P<label>[^\]]*)\]\((?P<target>[^)]+)\)$")
@dataclass(frozen=True)
class IngestResult:
"""The concept files written by one materialization run."""
"""The concept files written by one materialization run, and the §5
provenance stamp (`{stem}@{sha256(raw)[:16]}`) they were stamped with."""
written: tuple[Path, ...]
stamp: str
def _render_frontmatter(frontmatter: dict[str, str]) -> str:
@ -268,4 +270,4 @@ def materialize_bundle(
_update_index_lines(index_path, owned - staged_names, labels_by_target)
for extraction in manifest.extractions:
_link_in_index(bundle, generated_filename(extraction.id), extraction.title)
return IngestResult(written=written)
return IngestResult(written=written, stamp=stamp)