Skip to content

build: bump wordpress-rs to 0.6.0 in the demo apps - #572

Draft
dcalhoun wants to merge 3 commits into
trunkfrom
build/bump-wordpress-rs-0.6.0
Draft

build: bump wordpress-rs to 0.6.0 in the demo apps#572
dcalhoun wants to merge 3 commits into
trunkfrom
build/bump-wordpress-rs-0.6.0

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Jul 31, 2026

Copy link
Copy Markdown
Member

What?

Bumps wordpress-rs from pre-release pins to the 0.6.0 release on both platforms, and adapts to the API changes that release introduced.

Why?

Neither demo app can load a self-hosted site's data when the site uses plain permalinks. Such a site has no path-based REST root — WordPress advertises the query form https://site/?rest_route=/ instead. Both apps were pinned to March builds that constructed endpoint URLs by extending the root's path, leaving the rest_route query dangling, so requests returned a non-JSON page.

The symptom differed by platform, which is why this went unnoticed on Android:

  • iOS surfaced it — Editor Configuration failed outright with "Response couldn't be parsed: expected value at line 1 column 1".
  • Android hid it — loadPostTypes returns null on failure and the caller substitutes a hardcoded post, so the screen opened but the post-type picker listed only "Posts" instead of the site's real types.

wordpress-rs fixed this in 2924e36b (July 6), included in 0.6.0: WpOrgSiteApiUrlResolver::resolve now appends into the rest_route value rather than the path. Both pins predated it by ~4 months.

How?

iOS — package requirement moves from kind = revision / alpha-20260313 to 0.6.0. Replaces the removed apiRootUrl and apiUrlResolver arguments on WordPressAPI with the new SiteInfo enum, matching WordPress-iOS#25516.

Android — version catalog moves from trunk-dc86c7a6 to 0.6.0. This required two build changes in the demo app only:

  • compileSdk/targetSdk 34 → 36, because 0.6.0 pulls okhttp 5.4.0, which requires API 36.
  • minSdk 24 → 26, required by the 0.6.0 AAR manifest.

Only :app depends on wordpress-rs, so the published :Gutenberg library keeps compileSdk 34 and minSdk 24 — this is not a breaking change for library consumers. WordPress-Android already builds against 36 with minSdk 26 and consumes wordpress-rs 0.6.0, so the demo app is not moving ahead of its host.

0.6.0 also removed wordpressComSiteApiRoot() from the wp_mobile account layer. It's replaced with a local helper using the identical URL format (…/wp/v2/sites/{id}), which matters because the demo app parses the site ID back out of the stored account in two places. WordPress-Android has no equivalent to update — it uses only the client and login APIs, not wordpress-rs account persistence.

Demo apps and their build configuration only — no changes to the published GutenbergKit library or its SDK levels.

Testing Instructions

You need a self-hosted site set to Settings ▸ Permalinks ▸ Plain. Confirm it advertises the query-form REST root before starting:

curl -sI https://your-site.com/ | grep -i '^link'

The rel="https://api.w.org/" value should contain ?rest_route=/ rather than /wp-json/.

iOS

  1. Open ios/Demo-iOS/Gutenberg.xcodeproj.
  2. If the build reports a missing libwordpressFFI.xcframework, run File ▸ Packages ▸ Resolve Package Versions — the pin change invalidates the cached binary artifact.
  3. Build, run, and add the plain-permalink site using an application password.
  4. Open its Editor Configuration screen.

Before: fails with "Response couldn't be parsed: expected value at line 1 column 1". After: the screen loads and the API Root row shows the ?rest_route= form.

Android

  1. Build and run the demo app, then add the same plain-permalink site.
  2. Open its Editor Configuration screen and check the Post Type picker.

Before: only "Posts". After: the site's real post types, including "Pages".

Both — confirm no regression for a pretty-permalink site and a WP.com site; each should behave as before. On Android, WP.com sign-in is worth exercising specifically, since it covers the wordPressComSiteApiRoot replacement.

Note that reaching a fully working editor on a plain-permalink site also needs the library fix in fix/support-plain-permalinks, which is stacked on this branch — this PR gets site preparation past the failures above.

Accessibility Testing Instructions

N/A — no user interface changes.

The demo app was pinned to the `alpha-20260313` revision, which predates
the plain-permalink fix in wordpress-rs (2924e36b, "Fix self-hosted login
on plain-permalink sites"). On a site using plain permalinks, endpoint
URLs were built by extending the root's path, so loading post types
failed to parse a non-JSON response before the editor could open.

Migrate to the `SiteInfo` API, which replaces the `apiRootUrl` and
`apiUrlResolver` arguments on `WordPressAPI`, matching the equivalent
change in WordPress-iOS#25516.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the [Type] Build Tooling Issues or PRs related to build tooling label Jul 31, 2026
@wpmobilebot

wpmobilebot commented Jul 31, 2026

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/572")

Built from 0dd6547

@dcalhoun dcalhoun changed the title build(ios): bump wordpress-rs to 0.6.0 in the demo app build: bump wordpress-rs to 0.6.0 in the demo apps Jul 31, 2026
The demo app was pinned to a March trunk build predating the
plain-permalink fix in wordpress-rs (2924e36b). Unlike iOS, the failure
was silent: `loadPostTypes` returns null on error and the caller falls
back to a hardcoded `post` type, so a plain-permalink site opened the
editor configuration with only "Posts" in the picker rather than the
site's real post types.

0.6.0 requires compileSdk 36 (via okhttp 5.4.0) and minSdk 26, so raise
both in the demo app. Only `:app` depends on wordpress-rs, so the
published `:Gutenberg` library keeps compileSdk 34 and minSdk 24 and its
consumers are unaffected. WordPress-Android already builds against 36
with minSdk 26, so the demo app is not moving ahead of its host.

0.6.0 also removed `wordpressComSiteApiRoot()`. Replace it with a local
constant using the same URL format, which the demo app relies on to
recover the site ID from a stored account.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The local WordPress branch caught `URLError` to explain that wp-env may
not be running, but that clause could never match. wordpress-rs
intercepts the underlying `URLError` in `SafeRequestExecutor` and rewraps
it as `WpApiError.RequestExecutionFailed(reason: .nonExistentSiteError)`,
so a stopped wp-env surfaced the raw "A server with the specified
hostname could not be found." instead of the guidance.

Match the rewrapped error as well, mirroring the existing
`isNetworkError` helper.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants