Skip to content

feat(cmd-k): Add DSN lookup to both command palettes#108401

Merged
sergical merged 14 commits intomasterfrom
sergical/cmd-k-dsn-lookup-frontend
Feb 20, 2026
Merged

feat(cmd-k): Add DSN lookup to both command palettes#108401
sergical merged 14 commits intomasterfrom
sergical/cmd-k-dsn-lookup-frontend

Conversation

@sergical
Copy link
Copy Markdown
Member

@sergical sergical commented Feb 17, 2026

CleanShot 2026-02-17 at 17 23 35

Summary

  • Adds DSN lookup to the new supercharged command palette (useDsnLookupActions hook)
  • Adds DSN lookup to the legacy search modal (dsnLookupSource)
  • Users can paste a DSN and quickly navigate to the corresponding project

Dependencies

Context

Split from #108396 — this is the frontend half.

Test plan

  • Frontend tests pass (CI=true pnpm test useDsnLookupActions)
  • CI passes
  • Manual QA after backend PR lands

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 17, 2026
@JoshFerge
Copy link
Copy Markdown
Member

i am curious, how do we expect users to discover that they can do this?

@sergical
Copy link
Copy Markdown
Member Author

this stemmed from a personal need, i first want to validate that its actually useful for others within the org and personal orgs and then think about how discovery will work, i haven't really looked into how command+k is being used / discovered as it is yet

Add DSN lookup functionality to both the new supercharged command
palette and the legacy search modal. Users can paste a DSN and get
quick navigation to the corresponding project.

Depends on backend PR #108400.
…ared code

- Use correct org-scoped API URL `/organizations/{slug}/dsn-lookup/`
- Reset `isLoading` to false in early-return branch to prevent stuck loading state
- Extract shared `DSN_PATTERN` and `DsnLookupResponse` to `dsnLookupUtils.ts`
Use allowNull to avoid throwing when organization context is missing,
since the command palette uses useOrganization({allowNull: true}).
- Use allowNull in DsnLookupSource to match apiSource.tsx pattern
- Allow optional path segments in DSN_PATTERN for self-hosted instances
Use nullish coalescing fallback for organization slug in useApiQuery
URL template to satisfy the branded ApiUrl type.
Register the DSN lookup URL in knownGetsentryApiUrls and use getApiUrl()
so the query key satisfies the ApiUrl branded type required by useApiQuery.
Extract the three DSN lookup navigation targets (issues, settings, client
keys) into getDsnNavTargets() in dsnLookupUtils so both command palettes
use a single source of truth.
- Use useApiQuery instead of manual fetch in DsnLookupSource
- Switch useDsnLookupActions to registration pattern (useCommandPaletteActions)
- Remove duplicate DSN lookup URL from knownGetsentryApiUrls
@sergical sergical force-pushed the sergical/cmd-k-dsn-lookup-frontend branch from 23c1010 to b75aad7 Compare February 19, 2026 19:41
@sergical sergical requested a review from ryan953 February 19, 2026 19:42
- Remove unused `key` field from DsnNavTarget interface and objects
- Remove debounce on DSN query since users paste full DSNs and the
  regex gate already prevents unnecessary API calls
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice! this does seem better now

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

just reviewing the cursor comments now, thanks again for the reviews!

Use isLoading instead of isPending to avoid blocking SearchSources when
the query is disabled. Bypass fuzzy filtering for search-result actions
since they are already query-specific.
@ryan953
Copy link
Copy Markdown
Member

ryan953 commented Feb 19, 2026

if it's working, the code is looking good to me

Cached API data persisted stale DSN actions after the query changed,
causing them to appear on unrelated searches via the search-result
bypass.
@sergical
Copy link
Copy Markdown
Member Author

if it's working, the code is looking good to me

tested locally with dev-ui just pushing this last update to make sure bugbot is happy

Start from Fuse.js results to preserve match-quality ordering, then
append search-result actions not already matched. The previous filter
over displayedActions returned results in registration order, losing
relevance ranking.
@sergical sergical merged commit 5a752d6 into master Feb 20, 2026
62 checks passed
@sergical sergical deleted the sergical/cmd-k-dsn-lookup-frontend branch February 20, 2026 17:23
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

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 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

staleTime: 30_000,
enabled: isDsn && !!organization && hasDsnLookup,
}
);
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.

404 retries can spam DSN endpoint

Medium Severity

useApiQuery is invoked without disabling retries, so when the DSN lookup endpoint is missing (expected 404 per PR description) or returns 404 for an invalid/not-found DSN, React Query may retry and generate multiple extra requests for a single query.

Additional Locations (1)

Fix in Cursor Fix in Web


export const DSN_PATTERN =
/^https?:\/\/([a-f0-9]{32})(:[a-f0-9]{32})?@[^/]+\/(?:[^/]+\/)*\d+$/;

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.

DSN matcher rejects uppercase hex keys

Low Severity

DSN_PATTERN only matches lowercase hex ([a-f0-9]), so DSNs containing uppercase hex characters won’t be recognized as DSNs, preventing lookup actions/results from ever appearing for those inputs.

Fix in Cursor Fix in Web

priscilawebdev pushed a commit that referenced this pull request Feb 24, 2026
<img width="639" height="242" alt="CleanShot 2026-02-17 at 17 23 35"
src="https://github.com/user-attachments/assets/7d7dcc8e-6f6a-4ff1-a442-d65c01aba631"
/>




## Summary
- Adds DSN lookup to the new supercharged command palette
(`useDsnLookupActions` hook)
- Adds DSN lookup to the legacy search modal (`dsnLookupSource`)
- Users can paste a DSN and quickly navigate to the corresponding
project

## Dependencies
- **Requires #108400** (backend API endpoint) to be merged first
- Frontend gracefully handles missing endpoint — API 404 results in no
results shown

## Context
Split from #108396 — this is the frontend half.

## Test plan
- [x] Frontend tests pass (`CI=true pnpm test useDsnLookupActions`)
- [ ] CI passes
- [ ] Manual QA after backend PR lands
mchen-sentry pushed a commit that referenced this pull request Feb 24, 2026
<img width="639" height="242" alt="CleanShot 2026-02-17 at 17 23 35"
src="https://github.com/user-attachments/assets/7d7dcc8e-6f6a-4ff1-a442-d65c01aba631"
/>




## Summary
- Adds DSN lookup to the new supercharged command palette
(`useDsnLookupActions` hook)
- Adds DSN lookup to the legacy search modal (`dsnLookupSource`)
- Users can paste a DSN and quickly navigate to the corresponding
project

## Dependencies
- **Requires #108400** (backend API endpoint) to be merged first
- Frontend gracefully handles missing endpoint — API 404 results in no
results shown

## Context
Split from #108396 — this is the frontend half.

## Test plan
- [x] Frontend tests pass (`CI=true pnpm test useDsnLookupActions`)
- [ ] CI passes
- [ ] Manual QA after backend PR lands
@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

claude-code-assisted Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants