Skip to content

Commit 635dfef

Browse files
committed
chore(cells) Switch ReactView and GenericReactView to control silo v2
Mulligan on #104552 which broke sentry-wizard. We render the bulk of our HTML via ReactPage. Right now that endpoint is marked as all_silo to make integration with tests simpler. Switch these endpoints to control as we're trying to have a minimal number of endpoints marked as all_silo and I want to better understand the scope of test failures from this change. This time around I've limited the excluded views to only subclasses of `ReactPage` as we *do* have HTML views that the UI code uses. Refs INFRENG-238
1 parent fc3f137 commit 635dfef

File tree

3 files changed

+57
-10
lines changed

3 files changed

+57
-10
lines changed

src/sentry/management/commands/generate_controlsilo_urls.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from django.urls import URLPattern, URLResolver
1414

1515
from sentry.silo.base import SiloMode
16-
from sentry.web.frontend.base import BaseView
16+
from sentry.web.frontend.react_page import GenericReactPageView, ReactPageView
1717

1818
# There are a handful of catchall routes
1919
# that we don't want to handle in controlsilo
@@ -115,15 +115,19 @@ def handle(self, **options):
115115
except ImportError as err:
116116
raise CommandError(f"Could not load view in {module}: {err}")
117117

118-
# If a view/endpoint doesn't have a silo_limit it is likely a basic django view
118+
# If a view/endpoint doesn't have a silo_limit it is likely a basic django view.
119119
# We have tests in tests/sentry/silo/test_base.py that ensure all views/endpoints
120-
# have silo annotations on them. BaseView subclasses generally render HTML,
121-
# and we don't need them in the controlsilo URL inventory as the UI doesn't
122-
# fetch data from them.
123-
if (
124-
not hasattr(view_func, "silo_limit")
125-
or isinstance(view_func, type)
126-
and issubclass(view_func, BaseView)
120+
# have silo annotations on them. We skip including URLs for react views
121+
# as those should be control only.
122+
if not hasattr(view_func, "silo_limit") or (
123+
isinstance(view_func, type)
124+
and issubclass(
125+
view_func,
126+
(
127+
ReactPageView,
128+
GenericReactPageView,
129+
),
130+
)
127131
):
128132
continue
129133

static/app/data/controlsiloUrlPatterns.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ const patterns: RegExp[] = [
44
new RegExp('^remote/heroku/resources(?:/[^/]+)?$'),
55
new RegExp('^remote/heroku/sso-login/?$'),
66
new RegExp('^remote/beacon/$'),
7+
new RegExp('^remote/newsletter/unsubscribe/$'),
8+
new RegExp('^remote/github-copilot/oauth/$'),
79
new RegExp('^remote/github-secret-scanning/$'),
10+
new RegExp('^remote/github/marketplace/purchase/$'),
811
new RegExp('^remote/channel-provision/account/$'),
912
new RegExp('^remote/vercel/v1/installations/new/plans/$'),
1013
new RegExp('^remote/vercel/v1/installations/[^/]+/plans/$'),
@@ -16,6 +19,9 @@ const patterns: RegExp[] = [
1619
new RegExp('^remote/vercel/v1/installations/[^/]+/resources/[^/]+/secrets/rotate$'),
1720
new RegExp('^remote/vercel/oauth$'),
1821
new RegExp('^support/$'),
22+
new RegExp('^identity/login/[^/]+/$'),
23+
new RegExp('^orgredirect/try-business/$'),
24+
new RegExp('^orgredirect/'),
1925
new RegExp('^associate/complete/[^/]+/$'),
2026
new RegExp('^associate/[^/]+/$'),
2127
new RegExp('^api/0/staff-auth/$'),
@@ -49,6 +55,7 @@ const patterns: RegExp[] = [
4955
new RegExp('^api/0/sponsored_account_request/$'),
5056
new RegExp('^api/0/migrate_to_hosted/$'),
5157
new RegExp('^api/0/sponsored_education_account/$'),
58+
new RegExp('^organizations/[^/]+/documents/[^/]+/?$'),
5259
new RegExp('^api/0/organizations/[^/]+/broadcasts/$'),
5360
new RegExp('^api/0/billing-config/$'),
5461
new RegExp('^api/0/auth-details/$'),
@@ -153,21 +160,41 @@ const patterns: RegExp[] = [
153160
new RegExp('^api/0/tempest-ips/$'),
154161
new RegExp('^api/0/secret-scanning/github/$'),
155162
new RegExp('^api/hooks/mailgun/inbound/'),
163+
new RegExp('^oauth/authorize/$'),
156164
new RegExp('^oauth/token/$'),
157165
new RegExp('^oauth/userinfo/$'),
166+
new RegExp('^saml/acs/[^/]+/$'),
167+
new RegExp('^saml/sls/[^/]+/$'),
168+
new RegExp('^saml/metadata/[^/]+/$'),
169+
new RegExp('^auth/login/$'),
170+
new RegExp('^auth/login/[^/]+/$'),
171+
new RegExp('^auth/channel/[^/]+/[^/]+/$'),
172+
new RegExp('^auth/link/[^/]+/$'),
173+
new RegExp('^auth/2fa/$'),
158174
new RegExp('^auth/2fa/u2fappid\\.json$'),
175+
new RegExp('^auth/sso/$'),
176+
new RegExp('^auth/logout/$'),
177+
new RegExp('^auth/reactivate/$'),
178+
new RegExp('^auth/register/$'),
179+
new RegExp('^auth/close/$'),
159180
new RegExp('^login-redirect/$'),
160181
new RegExp('^account/sudo/$'),
161182
new RegExp('^account/confirm-email/$'),
162183
new RegExp('^account/confirm-email/[^/]+/[^/]+/$'),
163184
new RegExp('^account/confirm-signed-email/[^/]+/$'),
185+
new RegExp('^account/user-confirm/[^/]+/$'),
164186
new RegExp('^account/recover/$'),
165187
new RegExp('^account/recover/confirm/[^/]+/[^/]+/$'),
166188
new RegExp('^account/relocation/reclaim/[^/]+/$'),
189+
new RegExp('^account/settings/identities/associate/[^/]+/[^/]+/[^/]+/$'),
190+
new RegExp('^account/settings/wizard/[^/]+/$'),
167191
new RegExp('^account/settings/social/associate/complete/[^/]+/$'),
168192
new RegExp('^account/settings/social/associate/[^/]+/$'),
169193
new RegExp('^auth/sso/account/settings/social/associate/complete/[^/]+/$'),
170194
new RegExp('^out/$'),
195+
new RegExp('^settings/organization/auth/configure/$'),
196+
new RegExp('^organizations/[^/]+/auth/configure/$'),
197+
new RegExp('^organizations/[^/]+/integrations/[^/]+/setup/$'),
171198
new RegExp('^avatar/[^/]+/$'),
172199
new RegExp('^sentry-app-avatar/[^/]+/$'),
173200
new RegExp('^doc-integration-avatar/[^/]+/$'),
@@ -176,18 +203,29 @@ const patterns: RegExp[] = [
176203
new RegExp('^extensions/jira/installed/$'),
177204
new RegExp('^extensions/jira/uninstalled/$'),
178205
new RegExp('^extensions/jira/search/[^/]+/[^/]+/$'),
206+
new RegExp('^extensions/jira/configure/$'),
179207
new RegExp('^extensions/jira/issue-details/[^/]+/$'),
180208
new RegExp('^extensions/jira-server/search/[^/]+/[^/]+/$'),
209+
new RegExp('^extensions/slack/link-identity/[^/]+/$'),
210+
new RegExp('^extensions/slack/unlink-identity/[^/]+/$'),
181211
new RegExp('^extensions/github/installation/[^/]+/$'),
182212
new RegExp('^extensions/github/search/[^/]+/[^/]+/$'),
183213
new RegExp('^extensions/gitlab/search/[^/]+/[^/]+/$'),
184214
new RegExp('^extensions/vsts/search/[^/]+/[^/]+/$'),
215+
new RegExp('^extensions/vsts/configure/$'),
185216
new RegExp('^extensions/bitbucket/descriptor/$'),
186217
new RegExp('^extensions/bitbucket/installed/$'),
187218
new RegExp('^extensions/bitbucket/uninstalled/$'),
188219
new RegExp('^extensions/bitbucket/search/[^/]+/[^/]+/$'),
220+
new RegExp('^extensions/vercel/configure/$'),
189221
new RegExp('^extensions/vercel/delete/$'),
190222
new RegExp('^extensions/vercel/webhook/$'),
223+
new RegExp('^extensions/msteams/configure/$'),
224+
new RegExp('^extensions/msteams/link-identity/[^/]+/$'),
225+
new RegExp('^extensions/msteams/unlink-identity/[^/]+/$'),
226+
new RegExp('^extensions/discord/configure/$'),
227+
new RegExp('^extensions/discord/link-identity/[^/]+/$'),
228+
new RegExp('^extensions/discord/unlink-identity/[^/]+/$'),
191229
];
192230

193231
export default patterns;

tests/sentry/management/commands/test_generate_controlsilo_urls.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ def test_write_file(self) -> None:
3737
tf.seek(0)
3838
result = tf.read().decode("utf8")
3939
assert "This is generated code" in result
40-
assert "new RegExp('^api/0/users/$')," in result
4140
assert "const patterns" in result
4241
assert "export default patterns;" in result
42+
assert "new RegExp('^api/0/users/$')," in result
43+
# Wizard is an HTML view that gets POST from UI code.
44+
assert "new RegExp('^account/settings/wizard/[^/]+/$')," in result
45+
# Views that render react application (like /dashboards)
46+
# are not be used by UI code, and shouldn't be in the URL list
47+
assert "new RegExp('^dashboards" not in result
4348

4449
def test_no_missing_urls(self) -> None:
4550
pattern_file = "static/app/data/controlsiloUrlPatterns.ts"

0 commit comments

Comments
 (0)