Repository navigation
fix(import): reject HTTP errors in GitHub PR REST fallback - #1150
Merged
Merged
Conversation
Signed-off-by: ydflow <314143294+ydflow@users.noreply.github.com>
6 of 7 tasks
|
No findings in the scoped PR diff. The HTTP status checks reject failed metadata, commits, and diff responses before JSON parsing or diff extraction, while preserving successful responses. The PR description satisfies the testing requirement: it records post-build real-CLI verification of all four error cases and a successful fallback, including confirmation that failures stop before AI invocation. A full provider × agent matrix is not required. |
jeff-r2026
approved these changes
Oct 15, 2026
7 tasks done
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
When
ghis unavailable or fails, GitHub MR/PR import falls back to REST requests that never check the HTTP status. A missing/private PR or rate-limit response becomes a JSON/commitsRaw.maperror; a failed diff request is worse: its error page is accepted as the diff and passed to learning extraction.Reject non-2xx responses with the status and body before parsing JSON or returning diff text. Add regression coverage for metadata 404/403, commits 429, diff 503, and a successful fallback. Update the bilingual provider guide and troubleshooting reference.
Type of Change
Test Plan
npm run buildnpx tsc --noEmitnpm run lintnpx vitest run github-mr-fetch import-mr ci-extract-mr: 30 passed across 4 files.git diff --checkAgainst the unchanged upstream runtime at
27a026f, all four new HTTP error cases fail; the success control passes.Real CLI verification after build
Windows, Node 24.19.0, isolated
HOME/USERPROFILE, a temporary Git checkout, and a fakeghonPATHthat exits 1 to select the REST fallback. An ESM preload supplies deterministicnode:httpsresponses to the built CLI. A fakeclaudewrites an invocation marker and returns a fixed learning; no live model or GitHub writes are used.Checked that the error runs contain no
commitsRaw.mapor JSON parse error. Unit tests verify the success response still preserves metadata, commit headlines, and diff. The CLI fixture verifies the stop-before-AI behavior; it does not claim live GitHub or model validation.Related Issues
Found through source inspection. No open issue/PR addressing these REST response checks was found. #1122 changes multi-MR orchestration rather than
src/providers/github/mr-fetch.ts; this PR does not change its import command paths.Notes for Reviewers
Both fallback response readers feed
fetchGitHubPRViaApi, used byimportFromMRbeforecallClaude. No persistent state schema, successfulghpath, pagination, or timeout behavior changes. This is independent of #1149.Prepared with assistance from an AI coding agent.