Skip to content

fix: improve error handling for GitHub fetch failures and adjust issu… - #35

Merged
pikann merged 1 commit into
masterfrom
feature/enhance-github-fetch-error-handling
Nov 3, 2026
Merged

pikann merged 1 commit into
masterfrom
feature/enhance-github-fetch-error-handling

Conversation

@pikann

@pikann pikann commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • ListIssues fetched 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.
  • When GitHub's response was too large for the plugin to receive, the plugin said "GitHub is unreachable", which is transient and invites a retry that can never succeed.

Changes

  • Issue pages (spi_reads.go). ListIssues now requests per_page=listPerPage (the same page size the other list calls use). The plugin-sdk-go v0.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.
  • Cursor (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.
  • Error mapping (spi_api.go). New fetchFailure: a plugin.ErrResponseTooLarge becomes CodeInternal "GitHub's response was too large for the plugin to receive". Any other fetch failure is still CodeTransient "GitHub is unreachable". Applied to both the first request and the retry after a token refresh.

Compatibility

  • Needs plugin-sdk-go v0.4.2, which master already requires. No go.mod change.
  • On a host without chunked fetch, a page that does not fit now fails with a size error rather than "unreachable".
  • No change to the provider SPI, the manifest or stored data.

Tests (spi_issues_test.go)

  • A full 100-row page holding one real issue among pull requests: one issue returned with all fields mapped, per_page=100 requested, and the cursor still advances; a short second page (only a pull request) ends the listing with no cursor.
  • A too-large response is reported as a size error, not as "unreachable".
  • Invalid input and upstream errors are propagated; the default state is open; the list_issues wire call works and IssueList is declared.
  • go vet, go test ./... and GOOS=wasip1 GOARCH=wasm go vet . pass.

@pikann
pikann merged commit 6c40649 into master Nov 3, 2026
3 checks passed
@pikann
pikann deleted the feature/enhance-github-fetch-error-handling branch November 3, 2026 15:32
@pikann pikann linked an issue Nov 3, 2026 that may be closed by this pull request
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.

Expose tools to read and list repository issues

1 participant