Skip to content

Gate taxonomies REST API migration behind a remote feature flag#23029

Merged
adalpari merged 5 commits into
release/26.9from
feature/categories-rest-api-migration-flag
Jun 24, 2026
Merged

Gate taxonomies REST API migration behind a remote feature flag#23029
adalpari merged 5 commits into
release/26.9from
feature/categories-rest-api-migration-flag

Conversation

@adalpari

@adalpari adalpari commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

The post categories taxonomy was migrated from XML-RPC to the REST API. For self-hosted sites with an Application Password, TaxonomyStore routes to the new wp-rs REST client (TaxonomyRsApiRestClient); previously this was gated only on site.isUsingSelfHostedRestApi().

This PR adds a new server-side remote feature flag, taxonomies_rest_api_migration, so the new self-hosted path can be rolled out (or reverted) remotely. The wp-rs path is now used only when both the Application-Password check passes and the flag is enabled. When the flag is off, self-hosted sites fall back to the exact pre-migration behavior (XML-RPC).

Note: this flag gates the whole self-hosted taxonomy path in TaxonomyStore, which covers both categories and tags — hence the taxonomies_ prefix.

Changes:

  • New taxonomies_rest_api_migration feature flag (TaxonomiesRestApiMigrationFeatureConfig, default off), wired via a small fluxc-side TaxonomiesRestApiMigrationConfig interface that the app implements in AppConfigModule (same app→fluxc bridge pattern used for UserAgent/AppSecrets, since fluxc can't depend on the app module).
  • TaxonomyStore now gates all self-hosted wp-rs routing through a single shouldUseTaxonomyRsApiRestClient(site) helper: fetchTerms, pushTerm, and the response-already-contains-term branch of handlePushTermCompleted (so an off-flag push correctly takes the XML-RPC follow-up-fetch path).
  • deleteTerm is also migrated to the wp-rs client under the same flag, closing a prior gap where self-hosted deletes always went to XML-RPC.

Note on the singular fetchTerm path: it is intentionally left ungated. The FETCH_TERM action (which routes to the single-term fetchTerm handler) has no dispatchers anywhere in the codebase — a repo-wide search for newFetchTermAction returns zero callers — so it was never migrated to the wp-rs client and is unreachable in production. The only reachable self-hosted taxonomy operations are fetchTerms (list), pushTerm, and deleteTerm, all of which this PR gates. (The mTaxonomyXMLRPCClient.fetchTerm(...) call inside handlePushTermCompleted is a direct call on the XML-RPC follow-up branch, not the gated path, so it stays correct by construction.)

Testing instructions

Routing logic is covered by unit tests in TaxonomyStoreRoutingTest (flag on → wp-rs client, flag off → XML-RPC, for fetch/push/delete; plus wp.com unaffected). Run them with:

./gradlew :libs:fluxc:testDebugUnitTest --tests "org.wordpress.android.fluxc.taxonomy.TaxonomyStoreRoutingTest"

Manual verification on a self-hosted (Application Password) site:

You can turn ON(OFF the FF by going to Me -> Debug Settings

Flag OFF (default):

  1. Open a self-hosted site and edit a post's categories; add and edit a category.
  • Verify via AppLog.T.API logs that XML-RPC endpoints are used and create/edit still resolves the slug
  1. Delete a category.
  • Verify the delete goes through XML-RPC

Flag ON (enable taxonomies_rest_api_migration remotely or via a debug override):
3. Repeat fetch / create / edit / delete of categories.

  • Verify wp-rs REST endpoints are used and operations complete with no XML-RPC follow-up fetch

WordPress.com / Jetpack sites:
4. Manage categories on a WP.com site with the flag both on and off.

  • Verify behavior is unchanged (still uses the WP.com REST client)

…ion flag

The new wp-rs taxonomy client is now used for self-hosted sites only when the
categories_rest_api_migration remote feature flag is enabled, so the migration
can be rolled out or reverted from the server. When disabled, self-hosted sites
fall back to the legacy XML-RPC client.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dangermattic

dangermattic commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator
2 Warnings
⚠️ Class TaxonomiesRestApiMigrationFeatureConfig is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot

wpmobilebot commented Jun 23, 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
Versionpr23029-ab9b1c6
Build Number1497
Application IDorg.wordpress.android.prealpha
Commitab9b1c6
Installation URL1hgoudbg5cup0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 23, 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
Versionpr23029-ab9b1c6
Build Number1497
Application IDcom.jetpack.android.prealpha
Commitab9b1c6
Installation URL5e7vkhu9416go
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

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

@adalpari adalpari changed the title Gate categories REST API migration behind a remote feature flag Gate taxonomies REST API migration behind a remote feature flag Jun 23, 2026
…api_migration

The flag gates the whole self-hosted taxonomy path in TaxonomyStore
(categories and tags), so the taxonomies_ prefix is more accurate.
Renames the flag string, BuildConfig field, both config classes, the
constant, the DI provider, and all references. Also drops an unused
Mockito import flagged by checkstyle in TaxonomyStoreRoutingTest.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.57%. Comparing base (43849a5) to head (ab9b1c6).

Files with missing lines Patch % Lines
...g/wordpress/android/fluxc/store/TaxonomyStore.java 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           release/26.9   #23029      +/-   ##
================================================
+ Coverage         37.56%   37.57%   +0.01%     
================================================
  Files              2325     2326       +1     
  Lines            125324   125332       +8     
  Branches          17187    17189       +2     
================================================
+ Hits              47073    47094      +21     
+ Misses            74433    74414      -19     
- Partials           3818     3824       +6     

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

@adalpari adalpari marked this pull request as ready for review June 24, 2026 07:22
@adalpari adalpari requested a review from nbradbury June 24, 2026 07:45
@adalpari adalpari enabled auto-merge (squash) June 24, 2026 11:46
@adalpari adalpari disabled auto-merge June 24, 2026 12:22

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! :shipit:

@adalpari adalpari merged commit 724641b into release/26.9 Jun 24, 2026
25 of 27 checks passed
@adalpari adalpari deleted the feature/categories-rest-api-migration-flag branch June 24, 2026 14:50
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