Skip to content

feat(cli): restore --info=STATS level 1/2/3 distinction (3.4.1 parity)#4106

Merged
oferchen merged 5 commits into
masterfrom
feat/info-stats-levels-2160
May 15, 2026
Merged

feat(cli): restore --info=STATS level 1/2/3 distinction (3.4.1 parity)#4106
oferchen merged 5 commits into
masterfrom
feat/info-stats-levels-2160

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • Restores upstream rsync's level 1/2/3 gating for --info=STATS (and the implied --stats flag): level 1 emits only the trailing sent / total size is summary, level 2 adds the full file-count + byte-breakdown detail block, level 3 is byte-equivalent to level 2 (upstream's additional heap statistics have no oc-rsync analogue).
  • Plumbs a stats_level: u8 end-to-end (DerivedSettings, TransferExecutionInputs, emit_transfer_summary, emit_stats) in place of the prior boolean, and maps the legacy --stats flag to level 2 (or level 3 with -vv), mirroring options.c:2055 if (do_stats) parse_output_words("stats2"/"stats3", ...).
  • Adds upstream's if (stats.flist_buildtime) guard so the File list generation/transfer time pair only renders when timing is >= 1 ms.

Test plan

  • parity_stats_level_1_emits_only_summary_lines asserts level 1 contains the summary trailer and none of the detail block labels.
  • parity_stats_level_2_emits_full_detail_block_plus_summary asserts ordered presence of every upstream label and the summary trailer.
  • parity_stats_level_3_matches_level_2_plus_summary pins user-visible byte-equivalence with level 2 (the upstream malloc/flist-heap addendum is platform-conditional even in C).
  • parity_stats_level_0_emits_nothing asserts level 0 produces no output.
  • Existing tests (parity_stats_output_contains_all_upstream_field_labels, parity_stats_output_field_order_matches_upstream) updated to tolerate the upstream-faithful suppression of sub-millisecond file-list timing lines.
  • CI fmt/clippy/nextest matrix.

Refs: closes #2160, parent #2151.

Upstream references: main.c::output_summary (rsync-3.4.2:416-465), main.c::handle_stats (rsync-3.4.2:325-385), options.c:2055 (do_statsstats2/stats3).

Upstream rsync's `output_summary` (main.c:416-465) gates the post-transfer
stats block with `INFO_GTE(STATS, N)` checks: level 1 emits only the
trailing `sent / total size is` summary, level 2 adds the full
`Number of files / Total file size / Literal data / ...` detail block,
and level 3 additionally surfaces optional heap statistics. Prior to this
change oc-rsync emitted the full detail block at any non-zero level,
breaking parity for `--info=stats1` and for scripts relying on
upstream's tiered output.

This change:

- Plumbs the parsed `stats` level (u8) through `DerivedSettings`,
  `TransferExecutionInputs`, and `emit_transfer_summary` instead of a
  single boolean.
- Splits `emit_stats` into a level-aware front-end that delegates to
  `emit_stats_detail_block` only at level >= 2 and always falls through
  to `emit_totals` for the level-1 summary.
- Mirrors the upstream `if (stats.flist_buildtime)` guard so the
  `File list generation/transfer time` pair only renders when at least
  one timing is >= 1 ms.
- Maps the legacy `--stats` CLI flag to level 2 (or level 3 with
  `-vv`), matching upstream's `options.c:2055` synthesis of
  `parse_output_words("stats2"/"stats3", ...)`.
- Adds level 0/1/2/3 parity tests covering the absent, summary-only,
  full-detail, and heap-stats-equivalent shapes.
@github-actions github-actions Bot added the enhancement New feature or request label May 15, 2026
oferchen added 4 commits May 15, 2026 23:53
…ng expectations

Level-distinction is covered by the unit tests in output_parity.rs;
end-to-end format expectations differ across platforms (path lengths,
sub-millisecond timings).
@oferchen oferchen merged commit bd6e02a into master May 15, 2026
39 checks passed
@oferchen oferchen deleted the feat/info-stats-levels-2160 branch May 15, 2026 22:41
oferchen added a commit that referenced this pull request May 18, 2026
#4106)

