Skip to content

Conversation

@jaydgoss
Copy link
Member

The CronServiceIncidents overlay was being rendered on all detector types including uptime monitors. This moves the overlay rendering to a context prop (renderTimelineOverlay) that is only provided by cron detectors, ensuring it doesn't appear on uptime monitors.

@linear
Copy link

linear bot commented Jan 14, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 14, 2026
@jaydgoss jaydgoss assigned jaydgoss and unassigned jaydgoss Jan 14, 2026
@jaydgoss jaydgoss marked this pull request as ready for review January 14, 2026 20:20
@jaydgoss jaydgoss requested a review from a team as a code owner January 14, 2026 20:20
@jaydgoss jaydgoss force-pushed the jaygoss/new-688-sentry-outage-warning-block-incorrectly-shown-on-uptime branch from cf0adb1 to 86ea408 Compare January 14, 2026 20:21
@jaydgoss jaydgoss requested a review from malwilley January 14, 2026 20:21
Copy link
Member

@malwilley malwilley left a comment

Choose a reason for hiding this comment

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

Looks good! Just a couple small comments

import CronDetectorsList from 'sentry/views/detectors/list/cron';

// Mock the service incidents component to verify it's rendered
jest.mock('sentry/views/insights/crons/components/serviceIncidents', () => ({
Copy link
Member

Choose a reason for hiding this comment

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

Can we check for the component's existence without mocking the component? It makes the test very brittle, it would be better if we could test for something in the actual component

// Name
expect(within(row).getByText('Uptime Detector')).toBeInTheDocument();

// Should NOT render service incidents overlay
Copy link
Member

Choose a reason for hiding this comment

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

nit: generally we don't test for the absence of elements, it's not very useful and will pretty much always pass

showCursor
cursorOffsets={{right: 40}}
additionalUi={<CronServiceIncidents timeWindowConfig={timeWindowConfig} />}
additionalUi={renderTimelineOverlay?.({timeWindowConfig})}
Copy link
Member

Choose a reason for hiding this comment

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

This change makes sense! Certainly better than it being hardcoded with CronServiceIncidents

@jaydgoss jaydgoss requested a review from a team as a code owner January 14, 2026 21:46
@jaydgoss jaydgoss marked this pull request as draft January 14, 2026 22:03
@jaydgoss jaydgoss marked this pull request as ready for review January 14, 2026 22:18
incident_updates: [],
});

fetchMock.mockResponse(req =>
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Will investigate further but it seems the existing mocks for service incidents are not using MockApiClient, but fetchMock instead https://github.com/getsentry/sentry/blob/37a6465f1f80a07258a97d493dc726f67123d7c6/static/app/views/nav/primary/serviceIncidents.spec.tsx

Copy link
Member

Choose a reason for hiding this comment

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

Oh, sorry, it does look like this component is doing something unique! Carry on, looks like this is the best way to mock it

@jaydgoss jaydgoss removed the request for review from a team January 14, 2026 23:09
@jaydgoss jaydgoss force-pushed the jaygoss/new-688-sentry-outage-warning-block-incorrectly-shown-on-uptime branch from 9a40d86 to 8ca82dc Compare January 15, 2026 17:57
@jaydgoss jaydgoss force-pushed the jaygoss/new-688-sentry-outage-warning-block-incorrectly-shown-on-uptime branch 3 times, most recently from f7840f8 to 0d83685 Compare January 15, 2026 18:11
@jaydgoss jaydgoss enabled auto-merge (squash) January 15, 2026 18:11
The CronServiceIncidents overlay was being rendered on all detector
types including uptime monitors. This moves the overlay rendering to a
context prop (renderTimelineOverlay) that is only provided by cron
detectors, ensuring it doesn't appear on uptime monitors.
- Refactor `cron.spec.tsx` to verify component existence without mocking the component itself, by mocking `useServiceIncidents`.
- Remove redundant negative test in `uptime.spec.tsx`.
- Add `data-test-id` to `CronServiceIncidents` component for better testing.
- Replace `useServiceIncidents` hook mock with `fetchMock` to comply with frontend testing guidelines.
- Use `ServiceIncidentFixture` and `StatusPageComponent` for robust test data.
- Update test description to reflect service incident verification.
- Align `cron.spec.tsx` with `serviceIncidents.spec.tsx` by moving `fetchMock.resetMocks()` to `afterEach`.
@jaydgoss jaydgoss force-pushed the jaygoss/new-688-sentry-outage-warning-block-incorrectly-shown-on-uptime branch from 0d83685 to e2fcabf Compare January 15, 2026 18:12
@jaydgoss jaydgoss disabled auto-merge January 15, 2026 18:15
@jaydgoss jaydgoss enabled auto-merge (squash) January 15, 2026 18:16
@jaydgoss jaydgoss merged commit 21fc5da into master Jan 15, 2026
53 checks passed
@jaydgoss jaydgoss deleted the jaygoss/new-688-sentry-outage-warning-block-incorrectly-shown-on-uptime branch January 15, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants