Skip to content

test(ls): cover alias recursive listing mode#75

Draft
overtrue wants to merge 1 commit intomainfrom
codex/ls-recursive-alias-test-gap
Draft

test(ls): cover alias recursive listing mode#75
overtrue wants to merge 1 commit intomainfrom
codex/ls-recursive-alias-test-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

A recent ls behavior change made rc ls <alias>/ --recursive traverse every bucket and list objects server-wide, but that alias-only recursive branch had no direct unit coverage. That left the command selection logic unguarded even though it changed user-visible behavior.

User Impact

If that branch regresses, ls alias/ -r can silently fall back to bucket listing instead of object listing. Users would still get successful output, but it would be the wrong mode and the regression would be easy to miss.

Root Cause

The branch that distinguishes alias-only bucket listing from alias-only recursive object listing lived inline inside execute, so the changed path was only indirectly exercised. Existing tests covered path parsing, but not the mode decision introduced by the recent -r behavior change.

Fix

This PR extracts the alias-only listing decision into a small alias_listing_mode helper and adds focused unit tests for the three relevant cases:

  • alias-only path with --recursive selects all-object listing
  • alias-only path without --recursive selects bucket listing
  • bucket-qualified paths bypass the alias-only branch entirely

The implementation behavior is unchanged; the refactor is only there to make the recent branch testable and keep the scope tight to the changed area.

Validation

I ran the required checks locally:

  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

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