From b0ee3d2d974b2d7429f0be6a26283b5f3a1ecab4 Mon Sep 17 00:00:00 2001 From: Mia Hsu Date: Mon, 8 Dec 2025 15:23:27 -0800 Subject: [PATCH] fix(aci): prevent invalid custom resolve thresholds --- .../detectors/components/forms/metric/metric.tsx | 2 +- .../components/forms/metric/resolveSection.tsx | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/static/app/views/detectors/components/forms/metric/metric.tsx b/static/app/views/detectors/components/forms/metric/metric.tsx index 83981c1d9cc453..c2756a1e9e24e2 100644 --- a/static/app/views/detectors/components/forms/metric/metric.tsx +++ b/static/app/views/detectors/components/forms/metric/metric.tsx @@ -255,13 +255,13 @@ function PriorityRow({ /> ) : ( diff --git a/static/app/views/detectors/components/forms/metric/resolveSection.tsx b/static/app/views/detectors/components/forms/metric/resolveSection.tsx index b6005b3240c375..31d45da6c3a153 100644 --- a/static/app/views/detectors/components/forms/metric/resolveSection.tsx +++ b/static/app/views/detectors/components/forms/metric/resolveSection.tsx @@ -31,13 +31,23 @@ function validateResolutionThreshold({ form: MetricDetectorFormData; id: string; }): Array<[string, string]> { - const {conditionType, highThreshold, detectionType, resolutionStrategy} = form; - if (!conditionType || detectionType !== 'static' || resolutionStrategy !== 'custom') { + const { + conditionType, + highThreshold, + mediumThreshold, + detectionType, + resolutionStrategy, + } = form; + if ( + !conditionType || + (detectionType !== 'static' && detectionType !== 'percent') || + resolutionStrategy !== 'custom' + ) { return []; } const resolutionNum = Number(form.resolutionValue); - const conditionNum = Number(highThreshold); + const conditionNum = Number(mediumThreshold || highThreshold); if ( Number.isFinite(resolutionNum) &&