Skip to main content

Module snapshot_diff

Module snapshot_diff 

Source
Expand description

Two snapshots compared (RFC 13 §4.4; #219): by key, facet by facet, bounded, with both spans carried through untouched.

Pure: two Snapshots in hand become one SnapshotDiff. The value facet goes through the same two-level comparison the History pane runs (crate::model::diff) — structural where both sides have a structural form, bytes otherwise, and which one ran is never hidden. The other facets (verdict, registration, holder) are compared whole and reported only where they differ, so a consumer that reads a KeyChange reads exactly the facets that moved and nothing that did not.

Two entry points, one comparison. diff_snapshots keys on the wire key verbatim and leaves the alignment fields not asked. diff_normalized (#220) takes a MapPlan — which host in b is which host in a — rewrites b onto a’s origins and base, runs the same comparison, and rolls it up per subject, so a fleet-wide drift reads as one line (“sysinfo/cpu/usage differs on 3 of 12 origins”) rather than N. It refuses over an incomplete plan: an origin the plan could not pair is listed, never dropped (RFC 13 §4.4), and no comparison is made over it, because a diff that quietly compared the rest would let “it works in staging” survive on the keys it skipped.

Structs§

DiffOpts
The two bounds a diff runs under (RFC 09 §5.1 O6 — a bound that hides data says so).

Functions§

diff_normalized
Compare a against b with b’s origins read through plan, and roll the result up per subject.
diff_snapshots
Compare a against b, key by key.