Sort principals alphabetically by name instead of ID (resolves #238)#596
Merged
Conversation
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.
Sorts the principals page alphabetically by name instead of by the opaque IAM ID. Resolves #238.
getPrincipalIds()previously returnedObject.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-insensitivelocaleCompare, 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
masterand made two maintainer adjustments:principals-test.jsnow 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.pyproject.tomluv-version hunk. It relaxed~=0.10.0→>=0.10.0, butmasteris already at>=0.11.0, so it's obsolete.Notes
getPrincipalNames()still uses a default (case-sensitive) sort. Left as-is to keep this change focused on Principals page should list IAM roles/groups/users in alphabetical order #238; worth aligning to the same case-insensitive comparator in a follow-up so the names list and IDs list order identically.Tests
just test-js→ 47 passing, includinggetPrincipalIds.🤖 Generated with Claude Code