Skip to content

diff-test: summarize changes per field (depth=2) in final output #702

@caugner

Description

@caugner

Description

Extend diff-test's final summary line so that — when there are changes — it also reports a breakdown of changed fields aggregated at depth 2 of the JSON path.

Currently the output looks like:

Took: 15.082626564s - 0 changes in 0 of 14409 files (0.0%)

When changes exist, it would be useful to also see something like:

Field summary (files affected):
  doc.body          1234
  doc.flaws          456
  doc.summary         12
  ...

Aggregation rule: multiple changes within the same depth-2 subtree on a single page count as 1 for that page (e.g. several diffs under doc.flaws.*doc.flaws += 1 for that file).

Motivation

Makes it easier to understand the shape of a regression at a glance, without opening the HTML/CSV report.

Implementation notes

  • The per-file diff in full_diff already produces dotted JSON-path keys in a BTreeMap<String, String>.
  • Add a shared counter map (DashMap<String, AtomicUsize>) next to same / total_changes.
  • After each full_diff call (in both the --value HTML branch and the --csv branch), compute the HashSet of depth-2 prefixes from diff.keys() and increment the counter once per prefix.
  • Print the sorted summary (descending by count) after the existing Took: … line.
  • The non-value HTML branch doesn't call full_diff, so the summary should be gated on --value or --csv.
  • Note that IGNORED_KEYS currently excludes doc.flaws, doc.modified, doc.popularity, etc., so those won't appear in the summary unless removed from that list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions