Skip to content

Jetpack: only use the asset CDN for core versions it actually has - #2109

Merged
mcliwanow merged 4 commits into
productionfrom
claude/jetpack-cdn-version
Sep 22, 2026
Merged

mcliwanow merged 4 commits into
productionfrom
claude/jetpack-cdn-version

Conversation

@mcliwanow

Copy link
Copy Markdown
Contributor

Why

Since this afternoon every wordcamp.org site with Jetpack's Site Accelerator on loads its core scripts and styles from https://c0.wp.com/c/7.1.3/..., and every one of those is a 404. jQuery, lodash, moment, wp-sanitize and dashicons are missing, so anything built on them is broken: the schedule block, favourite sessions, CampTix, the admin bar. Sofia, Europe, Pisa, Johannesburg and Asia 2026 are confirmed, logged in and out.

wordpress.org deploys core from the 7.1 branch. Today's post-7.1.2 bump set the branch to 7.1.3-src (wordpress-develop 0e7633e), where every earlier bump used x.y.z-alpha-REVISION-src. The build strips -src, so the fleet reports a bare 7.1.3. Jetpack's CDN module treats any bare x.y.z as a released version and rewrites core asset URLs to the CDN without checking that the directory exists. It won't exist until 7.1.3 ships. This morning the same sites ran 7.1.2-alpha-63695 and loaded everything locally, which is how it has worked for every alpha build until now.

The version string needs fixing on the core side too, but that doesn't stop the same thing happening on the next bump.

What changed

  • A filter on jetpack_cdn_core_version_and_locale asks the CDN once whether it has the running version, with a HEAD request for jQuery at that path, and appends -unpublished to the version when it doesn't. Jetpack then leaves core assets on the site, the same as for an alpha build.
  • The answer is a site transient: a day for yes, an hour for no, five minutes for a failed request, plus a static for the rest of the request since Jetpack asks on every print hook. Requests in the normal state: one per network per day. When 7.1.3 really ships, sites go back to the CDN within the hour with no deploy.
  • Alpha and RC builds are never checked. Jetpack doesn't use the CDN for them and the version changes on every core commit.

The worst case is Jetpack not using the CDN for core assets, which is what central.wordcamp.org does today and what every alpha build has done. Nothing here can make a working asset 404.

Testing

Five tests in --group jetpack, faking the HTTP transport: released version passes through, missing version is marked, cached answer makes no request, failed request is remembered, alpha build makes no request. phpcs clean.

Verified on my sandbox running the same 7.1.3 build as production: wp eval of the filter returns 7.1.3-unpublished, the Sofia schedule page has no c0.wp.com references and loads jQuery, lodash, moment and wp-sanitize from the site, and the schedule renders after a menu click on Sofia (30 sessions) and UniPu (7).

🤖 Generated with Claude Code

mcliwanow and others added 4 commits September 22, 2026 19:21
dotorg runs core builds that haven't been released yet, and their version can look
like a public release, so Jetpack rewrote core scripts and styles to c0.wp.com URLs
that 404. Check once per version whether the CDN serves it, cache the answer
network-wide, and fall back to serving core assets from the site when it doesn't.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Jetpack asks for the core version on every print_scripts and print_styles
hook, so a failed check would otherwise cost one timed-out request per hook.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
An unreachable CDN otherwise costs every page load a two-second timeout.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Jetpack never uses the CDN for those, and the version changes on every core
commit, so checking would cost a request and a transient per deploy.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mcliwanow mcliwanow self-assigned this Sep 22, 2026
@mcliwanow
mcliwanow merged commit 60b3d67 into production Sep 22, 2026
5 checks passed
@mcliwanow
mcliwanow deleted the claude/jetpack-cdn-version branch September 22, 2026 18:07
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.

1 participant