Repository navigation
fix: iterate all entries of a sparse Mapping - #319
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
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.
MappingIterstops once its offset reachesMapping::len, the number of stored values. When the ids in aMappingare not contiguous from zero, or a value was removed withunset, the iterator ends before it reaches the highest id and silently skips entries.DependencySnapshot::from_providerhits this when the snapshot covers only some of the provider's packages. It iteratespackagesto apply the provider's candidate order, so packages with highNameIds keeporder: 0for every solvable. Solving against the snapshot then picks candidates in insertion order instead of the provider's preferred order, which can produce a different solution than the original provider.Changes
MappingIternow iterates up to the highest inserted id (Mapping::max) instead ofMapping::len.test_iter_sparseinsrc/utils/mapping.rscovers sparse ids andunset.test_snapshot_subset_of_packages_keeps_candidate_ordersnapshots onlybfrom a provider that also hasa. Before the fix the snapshot solves tob=1; with the fix it solves tob=3, matching the original provider's highest-version-first order.Testing
Fixes #318