Skip to content

fix(tui): sort credentials case-insensitively and sort the main table - #139

Merged
arimxyer merged 3 commits into
mainfrom
fix/tui-case-insensitive-sort
Jul 1, 2026
Merged

fix(tui): sort credentials case-insensitively and sort the main table#139
arimxyer merged 3 commits into
mainfrom
fix/tui-case-insensitive-sort

Conversation

@arimxyer

@arimxyer arimxyer commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

The credential list in the TUI didn't sort the way users expect:

  • 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 next to AWS.
  • The main table didn't sort at all, rendering in map-iteration (effectively random) order and disagreeing with the sidebar.

This adds a shared case-insensitive lessFold comparator (with a case-sensitive tie-break so entries differing only in case stay deterministic) and applies it to:

  • the sidebar category sort (sidebar.go)
  • the in-category credential sort (sidebar.go)
  • the main table's Refresh() (table.go)

Ordering is now consistent between the sidebar and the table, and case no longer affects placement (AWS, azure, Database, GitHub).

Test

TestCredentialTablePopulateRows now asserts sorted order and includes a lowercase azure entry 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

arimxyer and others added 2 commits July 1, 2026 16:31
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
@arimxyer
arimxyer merged commit df6b730 into main Jul 1, 2026
7 checks passed
@arimxyer
arimxyer deleted the fix/tui-case-insensitive-sort branch July 1, 2026 21:12
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>
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