fix(resolve): guide users to org/project instead of silencing the auto-detect error (CLI-3B)#1155
fix(resolve): guide users to org/project instead of silencing the auto-detect error (CLI-3B)#1155BYK wants to merge 2 commits into
Conversation
…o-detect error (CLI-3B) "Could not auto-detect organization and project" was being silenced, which hid the signal AND skipped the underlying UX fix. Instead of dropping it, help users succeed and keep the error visible to measure the impact: - Sole-account auto-select: when an authenticated account has exactly one accessible org with exactly one project, resolveOrgAndProject now returns that pair instead of null (step 7 of the cascade). This is strictly additive — callers that depend on a null return (e.g. event view's cross-org search) are unaffected, since it only turns a null into a uniquely-determined target. - Interactive picker: on a failed auto-detect in a TTY, guideOrgProjectFailure prompts the user to choose an org/project and saves it as the default. Gated on stdin AND stdout being TTYs so piped/--json runs never block. - Enriched error: authenticated users who can't be auto-resolved get a ContextError listing their accessible orgs (copy-pasteable), instead of the generic "run org list" guidance. - Un-silence ContextError: reverted the classifySilenced ContextError branch (and the dead recordSilencedError resource attribute) so its volume stays visible as the signal for these UX improvements. Wired into the auto-detect paths of resolveOrgProjectTarget, resolveTargetsFromParsedArg (issue list), and trace-target. Upload commands get the sole-account auto-select for free via resolveOrgAndProject.
|
Codecov Results 📊❌ Patch coverage is 51.14%. Project has 5157 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 81.48% 81.44% -0.04%
==========================================
Files 397 398 +1
Lines 27702 27780 +78
Branches 17991 18048 +57
==========================================
+ Hits 22570 22623 +53
- Misses 5132 5157 +25
- Partials 1862 1872 +10Generated by Codecov Action |
…rompts in JSON mode Cursor Bugbot review on #1155: - HIGH: when auto-detect found DSNs but none resolved (self-hosted/no access), resolveTargetsFromParsedArg now preserves the empty result + skippedSelfHosted instead of calling the guide, so issue list surfaces the inaccessible-DSN ContextError rather than silently resolving a different org/project. - MEDIUM: added a process-wide interactive-prompts gate (interactive-prompts.ts) that the command wrapper disables in JSON mode; canPromptForTarget now consults it, so --json runs never block on or interleave with the org/project picker. - LOW (Seer): documented that guideOrgProjectFailure can also throw ResolutionError (selected org has no accessible projects).
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.
Reviewed by Cursor Bugbot for commit 7abe866. Configure here.
| // ApiError) are expected states — marking them crashed would skew | ||
| // release-health. | ||
| // Silenced errors (OutputError, expected AuthError, user 4xx ApiError) are | ||
| // expected states — marking them crashed would skew release-health. |
There was a problem hiding this comment.
ContextError marks sessions crashed
Medium Severity
Stopping silencing of ContextError for issue reporting also causes withTelemetry to call markSessionCrashed, because session handling reuses classifySilenced. Missing org/project and similar user-context failures are now counted as crashed CLI sessions, which skews release-health metrics for a large expected-error class.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 7abe866. Configure here.


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)
resolveOrgAndProjectgains 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 ofnull. This is strictly additive — callers that depend on anullreturn (notablyevent view's cross-org search) are unaffected, since it only ever turns anullinto a uniquely-determined target.2. Interactive picker (TTY)
On a failed auto-detect,
guideOrgProjectFailureprompts 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/--jsoninvocations never block on a prompt.3. Enriched error
Authenticated users who still can't be resolved get a
ContextErrorlisting their accessible orgs (copy-pasteable), instead of the generic "runsentry org list" guidance shown to logged-out users.4. Un-silence
ContextErrorReverted the
classifySilencedContextErrorbranch (and the now-deadrecordSilencedErrorresource attribute) so its volume stays visible — that volume is the signal for whether the UX changes above actually work.Wiring
guideOrgProjectFailureis invoked on the auto-detect failure path ofresolveOrgProjectTarget,resolveTargetsFromParsedArg(backsissue list), andtrace-target. The fallback is kept separate fromresolveOrgAndProject(rather than wrapping it) so command tests that mock the resolver — and rely on itsnullreturn — 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 viaresolveOrgAndProject; 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 enrichedContextError, unauthenticated genericContextError(no org-list call).classifySilenced/recordSilencedError/ telemetry tests to assertContextErroris now captured, not silenced.test/lib+test/commandssuites green (7964 passing); lint + typecheck clean.