mixle.reason.receipt module

E7 — cross-chain provenance receipt (work-plan §5, IC-2 / IC-5 / IC-13).

decision_receipt walks a data -> posterior -> claim -> decision chain and emits an mixle.task.trace_record (IC-5) whose every step carries a content hash for its own output and its parent’s hash as result["parent_hash"] – a hashed, re-derivable lineage edge from raw data through an inversion, an interpretation, and a decision. The posterior is ingested into a Substrate (via ingest_artifacts()) rather than copied: the substrate item’s payload references the artifact (an IC-13-shaped {artifact_ref, schema, grid, crs, units} record), the array bytes stay wherever the IC-2 artifact already lives.

Repo-boundary note (see the PR body for the full explanation): this PR only touches the core mixle repository. mixle-pde (E2’s io/artifacts.py – IC-2) and mixle-mlops (E3/E4/E5) had not landed on release/0.8.0 as of this PR, so decision_receipt does not import either package. Instead it verifies an on-disk posterior artifact directly and, when present, checks its {posterior_ref}.json sidecar against a streaming SHA-256 of the artifact bytes. claim and decision accept a plain dictionary or dataclass and are encoded through a strict versioned canonical schema.

class ContentDigest(algorithm, hexdigest)[source]

Bases: object

A validated digest value, distinct from an ordinary 64-character string.

Parameters:
  • algorithm (str)

  • hexdigest (str)

decision_receipt(*, dataset_ref, posterior_ref, claim, decision, substrate)[source]

Build an IC-5 trace record for one data -> posterior -> claim -> decision chain.

dataset_ref is canonically fingerprinted. posterior_ref must resolve to an accessible file whose bytes are hashed and checked against any declared sidecar digest. claim and decision are canonical dictionaries or dataclasses. The posterior is ingested into substrate as a referenced (not copied) artifact.

Returns a dict that satisfies mixle.task.trace_record.validate_trace_record(): every scalar output (the posterior, the claim, the decision) resolves to a hashed lineage edge whose content_hash is independently re-derivable via content_edge_hash(), and whose parent_hash chains back to the previous edge.

Parameters:
  • dataset_ref (Any)

  • posterior_ref (Any)

  • claim (Any)

  • decision (Any)

  • substrate (Substrate)

Return type:

dict[str, Any]

content_edge_hash(value)[source]

Hash a strict versioned canonical envelope for one inline lineage value.

Parameters:

value (Any)

Return type:

str