Skip to content

Conversation

adalpari
Copy link
Contributor

@adalpari adalpari commented Oct 1, 2025

Description

This PR updates the taxonomy CRUD implementation to use the new generic WordPress-RS API instead of the previous category and tag-specific endpoints. So, from now on, all terms will be used the same way by just specifying the taxonomy name.

Testing instructions

  1. Log into a self-hosted site USING Application Password credentials
  2. Go to "Site Settings"
  3. Smoke test "Categories" and "Tags"
  • Verify Categories CRUD work as expected
  • Verify Tags CRUD work as expected
Screen.Recording.2025-10-01.at.14.41.07.mov
Screen.Recording.2025-10-01.at.14.40.33.mov

@adalpari adalpari requested a review from Copilot October 1, 2025 12:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the taxonomy API implementation to use the new generic wordpress-rs API instead of the previous category and tag-specific endpoints. The main purpose is to modernize the codebase by consolidating separate category and tag handling into a unified terms API approach.

  • Replaces separate category and tag API classes with unified term endpoints using TermEndpointType
  • Adds isHierarchical field to TermModel to distinguish between hierarchical (categories) and flat (tags) taxonomies
  • Updates all related test files and usage sites to accommodate the new API structure

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
TaxonomyRsApiRestClient.kt Complete refactor to use unified terms API instead of separate category/tag endpoints
TermModel.java Added isHierarchical boolean field and updated constructor
WellSqlConfig.kt Database migration to add IS_HIERARCHICAL column to TermModel
TaxonomyRsApiRestClientTest.kt Updated tests to use new unified API and added isHierarchical field
TaxonomyTestUtils.java Updated test helper to include isHierarchical parameter
Various other files Updated to accommodate new API signature and field additions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dangermattic
Copy link
Collaborator

dangermattic commented Oct 1, 2025

2 Warnings
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

Project dependencies changes

list
! Upgraded Dependencies
net.java.dev.jna:jna:5.18.0, (changed from 5.17.0)
rs.wordpress.api:android:trunk-d0c9eebab77e8701810077ac1fba7d39ef8d121f, (changed from trunk-f4e2450ca5545a4909cb08273f37a7f694244921)
rs.wordpress.api:kotlin:trunk-d0c9eebab77e8701810077ac1fba7d39ef8d121f, (changed from trunk-f4e2450ca5545a4909cb08273f37a7f694244921)
tree
 +--- project :libs:fluxc
-|    \--- rs.wordpress.api:android:trunk-f4e2450ca5545a4909cb08273f37a7f694244921
-|         +--- com.squareup.okhttp3:okhttp:4.12.0 (*)
-|         +--- com.squareup.okhttp3:okhttp-tls:4.12.0
-|         |    +--- com.squareup.okhttp3:okhttp:4.12.0 (*)
-|         |    +--- com.squareup.okio:okio:3.6.0 -> 3.9.0 (*)
-|         |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21 -> 1.9.24 (*)
-|         +--- net.java.dev.jna:jna:5.17.0
-|         +--- rs.wordpress.api:kotlin:trunk-f4e2450ca5545a4909cb08273f37a7f694244921
-|         |    +--- com.squareup.okhttp3:okhttp:4.12.0 (*)
-|         |    +--- com.squareup.okhttp3:okhttp-tls:4.12.0 (*)
-|         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2 (*)
-|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.2.10 (*)
-|         \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.2.10 (*)
+|    \--- rs.wordpress.api:android:trunk-d0c9eebab77e8701810077ac1fba7d39ef8d121f
+|         +--- com.squareup.okhttp3:okhttp:4.12.0 (*)
+|         +--- com.squareup.okhttp3:okhttp-tls:4.12.0
+|         |    +--- com.squareup.okhttp3:okhttp:4.12.0 (*)
+|         |    +--- com.squareup.okio:okio:3.6.0 -> 3.9.0 (*)
+|         |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21 -> 1.9.24 (*)
+|         +--- net.java.dev.jna:jna:5.18.0
+|         +--- rs.wordpress.api:kotlin:trunk-d0c9eebab77e8701810077ac1fba7d39ef8d121f
+|         |    +--- com.squareup.okhttp3:okhttp:4.12.0 (*)
+|         |    +--- com.squareup.okhttp3:okhttp-tls:4.12.0 (*)
+|         |    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2 (*)
+|         |    \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.2.10 (*)
+|         \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.21 -> 2.2.10 (*)
-+--- rs.wordpress.api:android:trunk-f4e2450ca5545a4909cb08273f37a7f694244921 (*)
++--- rs.wordpress.api:android:trunk-d0c9eebab77e8701810077ac1fba7d39ef8d121f (*)
 \--- com.automattic:encryptedlogging:1.1.0
