[WOOMOB-54] Handle empty REST API namespaces during site login - #16408
Open
JorgeMucientes wants to merge 2 commits into
Open
[WOOMOB-54] Handle empty REST API namespaces during site login#16408JorgeMucientes wants to merge 2 commits into
JorgeMucientes wants to merge 2 commits into
Conversation
Collaborator
|
|
JorgeMucientes
marked this pull request as ready for review
August 12, 2026 15:06
There was a problem hiding this comment.
AI Code Review - No issues found. The changes look good.
The new guard returns an INVALID_RESPONSE error when a site's REST API exposes no namespaces, which cleanly prevents the login flow from proceeding into misleading setup screens. A couple of things I verified:
- The non-null accesses after the guard (
response.name,response.namespaces.any { ... }) compile correctly becauseisNullOrEmpty()'s Kotlin contract smart-casts bothresponseandresponse.namespacesto non-null on the fall-through path. - The error propagates as expected:
updateSitemaps it viaSiteErrorUtils.genericToSiteError, andWPApiSiteRepository.fetchSitelogs and surfaces it as a failure. - The behavior change is deliberate and release-noted; a site that previously "succeeded" with empty namespaces could not be verified as WooCommerce anyway, so erroring is the correct outcome.
- Test coverage is solid: empty namespaces, null namespaces, and non-empty-without-WooCommerce are all exercised.
Automatic review · claude-opus-4-8 · Workflow run
How to reply to a finding
Reply on this review (or inline at the line the finding refers to) with one of:
@claude addressed- I made the change. Bot verifies against the next diff before marking resolved.@claude rejected: <reason>- Will not fix; reason gets quoted on the next review.@claude not-applicable- Finding does not apply (wrong file, already covered elsewhere, etc.).
The bot honours these on the next review pass.
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
Fixes WOOMOB-54
When the WordPress REST API root response contains no namespaces, site-credentials login currently treats it as a valid non-WooCommerce site and can continue into misleading fallback UI. This change treats an absent or empty
namespacesfield as an invalid response so the existing generic site-fetch error is shown instead. Responses with populated namespaces keep their existing behavior.Test Steps
<?phpopening tag):https://YOUR-SITE/wp-json?_fields=namespacesand confirm the response contains"namespaces":[].Images/gif
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.