Skip to content

ref(utils): move issue-tag query helpers out of the utils barrel#116807

Open
JoshuaKGoldberg wants to merge 1 commit into
masterfrom
ref/decycle-utils-tag-helpers
Open

ref(utils): move issue-tag query helpers out of the utils barrel#116807
JoshuaKGoldberg wants to merge 1 commit into
masterfrom
ref/decycle-utils-tag-helpers

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

Why

Sentry's frontend type-import graph forms a large strongly-connected component (SCC). run-on-changed counts import type edges, so this cycle makes its "impacted files" analysis flag a huge fraction of the app for almost any change. We're shrinking the SCC by moving misplaced symbols out of god-barrels.

The sentry/utils barrel (static/app/utils.tsx) is one of the most widely-imported modules in the app, and it sat inside the SCC for exactly two reasons: the helpers escapeIssueTagKey and generateQueryWithTag, which import types/event, utils/fields, and utils/queryString.

What

  • Relocate both helpers into utils/queryString — their natural home, alongside the related appendTagCondition they already use.
  • Repoint the handful of consumers to import them from sentry/utils/queryString.
  • Move the colocated tests to queryString.spec.tsx.

A re-export from the barrel would re-create the cycle edge (the helpers' new home is itself in the SCC), so consumers import from sentry/utils/queryString directly. With the helpers gone, the barrel imports nothing in the cycle and leaves the SCC.

Impact

Largest type-import SCC drops 1867 → 1850 (−17) standalone. Because the barrel is so widely imported, the effect compounds with the sibling de-cycling PRs (it removes ~49 once the tooltip cluster is also out).

Part of a series of SCC-shrinking PRs.

`escapeIssueTagKey` and `generateQueryWithTag` were the only members of the
`sentry/utils` god-barrel that imported `types/event`, `utils/fields`, and
`utils/queryString` — the edges keeping the barrel inside the frontend
type-import strongly-connected component (SCC).

Relocate both into `utils/queryString` (alongside the related
`appendTagCondition`) and repoint the handful of consumers. The barrel then
imports nothing in the cycle and leaves the SCC. Re-exporting from the barrel
would re-create the edge (the helpers' new home is itself in the cycle), so
consumers import from `sentry/utils/queryString` directly.

Largest SCC drops 1867 -> 1850 standalone; the barrel is one of the most
widely-imported modules, so this compounds with the other de-cycling PRs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.62% 93.62% ±0%
Typed 133,223 133,223 ±0
Untyped 9,073 9,073 ±0
🔍 1 new type safety issue introduced

Type assertions (as) (1 new)

File Line Detail
static/app/utils/queryString.tsx 192 as FieldKeykey as FieldKey

This is informational only and does not block the PR.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review June 3, 2026 20:51
@JoshuaKGoldberg JoshuaKGoldberg requested review from a team as code owners June 3, 2026 20:51
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.

2 participants