Skip to content

Add WP.com simple site and Jetpack site routing to WpApiClient#22765

Merged
jkmassel merged 3 commits intotrunkfrom
jkmassel/wpapiclient-wpcom-support
Apr 15, 2026
Merged

Add WP.com simple site and Jetpack site routing to WpApiClient#22765
jkmassel merged 3 commits intotrunkfrom
jkmassel/wpapiclient-wpcom-support

Conversation

@jkmassel
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel commented Apr 3, 2026

Summary

  • WP.com simple site URL routing: Add isWPComSimpleSite() to SiteModel and override getWpApiRestUrl() to return the public-api.wordpress.com proxy URL for simple (non-Atomic) WP.com sites
  • Jetpack site routing: Route sites using the WP.com REST API (isUsingWpComRestApi) through the WP.com API client alongside pure WP.com sites
  • Migrate to new apiUrlResolver constructor: Update createSelfHostedClient to use WpOrgSiteApiUrlResolver instead of the old wpOrgSiteApiRootUrl parameter

Test plan

  • Verify self-hosted sites continue to use application password auth and WpOrgSiteApiUrlResolver

@dangermattic
Copy link
Copy Markdown
Collaborator

dangermattic commented Apr 3, 2026

1 Warning
⚠️ This PR is assigned to the milestone 26.8. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 3, 2026

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr22765-c8548b8
Build Number1488
Application IDcom.jetpack.android.prealpha
Commitc8548b8
Installation URL6i94a9nk16acg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 3, 2026

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22765-c8548b8
Build Number1488
Application IDorg.wordpress.android.prealpha
Commitc8548b8
Installation URL4p235fqumeevg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented Apr 3, 2026

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

@jkmassel jkmassel force-pushed the jkmassel/gutenbergkit-settings-refactor branch from d538543 to 865899d Compare April 3, 2026 21:25
@jkmassel jkmassel requested a review from a team as a code owner April 3, 2026 21:25
@jkmassel jkmassel requested review from nbradbury and removed request for a team April 3, 2026 21:25
@jkmassel jkmassel force-pushed the jkmassel/gutenbergkit-settings-refactor branch 4 times, most recently from f861ada to 6cfa2a2 Compare April 4, 2026 03:47
@nbradbury
Copy link
Copy Markdown
Contributor

@jkmassel There are multiple conflicts and CI failures in this PR. Probably best to address that before I do a review.

@jkmassel jkmassel marked this pull request as draft April 6, 2026 04:27
@jkmassel
Copy link
Copy Markdown
Contributor Author

jkmassel commented Apr 6, 2026

@nbradbury – sorry, this was supposed to be a draft still!

Base automatically changed from jkmassel/gutenbergkit-settings-refactor to trunk April 9, 2026 19:17
@jkmassel jkmassel force-pushed the jkmassel/wpapiclient-wpcom-support branch from bae20e0 to bfebb4a Compare April 9, 2026 19:47
jkmassel and others added 2 commits April 9, 2026 14:24
Add `isWPComSimpleSite()` to SiteModel and use it to route WP.com
simple sites through the public-api.wordpress.com proxy with bearer
token authentication. This enables the Rust WP API client to make
authenticated requests for WPCom sites that don't use application
passwords.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Route sites using WP.com REST API (isUsingWpComRestApi) through the
WP.com API client, alongside pure WP.com sites. This enables Jetpack-
connected sites to use the correct authentication and URL resolution.

Add manifest route fetching methods (fetchWpComManifestRoutes,
fetchSiteManifestRoutes) that retrieve the API root index to
discover available REST routes for a site.
@jkmassel jkmassel force-pushed the jkmassel/wpapiclient-wpcom-support branch from bfebb4a to e9eba85 Compare April 9, 2026 20:51
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 37.50000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.34%. Comparing base (7b391e8) to head (c8548b8).
⚠️ Report is 9 commits behind head on trunk.

Files with missing lines Patch % Lines
...fluxc/network/rest/wpapi/rs/WpApiClientProvider.kt 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #22765   +/-   ##
=======================================
  Coverage   37.34%   37.34%           
=======================================
  Files        2327     2327           
  Lines      124639   124645    +6     
  Branches    16892    16894    +2     
=======================================
+ Hits        46551    46554    +3     
- Misses      74351    74354    +3     
  Partials     3737     3737           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jkmassel jkmassel changed the title Add WordPress.com simple site and Jetpack site support to WpApiClient Add WP.com simple site and Jetpack site routing to WpApiClient Apr 9, 2026
Cover isWPComSimpleSite() and the getWpApiRestUrl() proxy URL
override introduced in #22765, including the boundary between
Jetpack REST sites (routed via WP.com client) and WP.com simple
sites (get the proxy URL).
@jkmassel jkmassel self-assigned this Apr 13, 2026
@jkmassel jkmassel added this to the 26.8 milestone Apr 13, 2026
@jkmassel jkmassel marked this pull request as ready for review April 13, 2026 20:16
@nbradbury
Copy link
Copy Markdown
Contributor

@jkmassel This looks and works fine, but Claude found some potential issues.

review-pr22765-wpcom-routing-2026-04-15.pdf

@jkmassel
Copy link
Copy Markdown
Contributor Author

@nbradbury

  1. Getter/setter asymmetry — potential bug in ReactNativeStore and
    CookieNonceAuthenticator
    There's no case where it should be possible to overwrite the API root for a simple site.
  1. Incomplete constructor migration

I saw this – getWpApiClientCookiesNonceAuthentication is a transitional class – once everyone is on Application Passwords we don't need it anymore, so I left it alone to keep the changeset small.

  1. Redundant routing condition

I'm aware of this one as well – if isUsingWpComRestApi changes (which it may down the road, particularly for Jetpack sites) I don't want anything else to break.

These new methods don't really benefit from test coverage, because it'd be a "test that the code does what the code does" situation.

The trailing slash thing isn't relevant to this PR because this URL is only used to build the URL resolver. Semi-related, any path building that relies on concatenation instead of a path builder is probably buggy anyway 😅

Copy link
Copy Markdown
Contributor

@nbradbury nbradbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! :shipit:

@jkmassel jkmassel merged commit 24c17ab into trunk Apr 15, 2026
25 checks passed
@jkmassel jkmassel deleted the jkmassel/wpapiclient-wpcom-support branch April 15, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants