ref(cells): Remove usage of Region.category#109840
Merged
Conversation
"category" will be removed from Region/Cell, and will only be a property of locality. Now there are no more callers to Region.category. It still exists as `_category` as it's still (temporarily) needed for the 1:1 cell/locality shim.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Constructor uses
_categorybut field is namedcategory- Updated both incorrect
Regionconstructor calls to use the correctcategory=keyword so required dataclass validation succeeds.
- Updated both incorrect
Or push these changes by commenting:
@cursor push 562e5490ca
Preview (562e5490ca)
diff --git a/src/sentry/testutils/helpers/apigateway.py b/src/sentry/testutils/helpers/apigateway.py
--- a/src/sentry/testutils/helpers/apigateway.py
+++ b/src/sentry/testutils/helpers/apigateway.py
@@ -143,7 +143,7 @@
name="us",
snowflake_id=1,
address="http://us.internal.sentry.io",
- _category=RegionCategory.MULTI_TENANT,
+ category=RegionCategory.MULTI_TENANT,
)
def setUp(self):
diff --git a/src/sentry/testutils/silo.py b/src/sentry/testutils/silo.py
--- a/src/sentry/testutils/silo.py
+++ b/src/sentry/testutils/silo.py
@@ -91,7 +91,7 @@
name=name,
snowflake_id=index + 1,
address=generate_locality_url(name),
- _category=(
+ category=(
RegionCategory.SINGLE_TENANT
if name in single_tenants
else RegionCategory.MULTI_TENANT
Contributor
Backend Test FailuresFailures on
|
Contributor
Backend Test FailuresFailures on
|
markstory
approved these changes
Mar 5, 2026
src/sentry/types/region.py
Outdated
| def get_cells(self, category: RegionCategory | None = None) -> Iterable[Region]: | ||
| return (r for r in self.regions if (category is None or r.category == category)) | ||
| if category is None: | ||
| return iter(self.regions) |
Member
There was a problem hiding this comment.
Suggested change
| return iter(self.regions) | |
| return iter(self._cells) |
Comment on lines
+174
to
+176
| r | ||
| for r in self.regions | ||
| if (loc := self._cell_to_locality.get(r.name)) is not None and loc.category == category |
Member
There was a problem hiding this comment.
Suggested change
| r | |
| for r in self.regions | |
| if (loc := self._cell_to_locality.get(r.name)) is not None and loc.category == category | |
| c | |
| for c in self._cells | |
| if (loc := self._cell_to_locality.get(c.name)) is not None and loc.category == category |
Should this be _cells as regions is on the way out?
Member
Author
There was a problem hiding this comment.
yeah i can flip those now
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.

"category" will be removed from Region/Cell, and will only be a property of locality.
Now there are no more callers to Region.category.
It still exists on the Region dataclass as it's still (temporarily) needed for the 1:1 cell/locality shim.
also simplify TestEnvRegionDirectory