Skip to content

fix(obj): store Upload assignee, assigneeDate, closeDate as plain values#177

Open
Valyrian-Code wants to merge 1 commit into
fossology:mainfrom
Valyrian-Code:fix/upload-attrs-tuple-bug
Open

fix(obj): store Upload assignee, assigneeDate, closeDate as plain values#177
Valyrian-Code wants to merge 1 commit into
fossology:mainfrom
Valyrian-Code:fix/upload-attrs-tuple-bug

Conversation

@Valyrian-Code
Copy link
Copy Markdown

Summary

Closes #175.

Trailing commas in Upload.__init__ wrapped three attributes in 1-tuples instead of assigning the values directly:

# before
self.assignee = (assignee,)
self.assigneeDate = (assigneeDate,)
self.closeDate = (closingDate,)

The constructor's docstring types all three as string. With the tuple wrapping, upload.assignee returned ("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

  • Drop the trailing commas in fossology/obj.py:429-431 so the attributes hold the plain values.
  • Add a constructor-level regression test in tests/test_uploads.py covering 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 at tests/test_uploads.py only accessed summary.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_tuples passes locally
  • ruff check clean
  • CI green

Copilot AI review requested due to automatic review settings May 18, 2026 14:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and closeDate directly in Upload.__init__.
  • Add a regression test covering assigned values and the unassigned assignee default.

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.

Comment thread tests/test_uploads.py
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>
@Valyrian-Code Valyrian-Code force-pushed the fix/upload-attrs-tuple-bug branch from b8bfc96 to 2fbe145 Compare May 18, 2026 16:23
@Valyrian-Code
Copy link
Copy Markdown
Author

Hi @deveaud-m ,

I’ve provided a minimal patch for this PR. Could you please review it when you have a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upload attributes assignee, assigneeDate, closeDate incorrectly stored as 1-tuples

2 participants