Expand description
Report-to-report comparison for the diff subcommand.
Reads utf8-forge JSON reports that carry a files[] array and compares
per path: added, removed, and changed (action or byte-count drift).
A report without a files array is not a report and fails to parse, so a
mistyped input path can never masquerade as an empty baseline. Paths are
compared relative to each report’s root (the root prefix is stripped,
separators normalized to /), so the same tree scanned under two
different roots diffs clean; a differing root field triggers a warning,
not an error. Unknown JSON fields are ignored (lenient deserialization).
Structs§
- Changed
Entry - One common path whose record drifted.
- Diff
Input - Lenient view of a whole report.
filesis required: any JSON object without it (or a bare JSON array) is rejected as not-a-report. - Diff
Input File - Lenient view of one report row (also serialized into the diff output).
- Diff
Report - The
diffoutput document (a new document type, not the run report). - Diff
Summary - Counts for the diff summary.
Functions§
- compare
- Compare two parsed reports. Duplicate paths within one report resolve to the last occurrence (the tool never produces duplicates; sorted unique by construction). Arrays are sorted by path.
- relativize_
files - Rewrite each record path relative to the report’s
root: separators are normalized to/and the root prefix (always with its trailing separator) is stripped. Records whose path does not start with the root are kept verbatim. Paths in the diff output are therefore root-relative and stable across root spellings, which is what makes two scans of the same tree under different roots comparable.