Skip to content

[OJ-55106] Handle NotFoundException for deleted repos in BBS ingestion#458

Merged
dregalbuto merged 1 commit into
masterfrom
OJ-55106
May 27, 2026
Merged

[OJ-55106] Handle NotFoundException for deleted repos in BBS ingestion#458
dregalbuto merged 1 commit into
masterfrom
OJ-55106

Conversation

@dregalbuto
Copy link
Copy Markdown
Contributor

When a Bitbucket Server repo is deleted between the repo enumeration phase and the commit/PR download phase, api_repo.get() raises NotFoundException and previously crashed the entire run. Now logs a warning and skips the repo, continuing with remaining repos.

Also guards repo discovery (get_repos) against the same race condition, and replaces api_repo.get()['name'] calls in error-path logging with the already-fetched repo['name'] to avoid secondary exceptions inside handlers.

Root cause: A customer's repo enumeration phase took ~6 hours. A repo was deleted in the window between project.repos.list() returning it and the commit download phase calling api_repo.get() on it, crashing the entire git ingestion with an unhandled NotFoundException.

Test plan

  • test_get_repos_skips_deleted_repo — first repo raises NotFoundException from .get(), second repo's data is still returned
  • test_get_branch_commits_skips_deleted_repo — same pattern for commit download
  • test_get_pull_requests_skips_deleted_repo — same pattern for PR download

When a Bitbucket Server repo is deleted between the repo enumeration phase
and the commit/PR download phase, api_repo.get() raises NotFoundException
and previously crashed the entire run. Now logs a warning and skips the
repo, continuing with remaining repos.

Also guards repo discovery (get_repos) against the same race condition,
and replaces api_repo.get()['name'] calls in error-path logging with the
already-fetched repo['name'] to avoid secondary exceptions inside handlers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@dregalbuto dregalbuto merged commit c696987 into master May 27, 2026
7 checks passed
@dregalbuto dregalbuto deleted the OJ-55106 branch May 27, 2026 14:06
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