Repository navigation
fix(cli): Fall back to the only organization in resolveOrg (CLI-3B) - #1958
Merged
Merged
Conversation
Move the sole-org fallback from two call sites into the shared resolveOrg cascade, as step 6 after DSN detection. This mirrors the sole org/project step in resolveOrgAndProject, and covers every command that resolves an org through resolveOrg (issue @latest and search, trace view, event view, org positionals), not just resolveOrgOnlyTarget and resolveOrgOptionalTarget. Co-Authored-By: Miguel Betegon <28983162+betegon@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
BYK
approved these changes
Nov 4, 2026
This branch was previously deployed
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.
Follow-up to #1947. That PR added the "use the only accessible org" fallback at two call sites (
resolveOrgOnlyTarget,resolveOrgOptionalTarget). This PR moves it into the sharedresolveOrgcascade instead. It becomes step 6, after DSN detection, the same wayresolveOrgAndProjectalready falls back to the only org/project at its step 7.With that change, every command that resolves its org through
resolveOrggets the fallback. That includes issue@latest/@most_frequentand text search,trace view,event view, and org positionals (orgTarget). It still applies only when you are authenticated, have exactly one accessible org, and no org is configured or detected.Before
After
Both outputs come from a local mock server with one org (
acme-corp) and two projects. I trimmed some rows from the After table.Changes
resolveOrgfalls back toresolveSoleOrg()after DSN detection, and the two call-site fallbacks are removed.null.resolveOrgAndProjectalready behaves this way.configuration.md.Testing
resolveOrgreturns the only org./api/0/organizations/) and still assert that no issue or share request is made.pnpm run tscandpnpm run lintpass. The focused suites pass: resolve-target, context-recovery, issue, trace, event, and trace-target (822 tests). In the full CLI run, the only failures are ones that also fail onmainin my sandbox (permission and env checks).via @betegon.
--
View Session [Sentry]