oxo-flow provenance#
Verify output file integrity using stored checksums, and compare the recorded output checksums of two checkpoints.
Usage#
oxo-flow provenance verify [OPTIONS] <CHECKPOINT_PATH>
oxo-flow provenance diff [OPTIONS] <LEFT_CHECKPOINT> <RIGHT_CHECKPOINT>
Description#
Re-computes SHA-256 checksums of output files and compares them against
previously recorded values stored in a checkpoint (generated by
oxo-flow run --provenance). Reports any mismatches, missing files,
or unverified outputs.
The header also surfaces the workflow provenance recorded at run start —
the git HEAD SHA of the repository the workflow lives in, a content digest
(sha256:<hex> of the top-level workflow file as read at run start), and a
marker for whether the workflow file had uncommitted changes — so every
verification names the exact workflow version that produced the results
(see Workflow Versioning). The content hash
covers only the top-level workflow file; for [[include]] workflows the
identity is that file plus the separately recorded include resolutions
(include_resolutions, their per-include checkout SHAs — see
Workflow Versioning). When the file was
dirty at run start, the content hash is the authoritative record of which
bytes executed: the HEAD SHA alone cannot tell two runs of the same
uncommitted file apart.
The content digest is also verified, not just recorded:
verify re-hashes the workflow file named in the checkpoint and compares it
with the recorded digest. A workflow edited after the run is a
verification finding — ✗ workflow content check: workflow changed since
the run … and exit code 1, exactly like a drifted output checksum. A
workflow missing or unreadable at its recorded path (e.g. a relocated
checkpoint) is reported as unverifiable without failing, so the
output-checksum audit stays usable. Two runs of the same file invoked with
different --arg overrides share the raw digest but never the
override-aware workflow_resolved_hash fingerprint also stored in the
checkpoint — a run-to-run identity label (see
Workflow Versioning). The same fields appear
in the --json verify document (workflow_git_sha,
workflow_content_hash, workflow_resolved_hash, workflow_content_check
with status matched/changed/unverifiable, workflow_git_dirty).
The content check covers the workflow file's bytes only. A rule's
declared script = file is content-fingerprinted — the checkpoint's
rule_fingerprints now carries a script-sensitive identity — and pinned
by the workflow lock (LOCK-008), but provenance verify does not
re-derive rule fingerprints, so by itself it cannot tell that a script
body changed after the run. A verify-time check could re-derive the
recorded fingerprint from the workflow file, the resolved config, and the
referenced script files — lighter than adding a new checkpoint field —
but binding script digests into the portable attestation is a versioned
artifact change and is not done here. Audit script identity with
oxo-flow lock --check (CI) or run --locked (enforced runs), which fail
closed on an in-place edit.
A workflow with a metadata table or a [workflow.metadata_schema] contract
also records a canonical metadata digest:
sha256:<hex> over the resolved typed schema plus the effective metadata
rows. Values are canonicalized per declared column type before hashing
(integer/float re-formatted, boolean lowercased, strings trimmed with case
preserved), empty values are omitted, and rows are sorted by
(id, canonical values) with columns by name. It is byte-stable across
TSV/CSV/JSON sources carrying the same logical rows under those types and
across input row order (including duplicate-id tables), so it names which
typed table the run consumed (and it is folded into
workflow_resolved_hash). Verify reports it as metadata_digest (human:
• metadata digest: …; absent for legacy checkpoints and contract-free
workflows) but does not re-hash the metadata file: re-deriving it needs
the exact loaded table bytes, which the checkpoint does not store — the
digest is a recorded identity, like workflow_resolved_hash, not a
re-verified claim.
A run executed under an enforced workflow lock also records
the verified lock's lock_digest in its checkpoint and folds it into
workflow_resolved_hash; verify reports it as • workflow lock digest: …
and as the lock_digest key in the --json document. The key is absent
(never null) for runs without a lock, so pre-lock verify documents keep
their exact byte shape. The digest proves the lock document's fields were
the ones hashed together — not that a trusted party authored them; see
lock.
This is essential for reproducible, auditable analysis.
Options#
| Option | Description |
|---|---|
-v, --verbose |
Enable verbose (debug-level) logging |
--quiet |
Suppress informational output — the version banner is omitted; the verification report, errors, and warnings are unaffected (verified: output is byte-identical with --quiet) |
--no-color |
Disable colored output |
--json |
Output machine-readable JSON to stdout |
--ignore <GLOB> |
Repeatable. Exclude outputs whose checkpoint-relative path matches this shell-style glob from the verdict. * does not cross /; ** matches recursively. Matched files are reported as ignored and never count as matched/mismatched/missing — the recorded checksum itself is untouched |
Examples#
# Generate a provenance-tracked run
oxo-flow run workflow.oxoflow --provenance
# Verify output integrity
oxo-flow provenance verify .oxo-flow/checkpoint.json
# Exclude non-deterministic reports (e.g. fastp HTML carrying timestamps)
oxo-flow provenance verify .oxo-flow/checkpoint.json --ignore 'qc/*.fastp.html'
Output#
Provenance Verify .oxo-flow/checkpoint.json
• workflow git HEAD: 3f2a1c9d8b7e6f5a4c3d2e1f0a9b8c7d6e5f4a3b
• workflow path: /home/user/proj/pipeline.oxoflow
• cluster images: 2 rule(s)
• align: image biocontainers/bwa:0.7.17 (biocontainers/bwa:0.7.17) — biocontainers/bwa@sha256:abc123...
• report: system environment (no wrapper), pod base image ubuntu:latest
• workflow content hash: sha256:e3b0c442...
• workflow git tree: clean
• workflow content check: verified (sha256:e3b0c442...)
✓ output/sample1.vcf sha256:abc123...
✓ output/sample2.vcf sha256:def456...
✗ output/report.html (expected: sha256:xxx, actual: sha256:yyy)
✓ .oxo-flow/chunks/chr/chr1.g.vcf.gz sha256:ccc... (cleaned by design)
Summary: 2 matched, 1 mismatched, 0 missing, 1 cleaned (by design)
The cluster images block appears only on checkpoints written by a
Kubernetes cluster run (see Cluster image identity).
Excluding non-deterministic outputs#
Some tools write the run time into their reports (fastp embeds a
timestamp and duration in its HTML JSON), so the same input and parameters
produce a different sha256 on every run. --ignore <GLOB> (repeatable)
excludes matching outputs at VERIFICATION time:
- qc/CTR1-1.fastp.html (ignored by --ignore)
✓ P1/matrix.tsv sha256:…
Summary: 23 matched, 0 mismatched, 0 missing, 6 ignored by --ignore
Exclusion is verification-time only — the checkpoint keeps the recorded
digests and provenance attest/diff keep seeing every entry. A malformed
glob is a usage error (non-zero exit) before any file is read, never a
silent no-op. With --json, the verify document gains "ignored" (the
count) and "ignored_files" (sorted) only when --ignore was supplied,
so a verify without the flag keeps its exact prior bytes. Glob semantics are
shell-style: * does not cross /; use ** for recursive matches.
Cluster image identity#
A cluster run on the Kubernetes backend records, per planned rule, the
container image its job was to run as. The record is written
before submission (so a crashed driver still leaves it); if the run aborts
before a job leaves, it names what that job would have run as. The checkpoint
field is cluster_images; verify prints it and --json carries it verbatim.
Each record has:
render—image(the rule's container environment WAS the pod image),wrapper-fallback(the local environment wrapper stayed folded into the command; no image identity is claimed for that environment), orsystem(the rule declares no environment at all, so there is no wrapper to fall back to).kind— the backend that supplied the environment (docker,singularity,conda, …).spec— the workflow-declared container reference. Mirror-neutral: it keeps the original spec even whenOXO_REGISTRY_MIRRORSrewrote the transport.image— the reference the Job'simage:field carries (mirrors applied; the pod base image for a fallback).resolved_digest— present only when the submit host's local docker daemon could report the image digest offline. Absent means "not resolved on the submit host", which verify states explicitly. It is never an invented digest, and it does not prove what a compute node actually pulled — that requires node-side inspection, which this record deliberately does not claim.
The record is additive: checkpoints written by local/HPC runs or older
releases omit the field and load unchanged. It is checkpoint-level evidence;
the portable attestation (provenance attest) binds the environment through
environment.env_lock_identity, which is unchanged (a container rule records
docker|<digest-or-unresolved> there) — cluster_images is not copied into
the attestation document.
Notes#
- Runs inside a git repository record the workflow's HEAD commit SHA in
the checkpoint;
verifyprints it next to the workflow path so each result set is auditable to its workflow version. Runs outside a git repository omit the line — the field is simply absent. - Checksums are stored only when
--provenanceis passed tooxo-flow run. - File checksums use streaming I/O (64KB buffer) to handle large files (BAM, FASTQ >100GB) without excessive memory usage.
- Mismatches and missing files exit with code 1 (useful for CI/CD pipelines).
- A workflow file whose bytes no longer match the recorded
workflow_content_hashalso exits with code 1: the digest is re-checked on every verify path, checksum coverage or not. An unverifiable file (missing/unreadable at its recorded path) is reported without failing — the output-checksum audit stays usable on relocated checkpoints. - Output paths are resolved against the checkpoint's recorded
workdir(the directory the run executed in), not the checkpoint's own directory — so the checkpoint can live anywhere (e.g..oxo-flow/on the run host while outputs are read from the recorded run directory). For legacy checkpoints without aworkdirfield, the checkpoint's parent directory is used. - Transform chunk intermediates deleted by
transform.cleanup = trueat the end of a successful run are recorded undercleaned_checksumsand reported ascleaned (by design)— they are excluded from the missing/mismatched counts and never fail verification. The cleaned count appears in the summary only when the checkpoint has any. Checkpoints written by releases ≤ 0.17.1 record chunks underchecksumsand still report them missing after cleanup — the distinction exists only in checkpoints written by newer binaries.
Verify without stored checksums#
When the checkpoint contains no checksums (the run was executed without
--provenance), verify degrades to a status summary: it prints a
note explaining that checksum tracking was not enabled and lists the
completed rules from the checkpoint, then exits with code 0. This keeps
provenance verify safe to run on any checkpoint while signaling clearly
that integrity was not verified. The workflow content check
is the one exception: it runs on this path too, and a workflow whose bytes
no longer match the recorded digest still exits with code 1.
Provenance Verify .oxo-flow/checkpoint.json
Note: No stored checksums found. Run workflow with --provenance to enable tracking.
Found completed rules: 3
✓ align
✓ sort_bam
✓ trim_reads
Hint: To verify integrity, provide a checksums file.
To get real integrity verification, re-run with --provenance.
JSON output#
With --json, the verification document is written to stdout (stdout
carries nothing else):
{
"command": "provenance",
"verify": {
"checkpoint": "/path/to/.oxo-flow/checkpoint.json",
"matched": 2,
"mismatched": 1,
"missing": 0,
"cleaned": 1,
"entries": [
{"file": "output/sample1.vcf", "status": "matched", "expected": "sha256:abc123...", "actual": "sha256:abc123..."},
{"file": "output/report.html", "status": "mismatched", "expected": "sha256:xxx", "actual": "sha256:yyy"},
{"file": ".oxo-flow/chunks/chr/chr1.g.vcf.gz", "status": "cleaned", "expected": "sha256:ccc..."}
],
"cluster_images": {
"align": {
"render": "image",
"kind": "docker",
"spec": "busybox:1.36",
"image": "busybox:1.36",
"resolved_digest": "busybox@sha256:abc123..."
},
"qc": {
"render": "wrapper-fallback",
"kind": "conda",
"spec": "",
"image": "ubuntu:latest"
}
},
"workflow_content_hash": "sha256:e3b0c442...",
"workflow_resolved_hash": "sha256:9f86d081...",
"metadata_digest": "sha256:6b1d3c7f...",
"lock_digest": "sha256:0d5a7e21...",
"workflow_content_check": {"status": "matched", "recorded": "sha256:e3b0c442...", "actual": "sha256:e3b0c442..."}
}
}
entries is byte-stable: stored files first in sorted path order, then
cleaned files in sorted path order. workflow_content_check is null
when the checkpoint records no content digest (legacy checkpoints);
status is matched (file re-hashes to the recorded digest), changed
(bytes moved since the run — exit code 1), or unverifiable (missing or
unreadable at its recorded path — actual omitted, exit code 0).
workflow_resolved_hash is the override-aware run-identity fingerprint
described in Workflow Versioning. When the
checkpoint has no stored checksums, the document is still emitted with a
note field describing the degradation.
Comparing two checkpoints (provenance diff)#
provenance verify checks one checkpoint against the files on disk.
provenance diff compares the recorded output checksums of two
checkpoints — e.g. two runs of the same workflow, or the same workflow on two
hosts. It is the machine-readable primitive for asking whether two runs agree
on every recorded artifact hash, without hand-comparing JSON.
Usage#
diff accepts the same global options as verify (-v/--verbose,
--quiet, --no-color, --json).
Output#
Provenance Diff left/checkpoint.json right/checkpoint.json
✓ output/sample1.vcf sha256:abc123...
✗ output/report.html (left: sha256:xxx, right: sha256:yyy)
- output/only_here.txt (only in left)
+ output/new_in_b.txt (only in right)
Summary: 1 matched, 1 differing, 1 only left, 1 only right
Each checkpoint's checksums and cleaned_checksums maps are merged before
comparison via the same shared merge (merge_recorded_checksums) that
report --diff uses, so the two surfaces can never classify the same input
pair differently — a chunk moved into the cleaned bucket is a bookkeeping
change, not a file change, and its merged value carries the (cleaned by
design) annotation, so a mixed pair (recorded under checksums on one side,
cleaned_checksums on the other) reads as differing, not a spurious
matched. When a checkpoint has no embedded checksums object, diff falls
back to the same legacy companion checkpoint.checksums.json file
provenance verify reads. Artifacts are partitioned into four classes:
matched— present in both, identical checksums.differing— present in both, different checksums.only_left/only_right— recorded on one side only.
Exit code#
diff exits 0 when every recorded artifact agrees, and nonzero when any
artifact differs or is recorded on only one side — so CI can gate on artifact
agreement directly.
JSON output#
With --json, the document is written to stdout (stdout carries nothing else;
the human table stays on stderr):
{
"command": "provenance",
"diff": {
"left": "/path/to/left/checkpoint.json",
"right": "/path/to/right/checkpoint.json",
"matched": 1,
"differing": 1,
"only_left": 1,
"only_right": 1,
"entries": [
{"artifact": "output/sample1.vcf", "status": "matched", "left": "sha256:abc...", "right": "sha256:abc..."},
{"artifact": "output/report.html", "status": "differing", "left": "sha256:xxx", "right": "sha256:yyy"},
{"artifact": "output/only_here.txt", "status": "only_left", "left": "sha256:zzz"},
{"artifact": "output/new_in_b.txt", "status": "only_right", "right": "sha256:www"}
]
}
}
entries is byte-stable (sorted artifact path order). A missing or malformed
checkpoint is a clear error (nonzero exit), never a panic.
Portable run attestations (provenance attest)#
A run's evidence lives in its own checkpoint.json. oxo-flow provenance
attest binds the recorded pieces into one canonical, portable document —
oxo-flow.attestation/v1 — that can be handed to another party and,
optionally, signed.
Usage#
# Unsigned document (JSON on stdout)
oxo-flow provenance attest .oxo-flow/checkpoint.json --json
# Signed, written to a file
openssl rand -hex 32 > attest.key # or any 32-byte / 64-hex seed
oxo-flow provenance attest .oxo-flow/checkpoint.json \
--sign --key attest.key -o run.attestation.json
# Verify (exit 0 valid, 2 invalid signature, 3 key mismatch, 4 malformed)
oxo-flow provenance attest-verify run.attestation.json --key attest.key --json
CHECKPOINT may be a checkpoint file or a run workdir containing
checkpoint.json / .oxo-flow/checkpoint.json.
What the document binds#
workflow: path, git HEAD SHA, dirty marker, raw content digest, the override-aware resolved fingerprint, the canonical metadata digest of the typed cohort table when one was consumed, and — additively, only when the run was lock-enforced — the verified workflowlock_digestincludes: recorded include checkout SHAs (repo@ref → HEAD)config: the resolved config snapshot; sensitive values are already SHA-256 digests in the checkpoint, never plaintextinputs: recorded input manifests (rule:path→ hash, or size/mtime fallback for large/legacy files)outputs/cleaned_outputs: recorded per-artifact SHA-256 checksums, with intentionally cleaned temporary outputs kept separateenvironment: recorded environment identity mapoutcome: completed/failed rules and the derived statuscheckpoint.format_version
All maps are key-ordered, so emitting twice yields byte-identical output.
What it does NOT bind#
- Biological correctness of any output, or the presence of files on another machine.
- Legal or regulatory qualification, and no PKI/key-service identity: a valid signature proves these bytes were signed by the key that verifies it, not who holds that key.
Signing#
Ed25519 over the document with its signature field removed; the document
carries {alg, public_key, signature} (hex). --sign requires an explicit
--key file (64 hex characters or 32 raw bytes) — the command never mints
key material silently.
Exit codes (attest-verify)#
| Code | Meaning |
|---|---|
| 0 | Signature valid, or document unsigned (signature_status: "unsigned") |
| 2 | Signature invalid — the signed bytes changed |
| 3 | Key mismatch — --key names a different signer than the document |
| 4 | Malformed/unreadable document, or an unknown format tag |
JSON output#
--json prints {command, file, signature_status, format, workflow_content_hash,
outcome_status} on stdout; the human report stays on stderr.
See Also#
- oxo-flow run — use
--provenanceto enable checksum tracking; the run log (.oxo-flow/logs/oxo-flow.log) and report snapshots carry the same workflow version header - REPRODUCIBILITY.md