Skip to content

chore(cells) Finish adding silo annotations to View, Endpoint and functions#104172

Merged
markstory merged 6 commits intomasterfrom
chore-silo-annotations-view-classes
Dec 2, 2025
Merged

chore(cells) Finish adding silo annotations to View, Endpoint and functions#104172
markstory merged 6 commits intomasterfrom
chore-silo-annotations-view-classes

Conversation

@markstory
Copy link
Copy Markdown
Member

  • Add silo annotations to the last batch of functions + views.
  • Expand tests to ensure that all views, endpoints and functions have silo annotations applied.
  • I added some exceptions for basic/builtin django views.

Refs INFRENG-202

Add silo annotations to the remaining view classes that were missing
them.

Refs INFRENG-202
These aren't strictly needed but it makes test validation simpler
@markstory markstory requested review from a team as code owners December 1, 2025 18:06
@markstory markstory requested a review from a team December 1, 2025 18:06
@linear
Copy link
Copy Markdown

linear bot commented Dec 1, 2025

@markstory markstory requested a review from a team December 1, 2025 18:06
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 1, 2025

# Relocation variation of password recovery
relocate_confirm = partial(recover_confirm, mode="relocate")
relocate_confirm = control_silo_view(partial(recover_confirm, mode="relocate"))
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: Double silo decoration on partials causes redundant checks

The recover_confirm function is decorated with @control_silo_view, and then set_password_confirm and relocate_confirm wrap partial(recover_confirm, ...) with another control_silo_view(). Since the partial wraps the already-decorated function, this results in double decoration. When either partial is called, the silo mode check runs twice: once on the outer wrapper and once when the partial invokes the inner decorated recover_confirm. The fix would be to either remove the decorator from recover_confirm (if it's only accessed via partials) or not wrap the partials (and manually set the silo_limit attribute to satisfy the test).

Additional Locations (1)

Fix in Cursor Fix in Web

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.

The redundancy is a cost I'm willing to accept for being able to write more thorough tests.

Comment on lines +43 to +44
and view_class != RedirectView
and view_class != TemplateView
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this an extensive list of view classes we want to exclude from this? Should we consider making this a const list somewhere instead?

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.

So far, these are the only django base views we're using. If we get any more of them a list would be better.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 1, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
16469 1 16468 133
View the top 1 failed test(s) by shortest run time
tests.sentry.management.commands.test_generate_controlsilo_urls.TestGenerateControlsiloUrls::test_no_missing_urls
Stack Traces | 0.134s run time
#x1B[1m#x1B[.../management/commands/test_generate_controlsilo_urls.py#x1B[0m:67: in test_no_missing_urls
    assert line in current_state, msg
#x1B[1m#x1B[31mE   AssertionError: #x1B[0m
#x1B[1m#x1B[31mE                 New control silo URL patterns detected!#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE                 The pattern:   new RegExp('^auth-v2/'),#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE                 Does not exist in the current pattern inventory. You should regenerate#x1B[0m
#x1B[1m#x1B[31mE                 the pattern inventory with:#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE                 cd ../getsentry#x1B[0m
#x1B[1m#x1B[31mE                 getsentry django generate_controlsilo_urls --format=js --output=...../app/data/controlsiloUrlPatterns.ts#x1B[0m
#x1B[1m#x1B[31mE     #x1B[0m
#x1B[1m#x1B[31mE                 This command needs to be run in a getsentry environment#x1B[0m
#x1B[1m#x1B[31mE                 in order to not lose patterns that are important for sentry.io#x1B[0m
#x1B[1m#x1B[31mE                 #x1B[0m
#x1B[1m#x1B[31mE   assert "  new RegExp('^auth-v2/')," in "// This is generated code.\n// To update it run `getsentry django generate_controlsilo_urls --format=js --output=/pat....../github/installations/webhook/$'),\n  new RegExp('^share/(?:group|issue)/[^/]+/$'),\n];\n\nexport default patterns;\n"#x1B[0m

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

we hit these often in tests with region mode.
With some more all_silo_views, the URL generation needed to be changed.
We only need URL patterns for endpoints that are *only* on control.
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 1, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 1, 2025

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@markstory markstory merged commit c40f03a into master Dec 2, 2025
69 checks passed
@markstory markstory deleted the chore-silo-annotations-view-classes branch December 2, 2025 15:24
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components 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