exlab_wizard.sync.verifier#
SHA-256 hash verifier for synced runs. Backend Spec §7.1.4.
After a transport reports success, the job moves to AWAITING_VERIFY.
The verifier walks the local subtree, computes a SHA-256 per file, writes
the manifest to <run>/.exlab-wizard/checksums.sha256 (one sha256
path line per file), and compares against a remote manifest (or against
itself for self-consistency tests).
The on-disk manifest format mirrors the output of the sha256sum UNIX
tool: each line has <hex-sha256> <relative-path>. ingest.json and
the cache spec already reference .exlab-wizard/checksums.sha256;
this module is the writer.
Functions
|
Return the on-disk text form of a manifest. |
|
Parse the on-disk text form of a manifest. |
Classes
|
SHA-256 verifier. |
|
Outcome of a verifier pass. |
- class exlab_wizard.sync.verifier.Verifier[source]#
Bases:
objectSHA-256 verifier. Backend Spec §7.1.4.
- async compute_local_manifest(run_path)[source]#
Walk
run_pathand compute a SHA-256 per file.Writes the manifest to
run_path/.exlab-wizard/checksums.sha256as a side-effect (the §7.1.4 contract). Files inside the.exlab-wizard/cache subtree are excluded so the manifest does not record its own hash.
- async verify_against_local(run_path, manifest)[source]#
Re-hash every entry in
manifestagainst the local subtree.Returns a
VerifyResultwithok=Trueiff every entry in the manifest exists locally with the recorded hash.Files on disk that are NOT in the manifest are returned in
extrafor diagnostic logging but do not by themselves causeok=False; a partial transport that wrote a fresh file would be caught by a later compute_local_manifest pass.- Parameters:
- Return type:
- verify_against_remote(local_manifest, remote_manifest)[source]#
Compare a local manifest against a remote-derived manifest.
Pure dict comparison with no I/O. Use after the transport reports success, with
remote_manifestderived from a remote hash probe (e.g.rclone hashsum sha256orssh ... sha256sum).mismatched: keys present in both with differing hex digests.missing: keys present locally but absent remotely; this is the integrity-in-transit failure mode.extra: keys present remotely but not locally; informational only and does not flipok.ok = not mismatched and not missing. An emptyremote_manifesttherefore yieldsok=Falsewith every local key listed inmissing.
- class exlab_wizard.sync.verifier.VerifyResult(ok, mismatched=(), missing=(), extra=(), manifest=<factory>, error_kind=None)[source]#
Bases:
objectOutcome of a verifier pass.
okis True iff every file in the manifest matched.mismatchedlists relative paths whose hash differed;missinglists paths in the manifest that no longer exist on disk;extralists files on disk that were not in the manifest (informational only).error_kindis set when the remote-hash probe could not complete (the underlyingexlab_wizard.sync.transports.TransportErrorclassified the failure as AUTH / NETWORK / UNKNOWN). The queue worker keys off this field to route via the §7.1.5 retry policy: AUTH -> terminal FAILED, NETWORK / UNKNOWN -> backoff retry.Nonefor every non-remote-probe outcome.- Parameters:
- error_kind: TransportErrorKind | None#