Skip to content

diff --stats follow-up: size_added/size_removed naming, JSON docs, test timing - #10339

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:diff-stats-followup
Sep 8, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:diff-stats-followup

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Follow-up to #10327 (#796), addressing three review findings:

  • Naming: "Added chunk volume" / "Removed chunk volume" and the JSON keys
    added_chunk_volume / removed_chunk_volume introduced new vocabulary for a quantity the rest of
    borg diff already names: the totals are the sums over all reported items of the per-path
    added / removed byte counts, i.e. of what --sort-by size_added / size_removed sorts by.
    The lines are now "Added size" / "Removed size" and the JSON keys size_added / size_removed.
    diff: add --stats, showing a summary of the differences #10327 is unreleased, so nothing depends on the old names.
  • Frontend docs: docs/internals/frontends.rst documents the borg diff --json-lines output for
    frontend authors, but did not mention the --stats summary line yet. It now describes the
    {"stats": {...}} line and its six keys, with an example matching the existing one.
  • Test timing: test_stats_counts_metadata_only_changes expects the input directory to be reported
    as changed (mtime/ctime), which requires the two archives to be created on different timestamp ticks.
    The setup helper did not call granularity_sleep() like the other tests in the file do; on HFS+
    (whole-second timestamps) the test failed 8 out of 8 runs with "Changed items: 2". It now sleeps
    between the two archives.

Verified locally: ruff and black, the diff test module (26 passed, binary variants skipped), and a
warning-free Sphinx build of the docs.

🤖 Generated with Claude Code

…the JSON stats line

Rename the "Added chunk volume" / "Removed chunk volume" summary lines to
"Added size" / "Removed size" and the JSON keys added_chunk_volume /
removed_chunk_volume to size_added / size_removed. These totals are the sums
over all reported items of what the per-path output calls "added" / "removed"
and what --sort-by size_added / size_removed sorts by, so use that existing
vocabulary instead of introducing a new one. borgbackup#10327 was not released yet, so
nothing depends on the old names.

Document the --stats summary line of borg diff --json-lines in
docs/internals/frontends.rst, which describes the JSON Lines output for
frontends but did not mention it.

Also add a granularity_sleep() between the two archives of the diff --stats
tests: test_stats_counts_metadata_only_changes expects the input directory to
be reported as changed (mtime/ctime), which fails on filesystems with
whole-second timestamps (reproduced on HFS+: "Changed items: 2" instead of 3)
when both archives are created within the same second. The other tests in that
file already sleep there.

Follow-up to borgbackup#10327 (borgbackup#796).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.79%. Comparing base (366db25) to head (b4ae613).
⚠️ Report is 27 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10339      +/-   ##
==========================================
- Coverage   87.80%   87.79%   -0.01%     
==========================================
  Files         103      103              
  Lines       18828    18868      +40     
  Branches     2906     2914       +8     
==========================================
+ Hits        16531    16566      +35     
- Misses       1598     1599       +1     
- Partials      699      703       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann merged commit 245d1ea into borgbackup:master Sep 8, 2026
24 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the diff-stats-followup branch September 8, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant