mdn / mdn/rari

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

Open
#702 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
57
Forks
47
Avg merge
1d 11h
Merged PRs (30d)
68

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/diff-test/src/main.rs, tracing full_diff and the --value HTML and --csv branches where per-file diffs are processed. Add the depth-2 per-file aggregation and confirm that, for those modes and only when changes exist, the sorted field summary appears after the existing Took line.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.