geno_lewm.provenance¶
provenance
¶
Artifact provenance primitives for GenoLeWM.
This is the preferred public import path for manifests, hashes, input/output commitments, and checksum receipts. The package does not implement or claim runtime assurance beyond checksum provenance.
DtypeConfig
dataclass
¶
Numerical-precision commit shape.
PoolingConfig
dataclass
¶
State-encoder pooling configuration commit shape (RFC-0002).
Manifest
dataclass
¶
Manifest(schema_version: str, model_name: str, model_version: str, release_id: str, encoder: ManifestEncoder, predictor: ManifestArtifact, action_encoder: ManifestArtifact, calibration: ManifestArtifact, training: ManifestTraining, eval: ManifestArtifact)
Top-level manifest (RFC-0011 §3.7).
to_canonical_dict
¶
Return the dict mirror used for canonical JSON.
Dataclass asdict walks nested frozen dataclasses and is
deterministic, so the result is byte-stable when fed to the
canonical JSON encoder (which also sorts keys).
Source code in geno_lewm/provenance/manifest.py
ManifestArtifact
dataclass
¶
A single artifact file referenced by the manifest.
ManifestEncoder
dataclass
¶
Carbon encoder identity.
ManifestTraining
dataclass
¶
Training config + data-snapshot identifiers.
Receipt
dataclass
¶
Receipt(schema_version: str, model_id: str, input_commitment: str, output: ReceiptOutput, output_commitment: str, calibration_hash: str, runtime: ReceiptRuntime, timestamp: str, provenance: ReceiptProvenance)
Top-level receipt (RFC-0011 §3.3).
ReceiptOutput
dataclass
¶
ReceiptOutput(sigma_raw: float, sigma_calibrated: float, bucket_id: str, confidence: float, low_confidence: bool)
Score-call output committed by the receipt.
ReceiptProvenance
dataclass
¶
Checksum provenance block serialized as provenance in v1 JSON.
ReceiptRuntime
dataclass
¶
Runtime / environment block.
compute_input_commitment
¶
compute_input_commitment(reference_window: str, edit_spec: EditSpec, pooling_config: PoolingConfig, dtype_config: DtypeConfig) -> str
Return the "sha256:<hex>" input commitment for a scoring call.
The canonical payload is a dict with fixed keys; canonical-JSON encoding handles ordering and stability.
Source code in geno_lewm/provenance/commitment.py
canonical_json_sha256
¶
sha256_bytes
¶
sha256_file
¶
Return "sha256:<hex>" for the file at path.
Streams the file in 1 MiB chunks; safe for arbitrarily large artifacts (weights files can be multi-GB).
Source code in geno_lewm/provenance/hashing.py
load_manifest
¶
Load and validate a manifest from disk.
Source code in geno_lewm/provenance/manifest.py
write_manifest
¶
Write a manifest to disk as canonical JSON.
The on-disk bytes are byte-stable across platforms.
Source code in geno_lewm/provenance/manifest.py
compute_output_commitment
¶
Compute the output-commitment hash for an output block.
Separated from Receipt so callers can pre-compute the
commitment before assembling the receipt.
Source code in geno_lewm/provenance/receipt.py
parse_receipt_payload
¶
Validate a decoded receipt payload.
Source code in geno_lewm/provenance/receipt.py
read_receipt
¶
Load and validate a receipt from disk.
Source code in geno_lewm/provenance/receipt.py
write_receipt
¶
Write a receipt as canonical JSON; round-trip byte-stable.