fix(grouping): Make derived rules visible to users#109836
fix(grouping): Make derived rules visible to users#109836thetruecpaul merged 1 commit intomasterfrom
Conversation
confusing for users to hide this
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: Misleading test name and dead mock after ungating
- I renamed the test to reflect ungated behavior and removed the unused superuser mock/re-render path so the test now only asserts the intended always-visible section.
Or push these changes by commenting:
@cursor push f3e4991d70
Preview (f3e4991d70)
diff --git a/static/app/views/settings/projectIssueGrouping/index.spec.tsx b/static/app/views/settings/projectIssueGrouping/index.spec.tsx
--- a/static/app/views/settings/projectIssueGrouping/index.spec.tsx
+++ b/static/app/views/settings/projectIssueGrouping/index.spec.tsx
@@ -1,13 +1,8 @@
import {initializeOrg} from 'sentry-test/initializeOrg';
import {render, screen} from 'sentry-test/reactTestingLibrary';
-import {isActiveSuperuser} from 'sentry/utils/isActiveSuperuser';
import ProjectIssueGrouping from 'sentry/views/settings/projectIssueGrouping';
-jest.mock('sentry/utils/isActiveSuperuser', () => ({
- isActiveSuperuser: jest.fn(),
-}));
-
describe('projectIssueGrouping', () => {
const {organization, projects} = initializeOrg();
const project = projects[0]!;
@@ -47,34 +42,21 @@
).toBeInTheDocument();
});
- it('shows derived grouping enhancements only for superusers', async () => {
- // Mock the API response
+ it('shows derived grouping enhancements', async () => {
MockApiClient.addMockResponse({
url: `/projects/${organization.slug}/${project.slug}/grouping-configs/`,
body: [],
});
- // First render with a non-superuser
- const {rerender} = render(<ProjectIssueGrouping />, {
+ render(<ProjectIssueGrouping />, {
organization,
outletContext: {project},
});
- // Verify the section is visible for non-superuser
expect(await screen.findByText('Issue Grouping')).toBeInTheDocument();
expect(screen.getByText(/Derived Grouping Enhancements/)).toBeInTheDocument();
expect(
screen.getByRole('textbox', {name: /Derived Grouping Enhancements/})
).toBeDisabled();
-
- // Re-render for superuser
- jest.mocked(isActiveSuperuser).mockReturnValue(true);
- rerender(<ProjectIssueGrouping />);
-
- // Verify the section is visible for superuser
- expect(screen.getByText(/Derived Grouping Enhancements/)).toBeInTheDocument();
- expect(
- screen.getByRole('textbox', {name: /Derived Grouping Enhancements/})
- ).toBeDisabled();
});
});| expect(screen.getByText(/Derived Grouping Enhancements/)).toBeInTheDocument(); | ||
| expect( | ||
| screen.getByRole('textbox', {name: /Derived Grouping Enhancements/}) | ||
| ).toBeDisabled(); |
There was a problem hiding this comment.
Misleading test name and dead mock after ungating
Low Severity
The test is still named 'shows derived grouping enhancements only for superusers', which directly contradicts the PR's intent to make the section visible to all users. Additionally, jest.mocked(isActiveSuperuser).mockReturnValue(true) at line 71 is now a no-op — the component no longer imports or uses isActiveSuperuser, so the mock has zero effect on rendering. This leaves the test asserting the same thing twice under a misleading name, giving false confidence that superuser-gating is being tested when it isn't.



confusing for users to hide this