chore(cells) Remove more region references from UI code.#117463
Conversation
Remove `regions` and `memberRegions` from the `Config` type which makes usage of those keys type errors. Once this has landed I'll remove the data from `__initialData`. Refs INFRENG-332
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0e0e12e. Configure here.
| return []; | ||
| } | ||
| return [{...org, region} as OrganizationSummaryWithRegion]; | ||
| return [{...org, region: locality} as OrganizationSummaryWithLocality]; |
There was a problem hiding this comment.
Setup wizard drops non-locality orgs
Medium Severity
useOrganizationsWithRegion now maps org.links.regionUrl using getLocalities() instead of memberRegions. Customer localities only includes visible multi-tenant localities, while memberRegions included every locality where the user has cell membership (including single-tenant and hidden). Organizations whose regionUrl is not in the localities list are omitted from the setup wizard.
Reviewed by Cursor Bugbot for commit 0e0e12e. Configure here.
There was a problem hiding this comment.
That's ok, there aren't any single-tenant cells/localities in the wild.
📊 Type Coverage Diff
🔍 1 new type safety issue introducedType assertions (
This is informational only and does not block the PR. |
| extra: { | ||
| organizationSlug: org.slug, | ||
| regionUrl: org.links.regionUrl, | ||
| }, | ||
| }); | ||
| return []; | ||
| } | ||
| return [{...org, region} as OrganizationSummaryWithRegion]; | ||
| return [{...org, region: locality} as OrganizationSummaryWithLocality]; | ||
| }); | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Bug: The useOrganizationsWithRegion hook incorrectly filters out single-tenant organizations because the backend now only provides multi-tenant regions, breaking the setup wizard for affected users.
Severity: HIGH
Suggested Fix
The backend should provide a complete list of all regions a user has access to, including single-tenant ones, to the frontend. Alternatively, the frontend logic in useOrganizationsWithRegion could be adjusted to handle cases where an organization's region is not in the localitiesByUrl map, instead of silently filtering it out.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/views/setupWizard/utils/useOrganizationsWithRegion.tsx#L25-L45
Potential issue: The `useOrganizationsWithRegion` hook filters organizations based on a
list of regions from the backend. A change in `client_config.py` now causes this list to
only contain multi-tenant regions by using `find_all_multitenant_locality_names()`.
Consequently, when the frontend hook processes a user's organizations, any organization
in a single-tenant region will not have its `regionUrl` in the `localitiesByUrl` map.
The `flatMap` operation then silently drops these organizations, preventing them from
being displayed. This makes the setup wizard unusable for users who are only members of
single-tenant organizations.
Did we get this right? 👍 / 👎 to inform future reviews.


Remove
regionsandmemberRegionsfrom theConfigtype which makes usage of those keys type errors. Once this has landed I'll remove the data from__initialData. I've also removed theCUSTOMER_HIDDEN_REGIONSas we are controlling this with how we generate__initialDataand the locality/cell split.Refs INFRENG-332