Stable generator ordering by unique id (#123) - #156
Merged
Conversation
Generator lists were sorted by default-flag, priority, type and finally by friendly name. The friendly-name tiebreaker meant renaming a generator moved it in the player GUI, which was confusing. Use the stable unique id as the final tiebreaker instead, in both getAllGeneratorTiers (drives the player list) and the bundle edit panel. The existing per-generator priority field already lets admins order generators explicitly (e.g. 10/20/30/40); this makes ordering within an equal priority stable and rename-independent. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01D7NWPeGXmsUJnnX42X24Rd
|
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.



Closes #123
Context
The request was for a way to explicitly order generators in the player GUI (e.g. numbers 10/20/30/40). That capability already exists: the per-generator
priorityfield (added in 2.0.0) is admin-editable in the generator edit panel, and the player list is sorted by it (getAllGeneratorTiers: default → priority → type → name).The one part of the report that wasn't addressed: the final tiebreaker was the friendly name, so renaming a generator moved its position — "it starts showing up right next to the default one instead of staying in the spot it was."
Change
Replace the
friendlyNamefinal tiebreaker with the stableuniqueIdin the two places generators are sorted:StoneGeneratorManager.getAllGeneratorTiers(drives the player list and most panels)BundleEditPanelNow, within an equal priority + type, order is stable and independent of renaming. Admins control ordering via
priorityas before.Tests
Added to
StoneGeneratorManagerTest:...EqualPrioritySortsByUniqueIdNotName— two tiers, same priority, names in reverse of id order → sorted by id, proving names no longer affect order....SortsByPriority— lower priority number comes first regardless of id/name.All 53 tests in
StoneGeneratorManagerTestpass.🤖 Generated with Claude Code