Repository navigation
Fix OSV commit patch attribution per affected package - #2490
Draft
Celestial-0 wants to merge 1 commit into
Draft
Celestial-0 wants to merge 1 commit into
Celestial-0 wants to merge 1 commit into
Conversation
Signed-off-by: Yash Kumar Singh <proyash3053@gmail.com>
This branch has not been deployed
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.
What's changed?
The OSV parser gives each affected package fresh introduced and fixed commit lists. Previously, packages shared those lists and inherited commits from other blocks in the advisory. A package with no ranges could also be emitted because an earlier package supplied commits.
The fix moves the two list initializations into the affected-package loop. Multiple Git ranges within one package still accumulate their commits. Four regression tests cover these cases in the existing OSV test module. I also added the changelog note and author entry requested by the linked contribution guide.
Related issue
Fixes #2489
Validation
Before the fix, the new tests returned
3 failed, 1 passed. With the fix, the full OSV module returns22 passed:I ran this on Windows with Python 3.12.14 and the repository's pinned development dependencies. UTF-8 mode is needed for the existing fixture text on Windows.
Black, isort and
git diff --checkpass. The test file also passes pycodestyle. The parser file has 12 pycodestyle findings; I checked the unchanged upstream file and got the same 12 findings. I have not run the entire repository suite. The DCO check passes; upstream test CI has not run yet.I used AI assistance to investigate and implement this change. The cause is the shared list objects:
AffectedPackageV2keeps the lists it receives, so appending commits for a later block changes earlier packages too. The regression tests exercise the real parser and classifier without fetching repositories.Checklist