Conversation
bb62f3d to
1206b06
Compare
1206b06 to
3ee9e9a
Compare
…-of-order packages serde_json::Map without preserve_order uses BTreeMap which iterates alphabetically. parse_section() advanced search_start sequentially, so packages appearing earlier in the file but later alphabetically were searched from a position already past their location, leaving name_range/version_range at (0,0)->( 0,0). Enabling the preserve_order feature makes serde_json use IndexMap, preserving insertion (file) order so sequential search_start advancement stays correct. Fixes #84
3ee9e9a to
3c3f86b
Compare
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.
Summary
serde_jsonpreserve_orderfeature indeps-composersocomposer.jsonentries are iterated in file order (viaIndexMap) rather than alphabetical order (viaBTreeMap)test_position_tracking_out_of_alphabetical_ordercovering the exact reproduction case from the issueRoot cause
parse_section()advancedsearch_startsequentially as each dependency was matched. Withoutpreserve_order,serde_json::Mapiterates alphabetically. A package appearing earlier in the file but later alphabetically was searched starting from a byte offset already past its location, leavingname_range/version_rangeat(0,0)→(0,0).Impact before fix
nullfor affected packagesFixes #84
Test plan
test_position_tracking_out_of_alphabetical_ordercovers the exact reproduction scenario (laravel/framework → guzzlehttp/guzzle → symfony/console)cargo clippy --workspace --all-targets --all-features -- -D warningscleancargo +nightly fmt --all -- --checkclean