[Add] Work on a Gutenberg issue and open a pull request to it (#251) - #269
Closed
juanmaguitar wants to merge 3 commits into
Closed
Conversation
juanmaguitar
force-pushed
the
juanmaguitar/gutenberg-issue-and-pr-authoring
branch
from
August 11, 2026 10:57
f788bcf to
d50f572
Compare
juanmaguitar
force-pushed
the
juanmaguitar/gutenberg-issue-and-pr-authoring
branch
from
August 11, 2026 13:49
d50f572 to
4aa9978
Compare
juanmaguitar
force-pushed
the
juanmaguitar/gutenberg-issue-and-pr-authoring
branch
from
August 12, 2026 05:19
4aa9978 to
c01ab5d
Compare
The last half of the Gutenberg flow: linking a work item and opening a pull request were both Trac- and wordpress-develop-shaped. - src/renderer/github-issue.cjs: the Gutenberg counterpart of trac-ticket.cjs. Accepts `1234`, `#1234` and an issue URL with the noise a copy-paste brings; refuses another repository's issue, another host, and — by name, because it is the obvious mistake — a pull request URL pasted instead of the issue it fixes. Both branches share one bounds check, so a pasted `/issues/0` or a twenty-digit path cannot become a falsy id or a branch named after a float. - src/work-item.cjs: one interface over the two, chosen by the site's project type. The rest of the app asks "parse this", "where does it live", "what is it called" without knowing which kind it is. Defaults to Trac, so a site with no project type behaves exactly as before. - sites:set-ticket validates through the site's provider, so a Gutenberg site accepts an issue where a Core site accepts a ticket. Both parse to a number, so the `ticket/<id>` branch key and every reader of `tracTicket` are unchanged. - github-pr.cjs takes the project's upstream, base branch and branch prefix through the `deps` each helper already receives, and buildPullRequestBody takes the project's citation line. A Gutenberg pull request goes to WordPress/gutenberg on a `fix/issue-<n>` branch and says `Fixes #<n>`, so merging it closes the issue. - The handoff patch header cites the same work item, rather than deriving a Trac URL from the number — a Gutenberg patch must not cite a core.trac ticket that merely shares its issue number. - The work-item card, its input and the browse link follow the project. Both Trac-only surfaces are hidden for a Gutenberg site: the attachments panel, which would offer a Core patch for apply into a Gutenberg checkout, and the "Attach to Trac" destination, whose button would otherwise save a file and then have nowhere to send it. testMode() deliberately keeps reading the environment override rather than the project, so a Gutenberg site is not reported as sandboxed simply for not being wordpress-develop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The pull-request panel was type-aware everywhere except its copy, which is the only part a contributor reads: - The title hint promised "Ticket #71234" on a Gutenberg site while the handler sent "Issue #71234". Both now read defaultPrTitle from the provider, so the promise and the thing promised cannot drift apart again. - Two prose blocks were Core-only and false for Gutenberg — "nobody watches the pull request list", "nothing is merged on GitHub", "triage and props live on the ticket". On Gutenberg the pull request IS the review venue and IS what gets merged, and this audience is the least able to notice the app is describing a different project. Gated to Core until the Gutenberg counterpart is written. - The ref placeholder was duplicated as an inline ternary at two call sites, and the second sits inside a Trac-only block, so its Gutenberg branch could never render. Both now read refPlaceholder from the provider. Also pins the per-project handoff header from both sides: the builder and the handler were each tested, but the label and URL the handler derives from the provider were unexercised, so a regression could cite a Core Trac ticket on a Gutenberg patch with the suite green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
juanmaguitar
force-pushed
the
juanmaguitar/gutenberg-issue-and-pr-authoring
branch
from
August 12, 2026 06:37
c01ab5d to
ed844b8
Compare
juanmaguitar
added a commit
that referenced
this pull request
Aug 12, 2026
## Why `v1.0.0-beta.1` shipped on 10 August. Twenty changes have landed on `trunk` since — the setup chain, the decoupled build watch, the failed-apply explanation, the ticket's own facts, the toasts. That is the release candidate for 1.0, so the version moves to `1.0.0-rc.1` before the tag is cut. ## What changes `package.json` and `package-lock.json`, and nothing else. Written by `npm version 1.0.0-rc.1 --no-git-tag-version` rather than by hand, so the lockfile's two copies of the string move with it. `git grep 1.0.0-beta` outside the lockfile returns nothing, so no doc, workflow or script carries the version. `electron-builder` derives the artefact names from `package.json`, so the assets become: - `wordpress-contributor-toolkit-1.0.0-rc.1-mac-arm64.dmg` - `wordpress-contributor-toolkit-1.0.0-rc.1-win-x64.exe` - `wordpress-contributor-toolkit-1.0.0-rc.1-linux-x86_64.AppImage` The `rc.1` shape (not `rc1`) keeps the same form as `beta.1`, so the filenames stay in one series. ## Scope The open Gutenberg stack (#255 → #261 → #264 → #269 → #283) is deliberately **not** in this release candidate. An RC stabilises what is there; a feature of that size belongs in the release after it. ## Review No behaviour changes, so the review standard has nothing to grade beyond the diff itself: two version strings, produced by npm, verified against `git grep`. Lint and unit tests run on this branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…-and-pr-flow' into HEAD
juanmaguitar
marked this pull request as draft
August 21, 2026 08:42
Collaborator
Author
|
Closing along with the rest of the stack — see #255 for the reasoning: trunk has rewritten The branch stays, so the work is retrievable. What ports forward cleanly here: src/work-item.cjs, src/renderer/github-issue.cjs and their tests. |
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.
Why
The last piece of #251. A Gutenberg site can now clone, build, serve (#255, #261) and have a
Gutenberg pull request applied to it (#264) — but a contributor still could not work on a
Gutenberg issue and open a pull request for it. Linking a work item and authoring a PR were both
Trac- and wordpress-develop-shaped.
What changes
src/renderer/github-issue.cjs(new) — the Gutenberg counterpart oftrac-ticket.cjs.Accepts
1234,#1234and an issue URL with the noise a copy-paste brings; refuses anotherrepository's issue, another host, and — by name, because it is the obvious mistake — a pull
request URL pasted instead of the issue it fixes.
src/work-item.cjs(new) — one interface over the two kinds, chosen by the site's projecttype. The rest of the app asks "parse this", "where does it live", "what is it called" without
knowing which it is. Defaults to Trac, so a site with no project type is untouched.
sites:set-ticketvalidates through the site's provider. Both kinds parse to a number, so theticket/<id>branch key and every reader oftracTicketare unchanged — no migration.github-pr.cjstakes the project's upstream, base branch and branch prefix through thedepseach helper already receives;
buildPullRequestBodytakes the project's citation line. AGutenberg PR goes to
WordPress/gutenberg, on afix/issue-<n>branch, sayingFixes #<n>so merging it closes the issue.number.
surfaces are hidden on a Gutenberg site — the attachments panel, and the "Attach to Trac"
destination.
testMode()deliberately still reads the environment override rather than the project, so aGutenberg site is not reported as sandboxed merely for not being wordpress-develop.
How to test this
Platforms: any. Needs a Gutenberg site from the earlier PRs, and a signed-in GitHub account for
step 4.
https://github.com/WordPress/gutenberg/issues/71234(or#71234). → Linked; "Open on GitHub"goes to the issue. A
core.trac.wordpress.orgURL is refused here, and a pull request URL isrefused with "That is a pull request. Link the issue it fixes instead."
# Issue: https://github.com/WordPress/gutenberg/issues/71234, not a Trac URL.WordPress/gutenberg, the branch isfix/issue-71234, thetitle defaults to
Issue #71234, and the body's first line isFixes #71234.62281links, attachments panelpresent, handoff header says
# Ticket: …/ticket/62281, PR targetswordpress-developontrac-62281citing the Trac URL.What must not have happened:
wordpress-develop— that is a real PR on the wrongproject.
test/github-pr.test.cjsdrives the whole sequence (fork → ref → sync → tree → commit →branch → PR) against a fake API and asserts no call touches wordpress-develop, and the mirror
test asserts a project-less run touches no gutenberg.
nothing.
WP_DEV_ENV_GITHUB_UPSTREAMmust still redirect a run to a sandbox (it is checked before theproject, on purpose).
Automated:
npm run lintclean; 844 tests pass. New:test/github-issue.test.cjs,test/work-item.test.cjs; extendedgithub-pr,patch-provenance,ipc-wiring.Risks and limitations
src/?", thestale-trunk note's "may not apply on Trac"). Cosmetic on a Gutenberg site; a copy pass is a
follow-up.
workItemProvider('github-issue')with norepoPathwould build agithub.com/undefined/...URL. Not reachable — both call sites pass the site's upstream — but the two halves of that object
disagree about their contract, worth tightening later.
Related
Part of #251 — completes it. Stacked on #264.
Review outcome (required — see AGENTS.md)
5 [fix here] · 1 [follow-up] — all 5 fixed. Ran the review in
.github/instructions/code-review.instructions.md; judgement pass in a fresh subagent. Lint clean,844 tests pass.
ungated; on a Gutenberg site its button saved a patch and then silently did nothing
(
attachUrlForis null). Now hidden, like the attachments panel.parseIssueRef's URL branch skipped the bounds check its bare-numberbranch applied, so
/issues/0produced a falsy id (a site onticket/0that reads as unlinkedand cannot open a PR) and a 20-digit path produced a float-named branch. Both branches now share
one guard; regression tests added.
Gutenberg patch cited a core.trac ticket sharing its issue number. It now takes the work item from
the caller.
flow (only the pure helpers were tested). Added an end-to-end
openPullRequesttest per projectasserting no call reaches the other one, plus a Gutenberg
github:open-prwiring test.no-ticketmessage was unreachable behind therenderer's message map; dropped the duplicate so the main-process one (which knows the project)
is what the user sees.
urlForwithout arepoPath(documented in Risks; unreachable).upstream()/baseBranchFor()/branchNameFor()/buildPullRequestBody()with no project; the env override still wins over a project;testMode()ignoring the project is correct; the attachments gating leaves no orphaned effect orloader that could open a Trac window on a Gutenberg site;
parseIssueRefrejectshttps://github.com@evil.com/…and builds its URL from the configured repo, not the input.