Repository navigation
Jetpack: only use the asset CDN for core versions it actually has - #2109
Merged
Merged
Conversation
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>
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
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 usedx.y.z-alpha-REVISION-src. The build strips-src, so the fleet reports a bare7.1.3. Jetpack's CDN module treats any barex.y.zas 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 ran7.1.2-alpha-63695and 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
jetpack_cdn_core_version_and_localeasks the CDN once whether it has the running version, with a HEAD request for jQuery at that path, and appends-unpublishedto the version when it doesn't. Jetpack then leaves core assets on the site, the same as for an alpha build.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 evalof the filter returns7.1.3-unpublished, the Sofia schedule page has noc0.wp.comreferences 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