Skip to content

Update wordpress-rs to 0.7.0 - #23237

Open
oguzkocer wants to merge 4 commits into
trunkfrom
update-wordpress-rs-to-0.7.0
Open

Update wordpress-rs to 0.7.0#23237
oguzkocer wants to merge 4 commits into
trunkfrom
update-wordpress-rs-to-0.7.0

Conversation

@oguzkocer

@oguzkocer oguzkocer commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Description

Updates wordpress-rs from 0.6.0 to 0.7.0 and adapts to its breaking API changes.

New error variants. RequestExecutionErrorReason gained ConnectionError (the host resolved but refused the connection or was unreachable) and WpRequestResult gained MediaFileUnreadable. Both when expressions in MediaRSApiRestClient are deliberately exhaustive with no else, so these surfaced as compile errors rather than silently degrading to GENERIC_ERROR — the guard doing its job.

  • MediaFileUnreadable maps to GENERIC_ERROR, which is where these failures already landed as a path-less generic error, so this is a no-op for users. FS_READ_PERMISSION_DENIED would claim a permissions problem we have no evidence of.
  • ConnectionError is grouped with DeviceIsOfflineError and InvalidSslError to CONNECTION_ERROR. This is a user-visible change: a refused or unreachable server previously arrived as HttpError and showed the generic error message, and now shows "connection to server lost". It matches MediaError.fromIOException, which already maps ConnectException to CONNECTION_ERROR on the non-RS path, so self-hosted RS sites stop reporting the same physical failure differently from WPCom/XMLRPC ones.

Comments list status parameter. CommentListParams.status now takes WpApiParamCommentsStatus instead of CommentStatus. The new type exists because the query vocabulary differs from the stored-status vocabulary — status=approved matched nothing and silently returned an empty result set. CommentsRsListTab already worked around that with CommentStatus.Custom("all") and Custom("approve") literals, so each tab's intent was unambiguous and the migration is a straight rename to the typed values. .All and .Approve send the same wire values the literals did, so tab contents are unchanged.

.Any is avoided throughout: it is a superset that also returns spam and trash, which no tab wants. CommentUpdateParams.status and the toRsCommentStatus/toAppCommentStatus mappers still use CommentStatus, which 0.7.0 did not change.

Two doc corrections.

  • The DefaultAddress comment in FetchAllDomainsUseCase claimed the subtype covers "managed" and "partner" subdomains. Nothing in wordpress-rs states that; it documents the free WordPress.com address plus the staging (*.wpcomstaging.com) and garden subdomains the server files under the same subtype.
  • uploadMedia with unreadable file in MediaRsApiRestClientTest now reads as though it covers the new MediaFileUnreadable variant. It does not — it asserts FS_READ_PERMISSION_DENIED from the canReadFile pre-flight check and never reaches the network. Renamed to name the check it tests. The assertions are unchanged.

Follow-ups filed, not addressed here

Testing instructions

Comment list tabs return the same contents as before:

  1. Open a site that has an application password, and go to Comments.
  2. Cycle through every tab: All, Pending, Unreplied, Approved, Spam, Trashed.
  • Verify each tab shows the comments it showed before this change.
  • Verify the Approved tab lists approved comments and is not empty on a site that has some.
  • Verify neither All nor Unreplied includes spam or trashed comments.
  1. Moderate a comment from one tab — approve, unapprove, spam, or trash it.
  • Verify it moves to the expected tab.

Regression sweep on the surfaces that touch wordpress-rs:

  1. On an application-password site, open Posts, Pages, and Stats.
  • Verify each loads without error.
  1. Open Domain search page from Me -> Domains -> Find a domain.
  • Verify the domain list loads and does not list free *.wordpress.com site addresses.

@oguzkocer oguzkocer added the dependencies Pull requests that update a dependency file label Aug 19, 2026
@dangermattic

dangermattic commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

Copy link
Copy Markdown
Contributor

Project dependencies changes

list
! Upgraded Dependencies
rs.wordpress.api:android:0.7.0, (changed from 0.6.0)
rs.wordpress.api:kotlin:0.7.0, (changed from 0.6.0)
tree
 +--- project :libs:fluxc
