Skip to content

Add WordPress.com simple site and Jetpack site support to WpApiClient#22765

Open
jkmassel wants to merge 13 commits intojkmassel/gutenbergkit-settings-refactorfrom
jkmassel/wpapiclient-wpcom-support
Open

Add WordPress.com simple site and Jetpack site support to WpApiClient#22765
jkmassel wants to merge 13 commits intojkmassel/gutenbergkit-settings-refactorfrom
jkmassel/wpapiclient-wpcom-support

Conversation

@jkmassel
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel commented Apr 3, 2026

Summary

PR 2 in the series splitting up the integrate/gutenberg-preloading branch (#22579).

  • WP.com simple site support in createSelfHostedClient: Use WpComDotOrgApiUrlResolver and WP.com bearer auth for simple sites (non-Atomic WP.com sites) instead of application password auth
  • Jetpack-connected site routing: Route sites using the WP.com REST API (isUsingWpComRestApi) through the WP.com API client alongside pure WP.com sites
  • Manifest route fetching: Add fetchWpComManifestRoutes and fetchSiteManifestRoutes methods to discover available REST API routes by fetching the API root index
  • Editor assets endpoint fix: Allow building the editor assets URL when the namespace is empty, which is the case for self-hosted sites

Test plan

  • Verify WP.com simple sites use WP.com auth and URL resolver
  • Verify Jetpack-connected sites route through the WP.com API client
  • Verify self-hosted sites continue to use application password auth
  • Verify fetchWpComManifestRoutes returns route paths for a WP.com site
  • Verify fetchSiteManifestRoutes returns route paths for a self-hosted site

jkmassel and others added 13 commits April 3, 2026 14:19
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These are replaced by the simplified GutenbergKitSettingsBuilder and
the new GutenbergEditorPreloader in subsequent commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inline the 18-parameter buildEditorConfiguration into
buildPostConfiguration, which now reads site/post fields directly from
SiteModel and PostImmutableModel. Also fixes a bug in shouldUsePlugins
where a stray `return false` made the method always return false.

Tests are updated to construct SiteModel objects instead of passing
individual primitives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the old GutenbergKitConfig builder pattern with a simpler
buildEditorConfiguration that calls buildPostConfiguration and
customizes locale, cookies, plugins, theme styles, and network
logging via toBuilder().

Remove the ProgressBar from the editor layout since GutenbergView
manages its own loading visibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inject EditorSettingsRepository so the builder can query editor settings
support when configuring theme styles. Extract buildCachedHosts and
buildEditorAssetsEndpoint into named methods. Update GutenbergKitActivity
to use the injected instance and remove redundant builder overrides.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Local draft posts have remotePostId defaulting to 0, which was
passed directly to GutenbergKit's setPostId(). GBK expects null
for unsaved posts. Now check isLocalDraft and pass null instead.
Wrap cursor usage in try/finally in getUseThemeStyles and
getUseThirdPartyBlocks so the cursor is always closed, even if
deserialization throws. Also fix four tests that were calling
buildPostConfiguration as a static method instead of on the
injected instance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove EditorSettingsRepository dependency from
  GutenbergKitSettingsBuilder (not part of this PR)
- Remove GutenbergKitWarmupHelper references from
  MySiteViewModel and its test
- Update GutenbergKitEditorFragment for GutenbergKit v0.15.0
  API: use GutenbergView constructor instead of createForEditor,
  accept EditorConfiguration in newInstance, remove obsolete
  startWithEditorSettings and EditorConfigurationBuilder usage
Remove EditorSettingsRepository mock and MockitoJUnitRunner since
the builder no longer takes constructor parameters. Fix UInt
comparison in published post ID test assertion.
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>
Remove the requirement for a non-empty namespace when building the
editor assets endpoint URL. Self-hosted sites have an empty namespace
but the wpcom/v2/editor-assets endpoint is still valid for them.

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.
@dangermattic
Copy link
Copy Markdown
Collaborator

1 Error
🚫 PR requires at least one label.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Copy Markdown
Contributor

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-bae20e0
Build Number1488
Application IDcom.jetpack.android.prealpha
Commitbae20e0
Installation URL2md7mohvfn03g
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

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-bae20e0
Build Number1488
Application IDorg.wordpress.android.prealpha
Commitbae20e0
Installation URL4t7mi6aunpn3o
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

🤖 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.

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.

5 participants