Skip to content

Sort Local Files folder and track names case-insensitively - #906

Merged
LargeModGames merged 2 commits into
LargeModGames:mainfrom
niukanen1:local-files-sort-824
Oct 21, 2026
Merged

LargeModGames merged 2 commits into
LargeModGames:mainfrom
niukanen1:local-files-sort-824

Conversation

@niukanen1

@niukanen1 niukanen1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The Local Files source sorted folder names and the name fallback for untagged tracks by raw byte order, so every capital letter came before every lowercase one: abba/, Beatles/ and Zappa/ listed as Beatles, Zappa, abba, and an untagged Track.mp3 sorted before another.mp3.

Both sorts now compare lowercased names, with the original byte order as a stable tiebreak so two names that differ only in case keep a deterministic order. The (root) entry stays first, subdirs.sort() in collect_audio_dirs is untouched (it only decides walk order), and relative_display_name is not changed, so this does not overlap with #621 beyond touching the same file.

Fixes #824

Summary by CodeRabbit

  • Bug Fixes
    • Local Files folders, playlists, and tracks are now sorted case-insensitively for more consistent ordering.
    • Untagged tracks now use their names for sorting when other metadata is unavailable.
    • Names with matching letter casing are ordered predictably using byte-level tie-breaking.
  • Documentation
    • Updated the unreleased changelog to document the improved Local Files and track sorting behavior.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6c8b21be-1e03-4499-837b-b6b91af3e40b
📥 Commits

Reviewing files that changed from the base of the PR and between 3b0607d and 28207ab.

📒 Files selected for processing: 1
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes: 1
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

Local playlist and track sorting now compares names without regard to case, then uses byte order to break ties. Tests cover the comparator, playlist ordering, and untagged track ordering. The changelog documents the updated behavior.

Changes: Local name ordering

Layer / File(s) Summary
Comparator, sorting, tests, and documentation
src/infra/local/mod.rs, CHANGELOG.md
A case-insensitive name comparator uses byte order to break ties. Playlist and track sorting use the comparator. Tests verify comparator behavior, playlist ordering, and untagged track ordering. The changelog records the updated sorting behavior.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 28207

No actionable merge-blocking issue is identified; merge after the normal checks.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Title check Warning The title accurately describes the sorting change and uses an imperative subject, but it does not use a required conventional-commit prefix. Rename the title with an approved prefix, for example: "fix: sort Local Files folders and track names case-insensitively".
Passed Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Issue #824 requires case-insensitive ordering for Local Files folders and untagged track-name fallbacks. src/infra/local/mod.rs adds name_order with lowercased comparison and original byte-order t…
Out of Scope Changes check Passed The reported changes are limited to src/infra/local/mod.rs and a CHANGELOG.md entry. The source changes implement issue #824 and add supporting tests. The changelog entry documents the implemented…
Full details: Linked Issues check

Explanation

Issue #824 requires case-insensitive ordering for Local Files folders and untagged track-name fallbacks. src/infra/local/mod.rs adds name_order with lowercased comparison and original byte-order tie-breaking. Playlist and track sorting use this comparator. Tests cover the comparator, folder ordering, and untagged-track ordering. The reported changes preserve (root) placement and leave traversal sorting and relative_display_name unchanged.

Full details: Out of Scope Changes check

Explanation

The reported changes are limited to src/infra/local/mod.rs and a CHANGELOG.md entry. The source changes implement issue #824 and add supporting tests. The changelog entry documents the implemented behavior. No unrelated traversal, display-name, natural-sort, or numeric-sort changes are reported.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LargeModGames LargeModGames left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a Fixed line under ## [Unreleased] in CHANGELOG.md for the new sort order. The code and tests match the issue, so I'll merge after that.

Both sorts compared names by raw byte order, so every capital letter
sorted before every lowercase one and mixed-case libraries looked
unsorted. The folder list and the name fallback for untagged tracks now
compare lowercased names, with byte order as a stable tiebreak.

Fixes LargeModGames#824
@niukanen1
niukanen1 force-pushed the local-files-sort-824 branch from 016c7fa to 3b0607d Compare October 21, 2026 04:37
@niukanen1

Copy link
Copy Markdown
Contributor Author

Added a Fixed line under Unreleased, commit 3b0607d.

@LargeModGames
LargeModGames merged commit ff4ed14 into LargeModGames:main Oct 21, 2026
32 checks passed
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.

Local Files: folders sort uppercase first, so abba lands after Zappa

2 participants