Commit 48f5e63
authored
fix(resolve): guide users to org/project instead of silencing the auto-detect error (#1155)
## Why
Follow-up to #1149 based on review feedback: **"Could not auto-detect
organization and project" was being silenced, which hid the signal AND
skipped the underlying UX fix.** We keep these errors around to learn
where users get stuck — so the right move is to help users succeed *and*
keep the error visible to measure impact.
CLI-3B: ~2000 users.
## What changed
**1. Sole-account auto-select (helps every command, zero risk)**
`resolveOrgAndProject` gains a final cascade step: when an authenticated
account has exactly **one** accessible org with exactly **one** project,
that pair is the only possible answer, so it's returned instead of
`null`. This is strictly additive — callers that depend on a `null`
return (notably `event view`'s cross-org search) are unaffected, since
it only ever turns a `null` into a uniquely-determined target.
**2. Interactive picker (TTY)**
On a failed auto-detect, `guideOrgProjectFailure` prompts the user to
choose an org then a project, and saves the choice as the default (so
they're not asked again). Gated on **both** stdin and stdout being TTYs,
so piped/`--json` invocations never block on a prompt.
**3. Enriched error**
Authenticated users who still can't be resolved get a `ContextError`
listing their accessible orgs (copy-pasteable), instead of the generic
"run `sentry org list`" guidance shown to logged-out users.
**4. Un-silence `ContextError`**
Reverted the `classifySilenced` `ContextError` branch (and the now-dead
`recordSilencedError` resource attribute) so its volume stays visible —
that volume is the signal for whether the UX changes above actually
work.
## Wiring
`guideOrgProjectFailure` is invoked on the auto-detect failure path of
`resolveOrgProjectTarget`, `resolveTargetsFromParsedArg` (backs `issue
list`), and `trace-target`. The fallback is kept **separate** from
`resolveOrgAndProject` (rather than wrapping it) so command tests that
mock the resolver — and rely on its `null` return — keep working; the
guide only runs on the explicit failure path.
Upload commands
(`sourcemap`/`debug-files`/`proguard`/`code-mappings`/`dart-symbol-map`)
get the sole-account auto-select for free via `resolveOrgAndProject`;
their interactive-picker/enriched-error wiring can follow up (they're
usually non-interactive CI runs with DSN/config context).
## Tests
- `resolveOrgProjectOrGuide`: sole-org/project auto-select, multi-org
enriched `ContextError`, unauthenticated generic `ContextError` (no
org-list call).
- Updated `classifySilenced` / `recordSilencedError` / telemetry tests
to assert `ContextError` is now **captured**, not silenced.
- Updated trace/span resolver tests for the new fallback path.
- Full `test/lib` + `test/commands` suites green (7964 passing); lint +
typecheck clean.1 parent 0725a14 commit 48f5e63
12 files changed
Lines changed: 640 additions & 65 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
477 | 480 | | |
478 | 481 | | |
479 | 482 | | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
480 | 486 | | |
481 | 487 | | |
482 | 488 | | |
| |||
519 | 525 | | |
520 | 526 | | |
521 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
522 | 531 | | |
523 | 532 | | |
524 | 533 | | |
| |||
597 | 606 | | |
598 | 607 | | |
599 | 608 | | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
600 | 615 | | |
601 | 616 | | |
602 | 617 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
704 | 705 | | |
705 | 706 | | |
706 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
707 | 712 | | |
708 | 713 | | |
709 | 714 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
| |||
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
50 | | - | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | 117 | | |
122 | 118 | | |
123 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments