fix: reject @-selectors in parseOrgProjectArg with helpful redirect#557
Merged
fix: reject @-selectors in parseOrgProjectArg with helpful redirect#557
Conversation
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Internal Changes 🔧Coverage
Other
🤖 This preview updates automatically when you update the PR. |
1dd29a1 to
e21717c
Compare
Contributor
Codecov Results 📊✅ 126 passed | Total: 126 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1277 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.32% 95.32% —%
==========================================
Files 194 194 —
Lines 27279 27300 +21
Branches 0 0 —
==========================================
+ Hits 26002 26023 +21
- Misses 1277 1277 —
- Partials 0 0 —Generated by Codecov Action |
e21717c to
9354dc7
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Fixes CLI-MH: 'Project @latest not found' when running 'sentry issues @latest'. The @latest and @most_frequent magic selectors are only valid for parseIssueArg (issue view/explain/plan), not for parseOrgProjectArg (list commands). Previously, @ was not in RESOURCE_ID_FORBIDDEN so '@latest' passed validation and entered project-search mode, leading to a confusing ResolutionError. Add rejectAtSelector() guard in: - parseOrgProjectArg() bare-slug branch - parseSlashOrgProject() both project slug branches (/@latest, org/@latest) Known selectors get a redirect: 'Use: sentry issue view @latest' Unknown @-prefixed values get: 'starts with @, slugs use letters/numbers/hyphens'
9354dc7 to
3f84527
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes CLI-MH:
ResolutionError: Project '@latest' not found.A user ran
sentry issues @latestexpecting the@latestmagic selector to work. However,@latestis only recognized byparseIssueArg()(used inissue view/explain/plan), not byparseOrgProjectArg()(used in list commands). Since@was not inRESOURCE_ID_FORBIDDEN, it passed validation, enteredproject-searchmode, and produced a confusing "Project '@latest' not found" error.Fix
Added
rejectAtSelector()insrc/lib/arg-parsing.tsthat catches@-prefixed values before they reach project resolution:@latest,@most_frequent) →ValidationErrorwith redirect:Use: sentry issue view @latest@-prefixed values →ValidationError: slugs don't start with@Applied in three locations:
parseOrgProjectArg()bare-slug branch (@latest)parseSlashOrgProject()leading-slash branch (/@latest)parseSlashOrgProject()explicit org branch (sentry/@latest)