fix: Request taxonomies with view context for Author/Editor roles - #23291
Open
dcalhoun wants to merge 3 commits into
Open
fix: Request taxonomies with view context for Author/Editor roles#23291dcalhoun wants to merge 3 commits into
dcalhoun wants to merge 3 commits into
Conversation
Contributor
|
|
Contributor
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #23291 +/- ##
=======================================
Coverage 37.93% 37.93%
=======================================
Files 2352 2352
Lines 128925 128938 +13
Branches 17940 17948 +8
=======================================
+ Hits 48907 48916 +9
Misses 76012 76012
- Partials 4006 4010 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dcalhoun
force-pushed
the
fix/cmm-2398-author-category-picker
branch
from
September 3, 2026 19:15
26fd45e to
08a3f76
Compare
Listing categories and tags over wordpress-rs used context=edit, which WP core gates on the taxonomy's edit_terms capability (manage_categories / manage_post_tags). Authors and Contributors hold neither, so the REST API answered 403 rest_forbidden_context and the post editor's picker reported a refresh error instead of listing the site's terms. The listing is a read and the view context carries every field this client maps, so request that instead. Term failures now also map 401 and 403 to TaxonomyErrorType.UNAUTHORIZED, keeping the parity TaxonomyXMLRPCClient already has as the wp-rs path replaces it. No caller branches on the type yet, so this shows up only in the taxonomy log lines. Failures are logged through toLogErrorString() rather than interpolating the raw result, which put response bodies in the log. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3eKPoHZwqK4AP3GQBSgEG
notifyFailedDeleting() wrote one line for two different failures, and once it took the request result it logged a literal null for the case where the request succeeded and the API reported the term as not deleted. Log at the call sites instead, where the result is still in scope, so the two are distinguishable, and let the function take the error it dispatches. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3eKPoHZwqK4AP3GQBSgEG
createTestAnyTermWithViewContext() was a field-for-field copy of createTestAnyTermWithEditContext(), so every change to the term under test had to be made twice and a test updating only one would assert against divergent data. The generated edit and view types share no supertype, so keep the values in one place and build each type from them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y3eKPoHZwqK4AP3GQBSgEG
dcalhoun
force-pushed
the
fix/cmm-2398-author-category-picker
branch
from
September 3, 2026 19:35
08a3f76 to
6fdfbfe
Compare
dcalhoun
marked this pull request as ready for review
September 3, 2026 19:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Fix CMM-2398.
An Author or Contributor on an Atomic or self-hosted site got a blocking "Category refresh error" when opening the category picker in the post editor, and could not assign categories at all. Switching the user to Editor cleared it.
Root cause.
TaxonomyRsApiRestClient.fetchTermslisted terms withlistWithEditContext, i.e.GET /wp/v2/categories?context=edit. WP core gates that context on the taxonomy'sedit_termscapability —manage_categoriesforcategory,manage_post_tagsforpost_tag— which Authors and Contributors do not hold, so the API answered403 rest_forbidden_context. The client turned that into a generic error and the picker reported a refresh failure instead of listing the site's terms.Listing terms is a read, and the view context returns every field this client maps (no term field is edit-only, and
name/descriptionare identical across contexts), so it now requestscontext=view.Scope. The
taxonomies_rest_api_migrationflag is rolled out to 50% of users on 26.9+, so this affects Authors and Contributors on Atomic and self-hosted sites, for both categories and tags. The tags breakage was silent:TagsFragmentignores fetch errors, so tag suggestions simply came back empty.Testing instructions
Note
Requires a test user set to Author on an Atomic site. The
taxonomies_rest_api_migrationfeature flag must be enabled in the dev menu.Note that
SelectCategoriesActivityonly fetches when its list is empty, so clear app storage or sign out and back in before each cold-cache run — a warm cache hides the bug.Categories (the reported issue):
trunk, as the Author, open a post → Post Settings → Categories.Tags (same fix, no cache clearing needed):
trunkthey are silently empty)Refresh failure handling (unchanged from
trunk):*/categories*with a 500, then pull to refresh.Regressions:
deletestill work1🤖 Generated with Claude Code
https://claude.ai/code/session_01Y3eKPoHZwqK4AP3GQBSgEG
Footnotes
Deleting is broken: https://github.com/wordpress-mobile/WordPress-Android/issues/23293 ↩