fix: don't attempt to sort affected events#36
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR removes the unnecessary sorting of affected version events in the OSV advisory generation process to prevent the inadvertent deduplication of events.
- Removed the sort_affected_versions function and the corresponding sorting call in build_affected_range.
- Now directly uses parse_version_constraint to preserve the original order of events.
Files not reviewed (4)
- advisories/acquia_dam/osv-sa-contrib-2024-025.json: Language not supported
- advisories/diff/osv-sa-contrib-2024-042.json: Language not supported
- advisories/social/osv-sa-contrib-2024-038.json: Language not supported
- advisories/symfony_mailer/osv-sa-contrib-2023-031.json: Language not supported
Comments suppressed due to low confidence (1)
scripts/generate_osv_advisories.py:96
- [nitpick] Ensure there are tests verifying that the ordering of events produced by parse_version_constraint remains consistent with the intended left-to-right constraint processing.
'events': parse_version_constraint(constraint),
nzlaura
approved these changes
Apr 25, 2025
02ee5dd to
0981d43
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.
The events should already be sorted since we process version constraints from left to right, and the lower bounds always comes first, and our current sorting implementation both ignores the stability constraint and actually attempts to deduplicate events by their version resulting in some advisories losing their
introducedevent