Skip to content

chore(cells) Remove more region references from UI code.#117463

Merged
markstory merged 3 commits into
masterfrom
chore-ui-remove-regions
Jun 12, 2026
Merged

chore(cells) Remove more region references from UI code.#117463
markstory merged 3 commits into
masterfrom
chore-ui-remove-regions

Conversation

@markstory

Copy link
Copy Markdown
Member

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. I've also removed the CUSTOMER_HIDDEN_REGIONS as we are controlling this with how we generate __initialData and the locality/cell split.

Refs INFRENG-332

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
@markstory markstory requested review from a team as code owners June 11, 2026 20:14
@linear-code

linear-code Bot commented Jun 11, 2026

Copy link
Copy Markdown

INFRENG-332

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 11, 2026

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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];

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.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0e0e12e. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That's ok, there aren't any single-tenant cells/localities in the wild.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.70% 93.70% ±0%
Typed 133,002 133,001 🔴 -1
Untyped 8,940 8,940 ±0
🔍 1 new type safety issue introduced

Type assertions (as) (1 new)

File Line Detail
static/app/views/setupWizard/utils/useOrganizationsWithRegion.tsx 42 as OrganizationSummaryWithLocality{...org, region: locality} as OrganizationSummaryWithLocality

This is informational only and does not block the PR.

Comment on lines +35 to 45
extra: {
organizationSlug: org.slug,
regionUrl: org.links.regionUrl,
},
});
return [];
}
return [{...org, region} as OrganizationSummaryWithRegion];
return [{...org, region: locality} as OrganizationSummaryWithLocality];
});
},
});

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.

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.

@markstory markstory merged commit d523ae6 into master Jun 12, 2026
77 checks passed
@markstory markstory deleted the chore-ui-remove-regions branch June 12, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants