You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(resolve-target): reference original input in fuzzy-recovery warnings (#772) (#774)
## Summary
Fixes#772. Replaces the space→dash slug normalization with direct
display-name matching. When a user types a project display name (e.g.
\`"My Project"\`) instead of a slug, the CLI now searches by name
instead of guessing \`"my-project"\`.
### Before
\`\`\`
$ sentry issue list "My Project"
WARN Normalized slug to 'my-project'
WARN Project 'my-project' not found. Using similar project 'my_project'
in org 'acme'.
\`\`\`
Two confusing warnings referencing \`my-project\` — a slug the CLI
invented and the user never typed.
### After
\`\`\`
$ sentry issue list "My Project"
WARN No project matching 'My Project'. Using 'my_project' in org 'acme'.
\`\`\`
One clean message. No misleading normalization step, no wasted API calls
for a doomed slug lookup.
## How it works
1. **Spaces = display name** — \`looksLikeDisplayName()\` detects spaces
in the input, which are never valid in slugs
2. **Skip slug path** — The parser bypasses \`normalizeSlug()\`,
\`validateResourceId()\`, and \`findProjectsBySlug()\` (all would fail
on spaces)
3. **Fuzzy name matching** — \`findSimilarProjectsAcrossOrgs()\` now
matches against both project slugs AND display names, resolving \`"My
Project"\` → \`my_project\`
4. **Shared helper** — \`triageProjectNotFound()\` consolidates the
org-check + fuzzy-recovery + warn pattern across all 4 resolution sites
## Changes
### \`src/lib/arg-parsing.ts\`
- \`normalizeSlug()\`: now a no-op (spaces were its only remaining case
after #771)
- \`warnNormalized()\`: removed (no normalization to warn about)
- \`parseOrgProjectArg\` / \`parseSlashOrgProject\`: spaces trigger
display-name search path — skip slug validation, set \`originalSlug\`
- \`looksLikeDisplayName()\`: new helper detecting spaces in input
### \`src/lib/resolve-target.ts\`
- \`findSimilarProjectsAcrossOrgs\`: matches against project names (not
just slugs) when \`displayName\` provided
- \`triageProjectNotFound\` **(new)**: shared helper returning
discriminated union (\`org-match\` | \`fuzzy-match\` | \`not-found\`)
- \`resolveProjectBySlug\`: skips \`findProjectsBySlug\` for
display-name input; uses \`triageProjectNotFound\`
- \`resolveOrgProjectTarget\`: same display-name fast path
- \`Array.concat\` instead of spread for merging fuzzy results
### \`src/lib/org-list.ts\`
- \`handleProjectSearch\`: display-name fast path; uses
\`triageProjectNotFound\`
- Removed \`tryFuzzyRecoveryForList\` (superseded by shared helper)
### \`src/commands/project/list.ts\`
- Display-name fast path; fuzzy recovery via \`triageProjectNotFound\`
(was previously missing)
- \`handleProjectNotFound\` helper with recursion guard
### Callers updated
- \`event/view.ts\`, \`log/view.ts\`, \`project/view.ts\`,
\`dashboard/create.ts\`, \`trace-target.ts\` — pass \`originalSlug\`
### Tests
- Rewrote space-normalization tests → display-name search tests
- Updated \`normalizeSlug\` unit and property tests for no-op behavior
- Updated spy assertions for new parameter
0 commit comments