-     \--- net.java.dev.jna:jna:5.17.0
+     \--- net.java.dev.jna:jna:5.17.0 -> 5.18.0

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Oct 1, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr22252-03b8a91
Commit03b8a91
Direct Downloadwordpress-prototype-build-pr22252-03b8a91.apk
Note: Google Login is not supported on these builds.

Copy link

sonarqubecloud bot commented Oct 1, 2025

@wpmobilebot
Copy link
Contributor

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr22252-03b8a91
Commit03b8a91
Direct Downloadjetpack-prototype-build-pr22252-03b8a91.apk
Note: Google Login is not supported on these builds.

Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 78.10219% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.91%. Comparing base (bbcdfad) to head (03b8a91).
⚠️ Report is 4 commits behind head on trunk.

Files with missing lines Patch % Lines
...ork/rest/wpapi/taxonomy/TaxonomyRsApiRestClient.kt 81.10% 16 Missing and 8 partials ⚠️
...ordpress/android/ui/selfhostedusers/SampleUsers.kt 0.00% 3 Missing ⚠️
.../wordpress/android/ui/posts/EditCategoryUseCase.kt 0.00% 1 Missing ⚠️
...rdpress/android/fluxc/persistence/WellSqlConfig.kt 50.00% 1 Missing ⚠️
...g/wordpress/android/fluxc/store/TaxonomyStore.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22252      +/-   ##
==========================================
- Coverage   39.98%   39.91%   -0.07%     
==========================================
  Files        2165     2165              
  Lines      102627   102511     -116     
  Branches    14766    14771       +5     
==========================================
- Hits        41034    40922     -112     
+ Misses      58130    58122       -8     
- Partials     3463     3467       +4     

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

@adalpari adalpari marked this pull request as ready for review October 1, 2025 13:19
@adalpari adalpari requested a review from a team as a code owner October 1, 2025 13:19
@adalpari adalpari requested a review from jkmassel October 1, 2025 13:20
@adalpari adalpari requested review from dcalhoun and oguzkocer October 3, 2025 09:17
Copy link
Member

@dcalhoun dcalhoun 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. 🧹 Changes tested well for me.

I noted one issue, but it also occurs in the production release. Attempting to modify a term without a network connection causes the app to enter an infinite "Saving" state. Ideally, we handle the failed request with an error message and potentially retry when the network connection returns. Currently, the app remains in the saving state even after regaining a network connection. The user is unable to exit the screen and must quit the app.

Screen recording
Screen_Recording_20251003_074824_Jetpack.Pre-Alpha.mp4

@adalpari
Copy link
Contributor Author

adalpari commented Oct 3, 2025

Looks good. 🧹 Changes tested well for me.

I noted one issue, but it also occurs in the production release. Attempting to modify a term without a network connection causes the app to enter an infinite "Saving" state. Ideally, we handle the failed request with an error message and potentially retry when the network connection returns. Currently, the app remains in the saving state even after regaining a network connection. The user is unable to exit the screen and must quit the app.

Thank you for the heads up. I experimented something similar, but I think it's better to work on it as a separate bug since it's not related to the migration.

@adalpari adalpari merged commit 33d22f3 into trunk Oct 3, 2025
28 checks passed
@adalpari adalpari deleted the task/CMM-808-port-categories-and-tags-to-the-new-generic-wordpress-rs-endpoint branch October 3, 2025 12:18
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