feat(aci): Add issue preview to uptime monitor form#112224
Merged
Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Preview issue title doesn't match actual backend title
- Updated useUptimeIssueTitle to use the full URL directly (including protocol) to match the backend behavior in grouptype.py which uses uptime_subscription.url.
- ✅ Fixed: Duplicated URL display parsing logic across functions
- Extracted the common URL-to-display-name logic into a shared getDisplayUrl() utility function in fields.tsx and updated useSetAutomaticName to use it.
Or push these changes by commenting:
@cursor push 1a777f12d3
Preview (1a777f12d3)
diff --git a/static/app/views/detectors/components/forms/uptime/fields.tsx b/static/app/views/detectors/components/forms/uptime/fields.tsx
--- a/static/app/views/detectors/components/forms/uptime/fields.tsx
+++ b/static/app/views/detectors/components/forms/uptime/fields.tsx
@@ -12,6 +12,21 @@
export const UPTIME_DEFAULT_RECOVERY_THRESHOLD = 1;
export const UPTIME_DEFAULT_DOWNTIME_THRESHOLD = 3;
+/**
+ * Extracts display components from a URL string.
+ * Returns hostname + path (excluding bare "/") with trailing slashes stripped,
+ * or null if the URL is invalid.
+ */
+export function getDisplayUrl(url: string): string | null {
+ const parsedUrl = URL.parse(url);
+ if (!parsedUrl?.hostname) {
+ return null;
+ }
+
+ const path = parsedUrl.pathname === '/' ? '' : parsedUrl.pathname;
+ return `${parsedUrl.hostname}${path}`.replace(/\/$/, '');
+}
+
interface UptimeDetectorFormData {
assertion: UptimeAssertion | null;
body: string;
diff --git a/static/app/views/detectors/components/forms/uptime/index.tsx b/static/app/views/detectors/components/forms/uptime/index.tsx
--- a/static/app/views/detectors/components/forms/uptime/index.tsx
+++ b/static/app/views/detectors/components/forms/uptime/index.tsx
@@ -24,6 +24,7 @@
import {ConnectedTestUptimeMonitorButton} from 'sentry/views/detectors/components/forms/uptime/connectedTestUptimeMonitorButton';
import {UptimeDetectorFormDetectSection} from 'sentry/views/detectors/components/forms/uptime/detect';
import {
+ getDisplayUrl,
uptimeFormDataToEndpointPayload,
uptimeSavedDetectorToFormData,
} from 'sentry/views/detectors/components/forms/uptime/fields';
@@ -50,15 +51,12 @@
return null;
}
- const parsedUrl = URL.parse(url);
- if (!parsedUrl) {
+ const displayUrl = getDisplayUrl(url);
+ if (!displayUrl) {
return null;
}
- const path = parsedUrl.pathname === '/' ? '' : parsedUrl.pathname;
- const urlName = `${parsedUrl.hostname}${path}`.replace(/\/$/, '');
-
- return t('Uptime check for %s', urlName);
+ return t('Uptime check for %s', displayUrl);
});
return (
diff --git a/static/app/views/detectors/components/forms/uptime/uptimeIssuePreview.tsx b/static/app/views/detectors/components/forms/uptime/uptimeIssuePreview.tsx
--- a/static/app/views/detectors/components/forms/uptime/uptimeIssuePreview.tsx
+++ b/static/app/views/detectors/components/forms/uptime/uptimeIssuePreview.tsx
@@ -15,15 +15,7 @@
return FALLBACK_ISSUE_TITLE;
}
- const parsedUrl = URL.parse(url);
- if (!parsedUrl?.hostname) {
- return FALLBACK_ISSUE_TITLE;
- }
-
- const path = parsedUrl.pathname === '/' ? '' : parsedUrl.pathname;
- const displayUrl = `${parsedUrl.hostname}${path}`.replace(/\/$/, '');
-
- return t('Downtime detected for %s', displayUrl);
+ return t('Downtime detected for %s', url);
}
export function UptimeIssuePreview({step}: {step?: number}) {This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3f3ab85. Configure here.
scttcper
approved these changes
Apr 6, 2026
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Ref ISWF-2392