Skip to content

Verify dataset re-ingestion and checksum scope

The native ingest_dataset operation validates a dataset and returns an artifact that records its dataset, validation report and checksum encoding. Re-ingest that artifact as an artifact so the implementation retains and checks the declared encoding. This tutorial exercises both supported JSON checksum encodings using small synthetic adoption data.

You will preserve an entire dataset artifact across re-ingestion, distinguish content identity from serialization encoding, and verify that modifying a data value without updating its checksum is rejected. You will state precisely which fields the checksum covers and what it cannot establish about a data source.

Use the native development installation. The example requires the installed package and Python’s standard library. It uses two synthetic observations at times zero and one, and performs no network request or external-file ingestion.

The provenance record declares a synthetic source, a licence label and an extraction-time string. Those labels are supplied by the example. They are not evidence that a real dataset has those rights, was extracted at that time, or has a trustworthy chain of custody.

Run the checked source from the repository root:

Terminal window
.venv-native/bin/python -I examples/native_reingestion.py
examples/native_reingestion.py
"""Verify both dataset encodings, complete-artifact replay and tamper rejection."""
import json
from copy import deepcopy
from innovate import NativeError, execute
def main() -> None:
"""Re-ingest a synthetic adoption dataset while preserving its checksum format."""
dataset = {
"kind": "adoption",
"time": [0, 1],
"adoption": [1, 2],
"provenance": {
"source": "synthetic survey α",
"license": "CC0-1.0",
"extraction_time": "2026-11-15T00:00:00Z",
},
}
encodings = ["python_sorted_json_v1", "rust_sorted_json_v1"]
rejected_count = 0
for encoding in encodings:
artifact = execute("ingest_dataset", dataset=dataset, encoding=encoding)["result"]
assert artifact["checksum_encoding"] == encoding
verified = execute("ingest_dataset", artifact=artifact)["result"]
assert verified == artifact
assert verified["dataset"]["adoption"] == [1, 2]
assert verified["dataset"]["time"] == [0, 1]
tampered = deepcopy(artifact)
tampered["dataset"]["adoption"][1] = 3
rejected = False
try:
execute("ingest_dataset", artifact=tampered)
except NativeError as error:
rejected = "checksum does not match" in str(error)
assert rejected
rejected_count += int(rejected)
assert dataset["adoption"] == [1, 2]
print(json.dumps({"encodings": encodings, "tampered_artifacts_rejected": rejected_count}, sort_keys=True))
if __name__ == "__main__":
main()

For each encoding, the script ingests the dataset, re-ingests the complete returned artifact and checks equality. It then changes the second adoption value from two to three while retaining the original checksum. This change leaves an otherwise plausible increasing series, so checksum rejection is the important failure being exercised. The original input is also checked for accidental mutation.

Successful assertions produce:

{"encodings": ["python_sorted_json_v1", "rust_sorted_json_v1"], "tampered_artifacts_rejected": 2}

Both python_sorted_json_v1 and rust_sorted_json_v1 are retained during re-ingestion, and both modified artifacts are rejected. The example includes a non-ASCII source label so the declared string-encoding convention matters. The encodings need not produce identical digest values for the same interpreted dataset; retain the encoding identifier with its digest.

The native artifact includes artifact_kind="innovate.dataset", dataset, validation and checksum_encoding. Artifact input cannot be combined with a separate dataset or encoding argument. Supplying the complete artifact lets the native operation verify the existing content under its declared encoding.

The checksum implementation computes SHA-256 over the sorted serialized dataset after removing provenance.extraction_time and provenance.checksum. This is dataset-content integrity under a named encoding, not a hash of every artifact field. In particular, the extraction-time field is outside the digest’s scope. The role of a cryptographic digest in detecting changed content is described by NIST’s Secure Hash Standard.

Reader task: would retaining the same digest prove that an extraction-time label was unchanged? No: that field is deliberately excluded. Would a digest prove who created the dataset? No: an unauthenticated checksum can be recomputed by someone who can replace both the content and its recorded digest.

Provenance validation checks implemented field and schema rules. It does not independently verify a licence, timestamp, citation, extraction method or the completeness of declared transformations. A checksum is not a digital signature, permission to use data or evidence of measurement validity.

This fixture checks two-row adoption data and tampering with one numeric value. It does not qualify every dataset kind, file parser, external adapter or future encoding. For table input, inspect the separate ingest_polars and ingest_local contracts before choosing columns or units. Keep scientific validation, source rights and software integrity as separate parts of the analysis record.