-|    \--- rs.wordpress.api:android:0.6.0
-|         +--- com.squareup.okhttp3:okhttp:5.4.0 (*)
-|         +--- com.squareup.okhttp3:okhttp-tls:5.4.0
-|         |    +--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.4.10 (*)
-|         |    +--- com.squareup.okio:okio:3.17.0 (*)
-|         |    \--- com.squareup.okhttp3:okhttp:5.4.0 (*)
-|         +--- net.java.dev.jna:jna:5.19.1
-|         +--- rs.wordpress.api:kotlin:0.6.0
-|         |    +--- com.squareup.okhttp3:okhttp:5.4.0 (*)
-|         |    +--- com.squareup.okhttp3:okhttp-tls:5.4.0 (*)
-|         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2 -> 1.11.0 (*)
-|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.4.10 (*)
-|         \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.4.10 (*)
+|    \--- rs.wordpress.api:android:0.7.0
+|         +--- com.squareup.okhttp3:okhttp:5.4.0 (*)
+|         +--- com.squareup.okhttp3:okhttp-tls:5.4.0
+|         |    +--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.4.10 (*)
+|         |    +--- com.squareup.okio:okio:3.17.0 (*)
+|         |    \--- com.squareup.okhttp3:okhttp:5.4.0 (*)
+|         +--- net.java.dev.jna:jna:5.19.1
+|         +--- rs.wordpress.api:kotlin:0.7.0
+|         |    +--- com.squareup.okhttp3:okhttp:5.4.0 (*)
+|         |    +--- com.squareup.okhttp3:okhttp-tls:5.4.0 (*)
+|         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2 -> 1.11.0 (*)
+|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.3.21 -> 2.4.10 (*)
+|         \--- org.jetbrains.kotlin:kotlin-stdlib:2.3.21 -> 2.4.10 (*)
-\--- rs.wordpress.api:android:0.6.0 (*)
+\--- rs.wordpress.api:android:0.7.0 (*)

@wpmobilebot

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

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

Handle the two new error variants the exhaustive `when`s in
`MediaRSApiRestClient` now have to cover, and move the comments list
`status` param onto the type `CommentListParams` requires.

`WpApiParamCommentsStatus` supersedes the `CommentStatus.Custom("all")`
and `Custom("approve")` literals the tabs used, because `status=approved`
returned no comments. `.All` and `.Approve` send the same wire values, so
tab contents are unchanged. `.Any` is avoided throughout: it is a
superset that also returns spam and trash.

Changes:
- Map `MediaFileUnreadable` to `GENERIC_ERROR`, where these failures
  already landed as a path-less generic error
- Group `ConnectionError` with `DeviceIsOfflineError` to `CONNECTION_ERROR`,
  matching `MediaError.fromIOException` on the non-RS path
- Type `CommentsRsListTab.queryStatus` and `firstPageParams` as
  `WpApiParamCommentsStatus`
- Update the tab and mapping tests to the new values
@wpmobilebot

wpmobilebot commented Aug 19, 2026

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
Versionpr23237-a9bebe7
Build Number1498
Application IDorg.wordpress.android.prealpha
Commita9bebe7
Installation URL4u94ck3pqdkb8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Aug 19, 2026

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
Versionpr23237-a9bebe7
Build Number1498
Application IDcom.jetpack.android.prealpha
Commita9bebe7
Installation URL6caccvnrqeu10
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.92%. Comparing base (419039b) to head (a9bebe7).
⚠️ Report is 3 commits behind head on trunk.

Files with missing lines Patch % Lines
...c/network/rest/wpapi/media/MediaRSApiRestClient.kt 0.00% 4 Missing and 2 partials ⚠️
...ndroid/ui/comments/unified/CommentsRsDataSource.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #23237      +/-   ##
==========================================
- Coverage   37.92%   37.92%   -0.01%     
==========================================
  Files        2334     2334              
  Lines      126984   126990       +6     
  Branches    17589    17591       +2     
==========================================
  Hits        48162    48162              
- Misses      74888    74892       +4     
- Partials     3934     3936       +2     

☔ View full report in Codecov by Harness.
📢 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.

… APIs

`DefaultAddress` is documented as covering the free WordPress.com address
plus the staging and garden subdomains the server files under it. Drop
"managed" and "partner", which nothing in wordpress-rs states.

Rename the upload pre-flight test, whose name now reads as though it
covers `WpRequestResult.MediaFileUnreadable`. It asserts
`FS_READ_PERMISSION_DENIED` from the `canReadFile` check and never
reaches the network.

Changes:
- Narrow the `DefaultAddress` doc comment in `FetchAllDomainsUseCase` to
  the subtypes wordpress-rs documents
- Rename `uploadMedia with unreadable file` to name the pre-flight check
Changes:
- Drop the `FS_READ_PERMISSION_DENIED` rationale from the
  `MediaFileUnreadable` branch, keeping the two lines that describe what
  the variant means
- Drop the `ConnectionError` comment; the branch it sits in already says
  it maps to `CONNECTION_ERROR`
- Drop the comment above the upload pre-flight test, whose name states
  what it covers
- Reduce the `WpApiParamCommentsStatus` note in `CommentsRsListTab` to
  the distinction between `All` and `Any`
@oguzkocer
oguzkocer marked this pull request as ready for review August 20, 2026 02:18
@oguzkocer
oguzkocer requested a review from a team as a code owner August 20, 2026 02:18
@oguzkocer oguzkocer changed the title WIP: Update wordpress-rs to 0.7.0 Update wordpress-rs to 0.7.0 Aug 20, 2026
@oguzkocer

Copy link
Copy Markdown
Contributor Author

@adalpari @nbradbury I have gone through all the wordpress-rs changes and applied the relevant parts to WPAndroid. Some of the breaking changes that I was most scared of didn't end up requiring any changes. However, this is still a big release and it would be great if you can both test the features that you've personally worked on, beyond the changes that ended up in the diff. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants