Skip to content

ref(automations): Break circular dependency between dataConditionNodes and actionFilters - #127489

Closed
sentry[bot] wants to merge 2 commits into
masterfrom
seer/ref/automations-break-data-condition-nodes-cycle
Closed

sentry[bot] wants to merge 2 commits into
masterfrom
seer/ref/automations-break-data-condition-nodes-cycle

Conversation

@sentry

@sentry sentry Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Fixes circular dependencies reported by no-circular-dependencies:

  • static/app/views/automations/components/dataConditionNodes.tsx -> actionFilters/eventFrequency.tsx -> dataConditionNodes.tsx
  • actionFilters/eventUniqueUserFrequency.tsx -> dataConditionNodes.tsx
  • actionFilters/percentSessions.tsx -> dataConditionNodes.tsx

The action filter components only imported dataConditionNodesMap to read the defaultComparison objects when switching between count and percent modes in the dropdown. Extracted those default comparison objects into static/app/views/automations/components/actionFilters/defaultComparisons.ts so the action filters no longer depend back on dataConditionNodes.tsx, making the dependency graph one-directional.

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-99Q

@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:41
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

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

any-typed symbols (1 new)

File Line Detail
static/app/views/automations/components/actionFilters/defaultComparisons.ts 9 defaultComparisonsByType (var)

This is informational only and does not block the PR.

@ryan953

ryan953 commented Oct 15, 2026

Copy link
Copy Markdown
Member

Closing as a duplicate of #127491, which breaks the same dataConditionNodes ↔ actionFilters cycle and now also references this PR's issue.

@ryan953 ryan953 closed this Oct 15, 2026
@ryan953
ryan953 deleted the seer/ref/automations-break-data-condition-nodes-cycle branch October 15, 2026 03:08
ryan953 added a commit that referenced this pull request Oct 15, 2026
…s and action filters (#127491)

`eventFrequency.tsx`, `eventUniqueUserFrequency.tsx` and
`percentSessions.tsx` imported `dataConditionNodesMap` only to look up
the `defaultComparison` for the type a user picks in the "more than... /
relatively higher than..." select. `dataConditionNodes.tsx` imports
those same components to build the map, so each file formed a runtime
cycle.

The node components now receive a `getDefaultComparison` prop. `Node` in
`dataConditionNodeList.tsx`, which renders every condition and already
imports the map, supplies it. `dataConditionNodes.tsx` keeps declaring
the defaults inline, so the map stays the single source of truth, and
its `dataCondition` field is now typed with the new
`DataConditionNodeComponentProps` instead of `any`.

The obvious alternative, extracting the defaults into a separate module
that both sides import (what this PR and the duplicates #127489 /
#127490 first did), also breaks the cycle but splits the condition
registry across two files. A lookup callback is used rather than passing
the two default objects directly because the field needs the defaults
for the *other* condition types (COUNT/PERCENT), not the type currently
rendered.

A new test in `dataConditionNodeList.spec.tsx` covers switching an event
frequency condition to "relatively higher than..." and checks the
percent defaults are applied; no spec covered that path before.

No feature flags.

<!--

  Sentry employees and contractors can delete or ignore the following.

-->

### 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.

<!-- SEER_FIXES_SENTRY_ISSUE -->
Fixes
[CODING-CONVENTIONS-99M](https://sentry.sentry.io/issues/7780644945/?seerDrawer=true)
Fixes
[CODING-CONVENTIONS-99P](https://sentry.sentry.io/issues/7780644963/?seerDrawer=true)
Fixes
[CODING-CONVENTIONS-99Q](https://sentry.sentry.io/issues/7780644968/?seerDrawer=true)
<!-- /SEER_FIXES_SENTRY_ISSUE -->

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

---------

Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Co-authored-by: Ryan Albrecht <ryan.albrecht@sentry.io>

This branch was successfully deployed

1 active deployment
Preview — a112c596 Deployed Oct 14, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant