Skip to content

Fix sort comparator comparing key with itself#7601

Open
AaronStackBarnes wants to merge 1 commit into
Shopify:mainfrom
AaronStackBarnes:fix/sort-comparator-rewrite
Open

Fix sort comparator comparing key with itself#7601
AaronStackBarnes wants to merge 1 commit into
Shopify:mainfrom
AaronStackBarnes:fix/sort-comparator-rewrite

Conversation

@AaronStackBarnes
Copy link
Copy Markdown

Found this while debugging some weird deploy diffs - the sort comparator on line 84 of write-app-configuration-file.ts compares key with itself (key.localeCompare(key)) so it basically does nothing. The output order ends up depending on whatever the engine feels like doing, which can cause unpredictable ordering in the generated toml when theres extra keys from dynamic config.

One-liner fix, just destructures both args properly so it actually compares two different keys.

The comparator was comparing `key` with itself instead of comparing
two different keys, making the sort order nondeterministic.
@AaronStackBarnes AaronStackBarnes requested a review from a team as a code owner May 21, 2026 18:57
Copilot AI review requested due to automatic review settings May 21, 2026 18:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes deterministic ordering when rewriting app configuration by correcting the sort comparator used for configuration keys.

Changes:

  • Corrected the Array.sort comparator to compare keyA vs keyB instead of comparing a key to itself.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants