Skip to content

fix(ls): include version summaries in JSON output#165

Open
overtrue wants to merge 1 commit intomainfrom
codex/fix-ls-version-json-summary
Open

fix(ls): include version summaries in JSON output#165
overtrue wants to merge 1 commit intomainfrom
codex/fix-ls-version-json-summary

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Related issue(s)

This change comes from the test-gap detection sweep for recent ls --versions work.

Background

The recent ls --versions implementation added JSON pagination metadata and text-mode summaries, but --summarize still had no effect when the command was used with --json.

For users relying on structured output, that meant the new version-listing path behaved differently from the existing ls --json --summarize object-listing paths, which already expose totals in the response body.

Root cause

The JSON formatter for ls --versions only serialized items, truncated, and pagination markers. It ignored the summarize flag entirely even though the command already computed the same totals for text output.

Solution

The command now includes a version-specific summary block in ls --versions --json --summarize, with total version count and aggregate size. The change stays inside the recent version-listing code path and does not widen behavior outside ls --versions.

The regression coverage adds:

  • a unit test for the JSON formatter summary path
  • an integration test that exercises ls --versions --json --summarize against a versioned object with multiple versions

Validation

  • cargo test -p rustfs-cli ls::tests --lib
  • cargo test --features integration --test integration version_operations::test_ls_versions_json_summary_reports_totals
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review April 29, 2026 21:14
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