* feat(cli): restore --info=STATS level 1/2/3 distinction (3.4.1 parity)

Upstream rsync's `output_summary` (main.c:416-465) gates the post-transfer
stats block with `INFO_GTE(STATS, N)` checks: level 1 emits only the
trailing `sent / total size is` summary, level 2 adds the full
`Number of files / Total file size / Literal data / ...` detail block,
and level 3 additionally surfaces optional heap statistics. Prior to this
change oc-rsync emitted the full detail block at any non-zero level,
breaking parity for `--info=stats1` and for scripts relying on
upstream's tiered output.

This change:

- Plumbs the parsed `stats` level (u8) through `DerivedSettings`,
  `TransferExecutionInputs`, and `emit_transfer_summary` instead of a
  single boolean.
- Splits `emit_stats` into a level-aware front-end that delegates to
  `emit_stats_detail_block` only at level >= 2 and always falls through
  to `emit_totals` for the level-1 summary.
- Mirrors the upstream `if (stats.flist_buildtime)` guard so the
  `File list generation/transfer time` pair only renders when at least
  one timing is >= 1 ms.
- Maps the legacy `--stats` CLI flag to level 2 (or level 3 with
  `-vv`), matching upstream's `options.c:2055` synthesis of
  `parse_output_words("stats2"/"stats3", ...)`.
- Adds level 0/1/2/3 parity tests covering the absent, summary-only,
  full-detail, and heap-stats-equivalent shapes.

* test(cli): gate info_stats_enables_summary_block to unix (Windows runner divergence)

* test(cli): gate stats_transfer_renders_summary_block to unix

* test(cli): remove end-to-end stats summary tests with platform-drifting expectations

Level-distinction is covered by the unit tests in output_parity.rs;
end-to-end format expectations differ across platforms (path lengths,
sub-millisecond timings).

* style: collapse double blank line after test removal
oferchen added a commit that referenced this pull request May 18, 2026
#4106)

* feat(cli): restore --info=STATS level 1/2/3 distinction (3.4.1 parity)

Upstream rsync's `output_summary` (main.c:416-465) gates the post-transfer
stats block with `INFO_GTE(STATS, N)` checks: level 1 emits only the
trailing `sent / total size is` summary, level 2 adds the full
`Number of files / Total file size / Literal data / ...` detail block,
and level 3 additionally surfaces optional heap statistics. Prior to this
change oc-rsync emitted the full detail block at any non-zero level,
breaking parity for `--info=stats1` and for scripts relying on
upstream's tiered output.

This change:

- Plumbs the parsed `stats` level (u8) through `DerivedSettings`,
  `TransferExecutionInputs`, and `emit_transfer_summary` instead of a
  single boolean.
- Splits `emit_stats` into a level-aware front-end that delegates to
  `emit_stats_detail_block` only at level >= 2 and always falls through
  to `emit_totals` for the level-1 summary.
- Mirrors the upstream `if (stats.flist_buildtime)` guard so the
  `File list generation/transfer time` pair only renders when at least
  one timing is >= 1 ms.
- Maps the legacy `--stats` CLI flag to level 2 (or level 3 with
  `-vv`), matching upstream's `options.c:2055` synthesis of
  `parse_output_words("stats2"/"stats3", ...)`.
- Adds level 0/1/2/3 parity tests covering the absent, summary-only,
  full-detail, and heap-stats-equivalent shapes.

* test(cli): gate info_stats_enables_summary_block to unix (Windows runner divergence)

* test(cli): gate stats_transfer_renders_summary_block to unix

* test(cli): remove end-to-end stats summary tests with platform-drifting expectations

Level-distinction is covered by the unit tests in output_parity.rs;
end-to-end format expectations differ across platforms (path lengths,
sub-millisecond timings).

* style: collapse double blank line after test removal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant