Skip to content

Conversation

@alicup29
Copy link
Collaborator

@alicup29 alicup29 commented Dec 23, 2025

Summary

  • Fixed bug where "Delete All Predictions..." menu item deleted user-labeled instances in multi-video projects
  • Root cause: video.matches_content() returns True for ALL videos with the same dimensions (shape and backend type), causing remove_frames() to remove frames from all videos instead of just the target
  • remove_frames() on videos w/ ImageVideo backend and 1 frame (.tif): frame to remove is idx 0 -> remove_frames() checks video shape & backend type + labeled frame idx (0 for .tif ImageVideos) -> call labels_pop()
  • soln: compare content AND path w/ sleap-io matches_path() function

Test plan

  • Open a multi-video project with both user instances and predictions
  • Use "Labels > Delete All Predictions..."
  • Verify only predictions are deleted, user instances are preserved
  • Verify frames with only user instances remain in the project

🤖 Generated with Claude Code

…jects

The bug was caused by video.matches_content() returning True for ALL
videos with the same dimensions (shape and backend type). This caused
remove_frames() to incorrectly match and remove frames from all videos
instead of just the target video.

Added videos_match() helper that uses object identity instead of
matches_content() for internal operations where we're comparing videos
from the same Labels object.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@alicup29 alicup29 self-assigned this Dec 23, 2025
@codecov
Copy link

codecov bot commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.44%. Comparing base (1f7c37e) to head (39f7480).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2511      +/-   ##
===========================================
- Coverage    56.44%   56.44%   -0.01%     
===========================================
  Files           71       71              
  Lines        14302    14304       +2     
===========================================
+ Hits          8073     8074       +1     
- Misses        6229     6230       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Updated videos_match() to use matches_content() AND matches_path(strict=True)
instead of object identity alone. This approach:

1. Preserves content comparison (shape and backend type)
2. Distinguishes different video files with same dimensions (e.g., 1-frame .tifs)
3. Works after deserialization when videos have same path but different object IDs

The original fix used object identity (`is`) which would fail to match the same
video after deserialization. The new approach uses sleap-io's matches_path()
method which correctly handles both single video files and ImageVideo backends
(list of frame paths).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

3 participants