Skip to content

Fix: properly use unique_bodyparts and identity_scores arguments in ShelfWriter.add_prediction - #3112

Merged
deruyter92 merged 10 commits into
mainfrom
maxim/fix_shelf_writer
Feb 19, 2026
Merged

deruyter92 merged 10 commits into
mainfrom
maxim/fix_shelf_writer

Conversation

@maximpavliv

Copy link
Copy Markdown
Contributor

This PR fixes a bug introduced in PR #2861 and reported in Issue #3108, where the unique_bodyparts and identity_scores arguments in ShelfWriter.add_prediction() were being overwritten with None due to redundant kwargs.get() calls.

These reassignments caused the method to ignore valid input arguments when passed directly. The fix removes the two lines that overwrote these parameters, restoring the correct behavior while keeping **kwargs in the signature for subclass compatibility.

@arashsm79

Copy link
Copy Markdown
Contributor

LGTM. Thanks!

@deruyter92
deruyter92 requested a review from Copilot January 13, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 a bug where unique_bodyparts and identity_scores arguments in ShelfWriter.add_prediction() were being overwritten with None by redundant kwargs.get() calls, causing the method to ignore valid direct arguments.

Changes:

  • Removed two lines that were reassigning unique_bodyparts and identity_scores parameters with values from kwargs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@deruyter92
deruyter92 self-requested a review January 15, 2026 12:39
@C-Achard

Copy link
Copy Markdown
Member

Maybe add a unit test for this specifically @deruyter92 ?

@deruyter92

Copy link
Copy Markdown
Collaborator

Added unit tests, which revealed another bug in writing metadata. Now addressed that as well.

ShelfWriter.close() did self._db["metadata"]["nframes"] = self._frame_index, which modifies a deserialized copy of the dict. This is now fixed.

@deruyter92
deruyter92 merged commit 3d4da2e into main Feb 19, 2026
10 checks passed
@deruyter92
deruyter92 deleted the maxim/fix_shelf_writer branch February 19, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants