fix(tui): sort credentials case-insensitively and sort the main table - #139
Merged
Conversation
The sidebar sorted categories and credentials with a case-sensitive comparison, so lowercase services sorted after all uppercase ones (e.g. "azure" landed after "GitHub" instead of after "AWS"). The main credential table did not sort at all, rendering in map-iteration order and disagreeing with the sidebar. Add a shared case-insensitive `lessFold` comparator (with a case-sensitive tie-break for deterministic ordering) and use it for the category sort, the in-category credential sort, and the main table's Refresh(). Update TestCredentialTablePopulateRows to assert sorted order, including a lowercase entry that locks the case-insensitive behavior. Reported in discussion #89. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kVLjbUL4F4CkoA7RbMYy8
The CLI `list` command sorted by service name (and grouped project / credential names) with a case-sensitive comparison, so its ordering could disagree with the now case-insensitive TUI for mixed-case vaults. Add a `lessFold` helper in the cmd package (mirroring the TUI one) and apply it to the standard list sort, the by-project credential lists, and the project-name ordering so the whole tool agrees on ordering. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kVLjbUL4F4CkoA7RbMYy8
Complete the case-insensitive ordering across the tool. Besides the TUI credential lists and `list` command, several other name lists still used a case-sensitive sort.Strings and could disagree with the rest: - the category list feeding the Add/Edit form dropdowns (models.AppState.updateCategories -> GetCategories) - the service names in `backup preview` output - field-name breakdowns in usage output and the TUI detail panel Route them all through lessFold (adding a copy to the models package, which lacked one) so every ordering in the tool is consistent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014kVLjbUL4F4CkoA7RbMYy8
This was referenced Jul 1, 2026
arimxyer
added a commit
that referenced
this pull request
Jul 2, 2026
Promote the [Unreleased] entries to [0.19.0] and add the two sort PRs that shipped without changelog entries: - TUI sort-by-field toggle (#141) under Added - consistent case-insensitive ordering everywhere (#139) under Fixed 0.19.0 collects the background agent (#116), the env-injection epic (#115: export/inject/exec --env-file/manifest, plus value filters #138), the configurable sync probe timeout (#137), the TUI sort toggle (#141), consistent ordering (#139), and the sync failure-backoff (#133). Claude-Session: https://claude.ai/code/session_014kVLjbUL4F4CkoA7RbMYy8 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The credential list in the TUI didn't sort the way users expect:
azurelanded afterGitHubinstead of next toAWS.This adds a shared case-insensitive
lessFoldcomparator (with a case-sensitive tie-break so entries differing only in case stay deterministic) and applies it to:sidebar.go)sidebar.go)Refresh()(table.go)Ordering is now consistent between the sidebar and the table, and case no longer affects placement (
AWS, azure, Database, GitHub).Test
TestCredentialTablePopulateRowsnow asserts sorted order and includes a lowercaseazureentry that would sort last under the old case-sensitive comparison — locking the case-insensitive behavior as a regression test.mise run build✓mise run vet✓go test ./cmd/tui/...✓golangci-lint run ./cmd/tui/...→ 0 issues ✓Context
Reported in discussion #89. The separate request in that thread to rename/edit a credential's Service (UID) is intentionally not part of this PR — the service is the vault's primary key, so it needs a dedicated re-key flow and will be tracked as its own feature.
🤖 Generated with Claude Code