Skip to content

fix a couple bugs#369

Merged
gbeane merged 3 commits into
mainfrom
fix/fix-merge-bug
May 1, 2026
Merged

fix a couple bugs#369
gbeane merged 3 commits into
mainfrom
fix/fix-merge-bug

Conversation

@gbeane
Copy link
Copy Markdown
Collaborator

@gbeane gbeane commented May 1, 2026

This pull request improves robustness in handling missing or stale project metadata during prediction loading and project merging, and adds comprehensive tests to cover these edge cases. The main focus is on ensuring fallback mechanisms work correctly when expected metadata or inventory is unavailable, both in the core logic and in the test suite.

Robustness improvements for missing metadata and inventory:

  • Updated load_predictions in prediction_manager.py to gracefully handle missing identities metadata in project_settings['video_files'] by falling back to video_manager.get_video_identity_count(video). If still unavailable, it attempts to infer the count from the prediction file itself.
  • In merge_projects in project_merge.py, added logic to handle cases where a video unique to the source project has just been copied and the destination's in-memory inventory is stale. If loading pose estimation fails, it falls back to opening the pose file directly from the cache.
  • Imported open_pose_file in project_merge.py to support the new fallback logic.

Test coverage enhancements:

  • Added MockVideoManager to the test suite and updated MockProject to include it, enabling simulation of video identity count fallback scenarios. [1] [2]
  • Added a new test to test_prediction_manager.py verifying that load_predictions falls back to video_manager when video_files metadata is missing.
  • Added a new test to test_project_merge.py to ensure that merging unique labeled videos correctly falls back when the destination's inventory is stale and load_pose_est fails.

Copy link
Copy Markdown
Contributor

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 aims to make project merging and prediction loading more robust when project metadata (identity counts) or the destination project’s in-memory video inventory is missing/stale, and adds tests for these edge cases.

Changes:

  • Updated PredictionManager.load_predictions() to tolerate missing project_settings["video_files"][video]["identities"] and attempt fallback identity-count resolution.
  • Updated merge_projects() to add a fallback pose-loading path for videos newly copied into the destination project (stale inventory scenario).
  • Added tests to cover prediction loading with missing metadata and merging with unique labeled videos; updated .gitignore.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/jabs/project/prediction_manager.py Adds fallback logic for missing identity-count metadata during prediction load.
src/jabs/project/project_merge.py Adds a fallback pose-loading path for newly-copied videos when destination inventory is stale.
tests/project/test_prediction_manager.py Introduces a mock video manager and a test for missing video_files metadata fallback.
tests/project/test_project_merge.py Adds a regression test for merging unique labeled videos with stale destination inventory.
.gitignore Ignores scratch/.

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

Comment thread src/jabs/project/project_merge.py
Comment thread src/jabs/project/prediction_manager.py Outdated
Comment thread tests/project/test_project_merge.py Outdated
Comment thread tests/project/test_project_merge.py Outdated
Comment thread src/jabs/project/prediction_manager.py Outdated
@gbeane gbeane requested a review from Copilot May 1, 2026 04:10
@gbeane gbeane self-assigned this May 1, 2026
Copy link
Copy Markdown
Contributor

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 improves robustness when loading predictions and merging projects in cases where project metadata or destination inventory is missing/stale, and adds targeted tests to cover these edge cases.

Changes:

  • Updated PredictionManager.load_predictions() to fall back to video_manager identity counts (and infer identity count from the prediction file when still unknown).
  • Updated merge_projects() to recover from stale destination inventory for newly-copied videos by opening the pose file directly from disk.
  • Added tests covering both fallback behaviors and updated mocks to support the new prediction-loading path.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/jabs/project/prediction_manager.py Adds identity-count fallback logic when project_settings["video_files"] is missing/stale.
src/jabs/project/project_merge.py Adds a direct pose-file open fallback when destination inventory is stale for newly-copied videos.
tests/project/test_prediction_manager.py Extends mocks and adds tests for missing video metadata and identity-count inference behavior.
tests/project/test_project_merge.py Adds a regression test for merge behavior when destination pose loading fails due to stale inventory.
.gitignore Ignores a scratch/ directory.

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

Comment thread src/jabs/project/prediction_manager.py
@gbeane gbeane merged commit c4ef124 into main May 1, 2026
5 checks passed
@gbeane gbeane deleted the fix/fix-merge-bug branch May 1, 2026 04:19
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.

2 participants