WordPress / WordPress/contributor-toolkit
Open pull request reports "No connection to GitHub" when the contributor's old fork was transferred and its name redirects
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 13
- Avg merge
- 23h 19m
- Merged PRs (30d)
- 72
Description
Description
Open a pull request fails with No connection to GitHub for a contributor whose earlier fork of the repository was transferred to another account. GitHub keeps a redirect from the old name, so GET /repos/<login>/gutenberg answers 307 to the repository's id. Token-bearing requests are sent with redirect: 'error' on purpose (a credential must never follow a redirect), so Electron's net aborts the request, the fork stage catches the exception and reports it as offline. The app log says pull request failed at forking: offline — Attempted to redirect, but redirect policy was 'error'.
The contributor has no fork under their login any more and is entitled to one; the app should fork instead of reporting a network failure.
Step-by-step reproduction instructions
- On GitHub, fork
WordPress/gutenbergunder your account, then transfer the fork to another account or organisation you own.GET https://api.github.com/repos/<you>/gutenbergnow answers 307. - In the app, on a Gutenberg site with an issue linked and an edit, Review & submit changes → Open a pull request, sign in, fill the title, Open pull request.
Expected: a new fork under your login, the branch pushed, the pull request opened. Actual: No connection to GitHub. with the patch-file fallback.
Fix
Keep refusing to follow redirects with a token, but report the 3xx as a status instead of an exception (redirect: 'manual', resolve on the redirect event without calling followRedirect). The fork stage then treats a redirect on the fork's URL as "no fork under this name" and forks anew, which GitHub allows and which retires the redirect.
Operating system
Either.
App version
Trunk at 4c53900, unreleased (v1.2.0). Found during the v1.2.0-beta.1 manual pass, on the Open pull request step of a Gutenberg site.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Open pull request flow and its fork stage, then trace the Electron net request for the contributor's fork URL. Reproduce with a transferred fork and inspect the logged redirect error; done means a 3xx is handled as a response without following it, allowing the app to create a new fork, push the branch, and open the pull request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, github, javascript
- Domain
- api, desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100