Make WordPress Core

Opened 8 weeks ago

Last modified 7 weeks ago

#66169 new enhancement

Add grunt ticket:<n> to read a Trac ticket, and restore grunt patch:<n>, by fetching through the Playwright browser core already ships

Reported by: whyisjake Owned by:
Priority: normal Milestone: Awaiting Review
Component: Build/Test Tools Version: trunk
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

core.trac.wordpress.org now answers every non-browser request with a JavaScript proof-of-work challenge (Checking your browser..., HTTP 403). That includes the plain HTML, ?format=rss, ?format=csv, the attachment listing, and raw attachments. Two consequences for contributors and committers:

  1. grunt patch:<ticket> fails for every ticket. Reproduced today against #66079: Running "patch:66079" (patch) task >> getPatchFromTicket fail >> status: 403. This is tracked upstream as ​grunt-patch-wordpress#210 (August 2026), with no fix.
  2. There is no way to read a ticket from the command line at all. Anyone scripting a triage or commit workflow, including AI-assisted ones, has to paste ticket text by hand.

The durable fix is a structured read API, proposed in ​meta:#8202. That ticket is currently unowned (owner removed June 2026) and the discussion there favours either Systems restoring access for identified clients or a Trac-native MCP plugin. Neither is on a timeline.

Proposal

core already ships a real browser: @playwright/test 1.61.1 is a devDependency, and the end-to-end and performance workflows install Chromium with npm exec --no -- playwright install chromium. The challenge is designed to let browsers through, so a headless Chromium page passes it in a few seconds and can then read the rendered ticket, the attachment list, and raw attachments.

Two tasks, both implemented in the grunt-patch-wordpress package that core already depends on, then picked up here with a dependency bump:

  • grunt ticket:<n> (new): prints the ticket summary, properties, description, attachments with raw URLs, linked pull requests, and the full change history. --json for structured output.
  • grunt patch:<n> (existing): swap the two request() calls in getPatchFromTicket() and getPatch() for fetches made through the same Playwright page, so the attachment listing and download work again. Also make the failure message say "Trac returned a bot-protection challenge" instead of "Nothing to patch", as issue 210 asks.

Prerequisite for both: npx playwright install chromium once, the same step the e2e suite needs. If no browser is installed the task should say exactly that and exit, not fall through to the old usage help.

A working proof of concept for the read half is at ​whyisjake/trac-ticket. It reads core and meta tickets, keeps the challenge cookie across runs, and takes about 6 seconds per ticket.

Caveats worth deciding up front

  • This routes tooling through a protection Systems put in place. It is the project's own tool on the project's own Trac, using the exact path the challenge is meant to allow, but Systems should be looped in so they are not surprised by headless-browser traffic from committers. An allowlisted client would make all of this unnecessary.
  • It is a stopgap. When ​meta:#8202 or an equivalent API lands, both tasks should switch to it and drop the browser dependency.
  • Downloading Chromium is roughly 95 MB. That is already true for contributors running e2e tests; it becomes true for anyone who wants grunt patch back.

AI assistance: Yes. Tool(s): Claude Code (Claude Fable 5.1). Used for: confirming the 403 behaviour and the grunt patch failure, locating the upstream issue and meta ticket, building the proof-of-concept script, and drafting this ticket.

Change History (7)

This ticket was mentioned in ​Slack in #core-committers by whyisjake. ​View the logs.


8 weeks ago

#2 @whyisjake
8 weeks ago

PR for the package half is up: ​grunt-patch-wordpress#220. It fixes grunt patch by fetching Trac through Playwright's headless Chromium, adds the ticket task, drops the unmaintained request dependency, and bumps the package to 4.1.0.

Once that is merged and published, the core side is a two-line change: bump grunt-patch-wordpress to ~4.1.0 in package.json and add a ticket alias next to the existing apply alias in Gruntfile.js. I'll open that PR against wordpress-develop when the release exists.

Tests executed on the package branch: npm test (check-engines, check-licenses, lint:js, lint:pkg-json, test:unit, 48 tests) plus live runs of grunt ticket:66169, grunt ticket:https://meta.trac.wordpress.org/ticket/8202 --json, grunt patch:https://core.trac.wordpress.org/attachment/ticket/51368/51368.2.diff (applied cleanly to functions.php at r49033), grunt patch:23994, and grunt patch:https://github.com/WordPress/wordpress-develop/pull/13485.

AI assistance: Yes. Tool(s): Claude Code (Claude Fable 5.1). Used for: writing the browser helper, the ticket task, the tests, the PR description, and this comment.

This ticket was mentioned in ​PR #13696 on ​WordPress/wordpress-develop by ​@whyisjake.


8 weeks ago
#3

  • Keywords has-patch added

Trac now answers every non-browser request with a JavaScript bot-protection challenge (HTTP 403), which has broken grunt patch:<ticket> for every ticket since at least August. ​grunt-patch-wordpress#220 fixes that by fetching from Trac through the Playwright browser this repository already ships as a devDependency, and adds a ticket task:

grunt patch:66079
grunt ticket:66079
grunt ticket:66079 --json

This PR bumps the dependency. Nothing in Gruntfile.js changes: the package registers ticket under that name directly, and the existing patch and apply aliases keep working. The lockfile also loses 338 lines because the package no longer depends on the unmaintained request module.

Draft until 4.1.0 is on npm. The dependency is pinned to the PR commit (git+https://github.com/whyisjake/grunt-patch-wordpress.git#d8d6681…) so the change can be exercised in CI and locally now. Before commit it becomes "grunt-patch-wordpress": "~4.1.0" and the lockfile is regenerated. npm ci installs the git dependency over HTTPS; verified locally with SSH disabled.

One-time setup for anyone who wants grunt patch or grunt ticket: npx playwright install chromium, the same step the e2e suite needs. Without it both tasks print that command and exit.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable 5.1
Used for: regenerating the lockfile, verifying the git dependency installs without SSH, and drafting this description. The package changes are described and disclosed on grunt-patch-wordpress#220.

---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See ​GitHub Pull Requests for Code Review in the Core Handbook for more details.

🤖 Generated with ​Claude Code

#4 @jorbin
8 weeks ago

@obenland - Is it ok with the meta team for a headless browser to be used in this fashion? I understand that these restrictions exist for a reason so I don't want an official project to be circumventing them in an unacceptable manner.

#5 @obenland
7 weeks ago

Systems should be looped in so they are not surprised by headless-browser traffic from committers.

Has that happened yet? If not, or if @jorbin's message to me was meant to cover that, I'd recommend posting on ​make/systems and asking for a review there.

This ticket was mentioned in ​Slack in #meta by jorbin. ​View the logs.


7 weeks ago

Note: See TracTickets for help on using tickets.