Skip repositories with pull requests disabled (HTTP 404) instead of crashing#516
Open
Iamrodos wants to merge 1 commit into
Open
Skip repositories with pull requests disabled (HTTP 404) instead of crashing#516Iamrodos wants to merge 1 commit into
Iamrodos wants to merge 1 commit into
Conversation
…rashing (josegonzalez#511) Also harden the advisories/hooks 404 checks to match HTTPError.code instead of a substring.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #511.
Repositories that have pull requests disabled return HTTP 404 from the
/pullsendpoint (e.g.animetosho/uploader-php-ext, the repo from the issue). The backup previously let that 404 propagate out ofbackup_pulls, past the per-repo handler (which only catchesRepositoryUnavailableError), aborting the entire run.backup_pullsnow catches the 404 from the pull listing, logs that the repository's pull requests are disabled, and continues with the rest of the backup.Details
retrieve_data(..., lazy=True)), so the 404 surfaces during iteration — the guard wraps the iteration accordingly.--pull-detailswas moved into a separate phase outside the disabled-feature guard. This way a 404 on a single pull (e.g. one deleted/transferred between listing and detail fetch) propagates normally instead of being misreported as the whole feature being disabled, which would otherwise silently discard every already-collected pull.backup_security_advisoriesandbackup_hooks: they now match onHTTPError.code == 404rather than"404" in str(e), which could false-match a "404" appearing elsewhere in an error message or URL.Scope note
Only
/pullsreturns 404 for this scenario. I verified against the issue's repo that/issues,/milestones,/labels, and/releasesall return 200 (empty payloads) when issues are disabled, so no handling was needed there.Testing
Tested against
animetosho/uploader-php-extand my own repos.