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

@ -131,6 +131,16 @@ def test_result_lists_written_concept_files(file_setup: tuple[Path, Path]) -> No
assert result.written == (bundle / "ingest-orders.md",)
def test_result_exposes_manifest_stamp(file_setup: tuple[Path, Path]) -> None:
"""The §5 provenance stamp ({stem}@{sha256(raw)[:16]}) is returned on the
result so consumers never have to recompute it from the manifest bytes."""
manifest_path, bundle = file_setup
result = materialize_bundle(manifest_path, bundle, INGESTED_AT)
assert result.stamp == stamp_of(manifest_path)
content = (bundle / "ingest-orders.md").read_text(encoding="utf-8")
assert f"ingest_manifest: {result.stamp}\n" in content
def test_relative_root_resolves_against_manifest_dir(
tmp_path: Path, file_setup: tuple[Path, Path], monkeypatch: pytest.MonkeyPatch
) -> None: