inspect/sort: Fix handling of non-hex strings with only hex characters#2888
Merged
smalis-msft merged 2 commits intomicrosoft:mainfrom Mar 9, 2026
Merged
inspect/sort: Fix handling of non-hex strings with only hex characters#2888smalis-msft merged 2 commits intomicrosoft:mainfrom
smalis-msft merged 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates support/inspect’s natural-sort comparator so that digit-prefixed substrings are parsed as decimal unless explicitly marked as hex via a "0x" prefix, preventing unintended hex interpretation of strings like "3cab".
Changes:
- Parse digit-prefixed numeric segments using base-10 instead of base-16 (hex parsing remains
"0x"-prefixed only). - Add a unit test covering the regression case where a hex-letter suffix (
a-f) previously caused unintended numeric parsing.
You can also share your feedback on Copilot code review. Take the survey.
alandau
reviewed
Mar 5, 2026
Member
|
I think this will break parts of the tree where we don't use a 0x prefix. |
Member
|
Actually, those are probably already broken when the first character is not 0-9... |
Member
|
Anyway, it would be good to look at |
Contributor
Author
|
I skimmed through and didn't see anything. Everything's either properly prefixed or not actually hex. |
mattkur
approved these changes
Mar 9, 2026
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.
If text doesn't have "0x" as a prefix it shouldn't be parsed as hex. Fix this and add a test to verify. Vibe found and coded with Claude 4.6.