pub fn stamp_provenance_bytes(
input: &[u8],
patch: &ProvenancePatch,
) -> Result<Vec<u8>, V2FormatError>Expand description
Patch provenance metadata on an existing APR v2 buffer and return the re-serialized bytes.
§Errors
Returns V2FormatError::InvalidHeader if:
inputis not a valid APR v2 buffer (propagated fromAprV2Reader::from_bytes)patch.has_any()isfalse— a no-op stamp is rejected up-front so callers cannot accidentally rewrite without changing the artifact
§Guarantees
- Header flags from
inputare preserved in the output (LAYOUT_ROW_MAJOR is always added regardless of input, per LAYOUT-002 jidoka) - Tensor bytes are copied verbatim — no quantize/dequantize round-trip
- Sort-by-name ordering matches
AprV2Writer::write()(tensor index is sorted, so the re-serialized index is canonical)
§Non-guarantees
- Footer checksum WILL change (metadata bytes moved)
- sha256 of the output file WILL differ from the input (by design — that is the whole point of a stamp operation)