Repository navigation
fix: improve error handling for GitHub fetch failures and adjust issu… - #35
Merged
Merged
Conversation
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
The GitHub issue list could not be used on a real repository, and a response that was too big was reported as an outage. This PR fixes both:
ListIssuesfetched one issue per request (per_page=1), a workaround for the old 1 MiB limit. Listing a repository with many issues took one round trip per issue.Changes
spi_reads.go).ListIssuesnow requestsper_page=listPerPage(the same page size the other list calls use). Theplugin-sdk-gov0.4.2 chunked fetch (feat(plugin): implement chunked body fetching and error handling for … plugin-sdk-go#18) lets a full page of issues arrive however large it is, so the workaround is gone.spi_reads.go). GitHub's issues endpoint also returns pull requests, which the plugin filters out. The next-page cursor now follows the raw page size (nextPage(len(issues), pg)), not the filtered count, so a page made mostly of pull requests no longer ends the listing early. The last page now yields no cursor instead of an empty extra page.spi_api.go). NewfetchFailure: aplugin.ErrResponseTooLargebecomesCodeInternal"GitHub's response was too large for the plugin to receive". Any other fetch failure is stillCodeTransient"GitHub is unreachable". Applied to both the first request and the retry after a token refresh.Compatibility
plugin-sdk-gov0.4.2, which master already requires. Nogo.modchange.Tests (
spi_issues_test.go)per_page=100requested, and the cursor still advances; a short second page (only a pull request) ends the listing with no cursor.open; thelist_issueswire call works andIssueListis declared.go vet,go test ./...andGOOS=wasip1 GOARCH=wasm go vet .pass.