Skip to content

ref(detectors): Break circular dependency in metric detector search bar - #127467

Merged
ryan953 merged 4 commits into
masterfrom
seer/fix/detectors-metric-form-fields-cycle
Oct 15, 2026
Merged

ryan953 merged 4 commits into
masterfrom
seer/fix/detectors-metric-form-fields-cycle

Conversation

@sentry

@sentry sentry Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A runtime circular dependency existed between detector dataset configuration and metric form data:
getDatasetConfig.tsx → metrics.tsx → metricsSearchBar.tsx → metricFormData.tsx → getDatasetConfig.tsx.

metricsSearchBar.tsx only needs METRIC_DETECTOR_FORM_FIELDS and useMetricDetectorFormField, but importing them from metricFormData.tsx pulled in getDatasetConfig, closing the loop.

Solution

  • Extract METRIC_DETECTOR_FORM_FIELDS, useMetricDetectorFormField, and metric detector form types into a standalone metricFormFields.tsx that does not import getDatasetConfig.
  • Update every consumer (including metricsSearchBar.tsx) to import the moved symbols from metricFormFields.tsx. metricFormData.tsx does not re-export them, so each symbol has one import path.
  • Export PrioritizeLevelFormData from metricFormFields.tsx, because metricFormData.tsx still uses it.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes CODING-CONVENTIONS-92W

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

@sentry
sentry Bot requested a review from a team as a code owner October 14, 2026 22:39
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 14, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 75275eb. Configure here.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 95.72% 95.72% ±0%
Typed 142,179 142,179 ±0
Untyped 6,363 6,363 ±0
🔍 1 new type safety issue introduced

any-typed symbols (1 new)

File Line Detail
static/app/views/detectors/components/forms/metric/metricFormFields.tsx 132 value (var)

This is informational only and does not block the PR.

Drop the re-export from metricFormData so the moved form field types,
names, and hook have a single import path.

Also export PrioritizeLevelFormData, which metricFormData still uses
after the move and was failing typecheck.
@ryan953 ryan953 added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Oct 15, 2026
@ryan953
ryan953 enabled auto-merge (squash) October 15, 2026 15:59
@ryan953
ryan953 merged commit 04f9f71 into master Oct 15, 2026
89 of 90 checks passed
@ryan953
ryan953 deleted the seer/fix/detectors-metric-form-fields-cycle branch October 15, 2026 16:00

This branch was successfully deployed

1 active deployment
Preview — f6be36a1 Deployed Oct 15, 2026 by vercel[bot]
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 Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant