fix: stabilize cpe sorting during collection sort #3009
Merged
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
This is not yet fully deterministic but is a branch that attempts to fix #2967
Reproduce
Build the above image and run syft using this branch
Then you can use something like the following to show the sha for each sbom
On main this produces about 7/8 unique sha for 20 sbom generated against the same image.
On this branch there are only 2 unique sha for the same test.
This is currently WIP to determine what the final non determinism that is causing the two different sha.
Current determinism progress between main and this branch for the sample image
The final diff for this branch no longer is related to CPE inconsistency and instead exists within how java packages are created and stored in the collection during cataloging. There is also an inconsistency in relationships being generated for the two outputs of
4d076f84e08b338743ee76f68f2ba516267d954dece28ff700c6ebc152ca95a4
and5d5655ad32cdbfbcdaaabe6a314f6656145ad33dcb54428802fd3dc153e436d0
.This is what I'm currently investigating before submitting this PR for review.
Main
Branch