Skip to content

fix(index): tolerate orphan shots in reset-search-index#1069

Merged
frankrousseau merged 1 commit into
cgwire:mainfrom
nledez:fix/reset-search-index-orphan-shots
May 10, 2026
Merged

fix(index): tolerate orphan shots in reset-search-index#1069
frankrousseau merged 1 commit into
cgwire:mainfrom
nledez:fix/reset-search-index-orphan-shots

Conversation

@nledez
Copy link
Copy Markdown
Contributor

@nledez nledez commented May 7, 2026

Problem

  • zou reset-search-index crashes with SequenceNotFoundException on some instances that contain orphan shots (their parent_id points to a sequence that no longer exists). The exception bubbles up to the CLI, the shot index is never rebuilt, and everything after it is skipped.

Solution

  • prepare_shot (zou/app/services/index_service.py) now catches SequenceNotFoundException and EpisodeNotFoundException. When the parent sequence or episode is missing, the shot is still indexed with its id, name, and project_id — keeping it discoverable in Kitsu so users can spot and fix the DB inconsistency.
  • Initialize sequence = None to close the NameError path.
  • Add a test (tests/services/test_index_service.py::test_reset_index_with_orphan_shot) that mocks get_sequence to simulate the orphan case and verifies that reset_index() completes without error.

@frankrousseau frankrousseau merged commit 6b411a5 into cgwire:main May 10, 2026
14 checks passed
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