Commit 946190f
authored
fix: reject @-selectors in parseOrgProjectArg with helpful redirect (#557)
Fixes [CLI-MH](https://sentry.sentry.io/issues/7361340621/):
`ResolutionError: Project '@latest' not found.`
A user ran `sentry issues @latest` expecting the `@latest` magic
selector to work. However, `@latest` is only recognized by
`parseIssueArg()` (used in `issue view/explain/plan`), not by
`parseOrgProjectArg()` (used in list commands). Since `@` was not in
`RESOURCE_ID_FORBIDDEN`, it passed validation, entered `project-search`
mode, and produced a confusing "Project '@latest' not found" error.
### Fix
Added `rejectAtSelector()` in `src/lib/arg-parsing.ts` that catches
`@`-prefixed values before they reach project resolution:
- **Known selectors** (`@latest`, `@most_frequent`) → `ValidationError`
with redirect: `Use: sentry issue view @latest`
- **Unknown `@`-prefixed values** → `ValidationError`: slugs don't start
with `@`
Applied in three locations:
1. `parseOrgProjectArg()` bare-slug branch (`@latest`)
2. `parseSlashOrgProject()` leading-slash branch (`/@latest`)
3. `parseSlashOrgProject()` explicit org branch (`sentry/@latest`)1 parent 7feea05 commit 946190f
2 files changed
+97
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
421 | 454 | | |
422 | 455 | | |
423 | 456 | | |
| |||
435 | 468 | | |
436 | 469 | | |
437 | 470 | | |
| 471 | + | |
438 | 472 | | |
439 | 473 | | |
440 | 474 | | |
| |||
444 | 478 | | |
445 | 479 | | |
446 | 480 | | |
| 481 | + | |
447 | 482 | | |
448 | 483 | | |
449 | 484 | | |
| |||
457 | 492 | | |
458 | 493 | | |
459 | 494 | | |
| 495 | + | |
460 | 496 | | |
461 | 497 | | |
462 | 498 | | |
| |||
508 | 544 | | |
509 | 545 | | |
510 | 546 | | |
| 547 | + | |
511 | 548 | | |
512 | 549 | | |
513 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
254 | 314 | | |
255 | 315 | | |
256 | 316 | | |
| |||
0 commit comments