Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migration(shared-views): Add visibility column to groupsearchview table #86440

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MichaelSun48
Copy link
Member

Adds a visibility enum column to the groupsearchview table. As the name implies, this will be used to inform what visibility scope a view has in the future.

This is also designed to be extensible to allow for new visibility scopes in the future. We're planning to have "team" and "system" (sentry presets) in the future.

@MichaelSun48 MichaelSun48 requested a review from a team March 5, 2025 23:13
@MichaelSun48 MichaelSun48 requested a review from a team as a code owner March 5, 2025 23:13
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 5, 2025
Copy link

codecov bot commented Mar 5, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
327 1 326 41
View the full list of 1 ❄️ flaky tests
tests.acceptance.test_organization_global_selection_header.OrganizationGlobalHeaderTest test_issues_list_to_details_and_back_with_initial_project

Flake rate in main: 22.22% (Passed 7 times, Failed 2 times)

Stack Traces | 57.1s run time
#x1B[1m#x1B[31mtests/acceptance/test_organization_global_selection_header.py#x1B[0m:340: in test_issues_list_to_details_and_back_with_initial_project
    assert f"project={self.project_3.id}" in self.browser.current_url
#x1B[1m#x1B[31mE   AssertionError: assert 'project=4555675845394436' in 'http://172.17.0.1:.../organizations/rowdy-tiger/issues/?project=4555675845394435&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=0'#x1B[0m
#x1B[1m#x1B[31mE    +  where 'http://172.17.0.1:.../organizations/rowdy-tiger/issues/?project=4555675845394435&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=0' = <sentry.testutils.pytest.selenium.Browser object at 0x7f04b6680de0>.current_url#x1B[0m
#x1B[1m#x1B[31mE    +    where <sentry.testutils.pytest.selenium.Browser object at 0x7f04b6680de0> = <sentry.testutils.silo.OrganizationGlobalHeaderTest testMethod=test_issues_list_to_details_and_back_with_initial_project>.browser#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.

@@ -37,6 +52,10 @@ class GroupSearchView(DefaultFieldsModelExisting):
user_id = HybridCloudForeignKey("sentry.User", on_delete="CASCADE")
organization = FlexibleForeignKey("sentry.Organization")

visibility = models.CharField(
Copy link
Member

Choose a reason for hiding this comment

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

i think using a CharField is fine here, but at what scale would it make sense to use an integer mapping for this instead? e.g

class GroupStatus:
?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good question that I'm not really sure how to answer. To me, it seems like the only benefit of switching to an integer mapping is marginally better performance in a couple niche areas. It's hard to draw a line for when those performance improvements actually warrant a refactor. What do you think?

Copy link
Member

@JoshFerge JoshFerge Mar 5, 2025

Choose a reason for hiding this comment

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

yes, if we did high volume queries and needed to eek out a bit more performance, it would help with that. in addition, it saves a small amount of data, which could be important if this table needed to scale to billions of rows. likely not, but something to consider for bigger tables (e.g. anything to do with GroupedMessage).

given that this view in general will be constrained by user action and never grow that large, it is probably safe to assume that our current char based column will be fine.

Copy link
Contributor

github-actions bot commented Mar 5, 2025

This PR has a migration; here is the generated SQL for src/sentry/migrations/0839_add_visibility_column_to_groupsearchview.py ()

--
-- Add field visibility to groupsearchview
--
ALTER TABLE "sentry_groupsearchview" ADD COLUMN "visibility" varchar(16) DEFAULT 'owner' NOT NULL;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants