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.
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:
When changes exist, it would be useful to also see something like:
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
full_diffalready produces dotted JSON-path keys in aBTreeMap<String, String>.DashMap<String, AtomicUsize>) next tosame/total_changes.full_diffcall (in both the--valueHTML branch and the--csvbranch), compute theHashSetof depth-2 prefixes fromdiff.keys()and increment the counter once per prefix.Took: …line.valueHTML branch doesn't callfull_diff, so the summary should be gated on--valueor--csv.IGNORED_KEYScurrently excludesdoc.flaws,doc.modified,doc.popularity, etc., so those won't appear in the summary unless removed from that list.