Skip to content

Sort principals alphabetically by name instead of ID (resolves #238)#596

Merged
kmcquade merged 1 commit into
masterfrom
fix/principal-sorting
Jun 14, 2026
Merged

Sort principals alphabetically by name instead of ID (resolves #238)#596
kmcquade merged 1 commit into
masterfrom
fix/principal-sorting

Conversation

@kmcquade

Copy link
Copy Markdown
Collaborator

Sorts the principals page alphabetically by name instead of by the opaque IAM ID. Resolves #238.

getPrincipalIds() previously returned Object.keys(...).sort() — i.e. sorted by the underlying IAM ID (AROA…/AIDA…), which renders as an apparently-random order in the UI. It now sorts by each principal's .name (case-insensitive localeCompare, falling back to the ID when a name is absent).

Credit / provenance

Supersedes #557 by @nikhil6393 — their commit and authorship are preserved here. I rebased it onto current master and made two maintainer adjustments:

  1. Updated the test for the enriched dataset. Master's example data was expanded (feat: enrich example dataset for a high-quality demo report + lock fixtures in sync #583) and principals-test.js now uses membership assertions. Rather than reverting to the old 2-element exact list, this keeps the membership assertion and adds a real ordering check: it re-derives the principal names in the returned order and asserts they're non-decreasing (mirroring the implementation's comparator). That fails on the old ID-sort and passes on the new name-sort, so it actually covers Principals page should list IAM roles/groups/users in alphabetical order #238.
  2. Dropped the pyproject.toml uv-version hunk. It relaxed ~=0.10.0>=0.10.0, but master is already at >=0.11.0, so it's obsolete.

Notes

Tests

just test-js → 47 passing, including getPrincipalIds.

🤖 Generated with Claude Code

@kmcquade kmcquade merged commit acfe2de into master Jun 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Principals page should list IAM roles/groups/users in alphabetical order

2 participants