fix(obj): store Upload assignee, assigneeDate, closeDate as plain values#177
Open
Valyrian-Code wants to merge 1 commit into
Open
fix(obj): store Upload assignee, assigneeDate, closeDate as plain values#177Valyrian-Code wants to merge 1 commit into
Valyrian-Code wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Upload metadata fields so assignee-related attributes are stored as plain values instead of accidental 1-tuples, matching the intended object model and issue #175.
Changes:
- Assign
assignee,assigneeDate, andcloseDatedirectly inUpload.__init__. - Add a regression test covering assigned values and the unassigned
assigneedefault.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
fossology/obj.py |
Removes tuple wrapping from three Upload attributes. |
tests/test_uploads.py |
Adds constructor-level regression coverage for upload assignee fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Trailing commas in Upload.__init__ wrapped these three attributes in
1-tuples instead of assigning the values directly. The docstring types
all three as string. Drop the commas so the attributes match the
documented behaviour.
Without this fix `upload.assignee` returned `("username",)` (or
`(None,)` when unassigned), which is always truthy and breaks any
caller that compares or formats the value as a string.
Adds a constructor-level regression test for the assigned and
unassigned cases.
Closes fossology#175
Signed-off-by: RAJVEER42 <irajveer.bishnoi2310@gmail.com>
b8bfc96 to
2fbe145
Compare
Author
|
Hi @deveaud-m , I’ve provided a minimal patch for this PR. Could you please review it when you have a chance? |
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
Closes #175.
Trailing commas in
Upload.__init__wrapped three attributes in 1-tuples instead of assigning the values directly:The constructor's docstring types all three as
string. With the tuple wrapping,upload.assigneereturned("username",)— or(None,)when the upload was unassigned, which is always truthy and silently breaks any caller that compares or formats the value as a string.Change
fossology/obj.py:429-431so the attributes hold the plain values.tests/test_uploads.pycovering both the assigned ("alice") and the unassigned (None) cases. The test does not need a live Fossology server.Compatibility
No other code in the package reads
.assignee,.assigneeDate, or.closeDate(grep-verified), so nothing downstream relied on the tuple shape. The existing integration test attests/test_uploads.pyonly accessedsummary.additional_info["assignee"], which is why the bug slipped through the live test suite.Test plan
pytest tests/test_uploads.py::test_upload_assignee_fields_are_not_wrapped_in_tuplespasses locallyruff checkclean