fix(trace): allow 'trace view' to work with org-scoped targets#1291
Draft
sentry[bot] wants to merge 2 commits into
Draft
fix(trace): allow 'trace view' to work with org-scoped targets#1291sentry[bot] wants to merge 2 commits into
sentry[bot] wants to merge 2 commits into
Conversation
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5495 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.75% 81.75% —%
==========================================
Files 428 428 —
Lines 30106 30110 +4
Branches 19593 19595 +2
==========================================
+ Hits 24611 24615 +4
- Misses 5495 5495 —
- Partials 2054 2056 +2Generated by Codecov Action |
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.
Previously, running
sentry trace view <org>/<trace-id>would fail with aContextError: Specific project is required.This was due to thetrace viewcommand usingresolveTraceOrgProject, which explicitly throws an error when an org-scoped target (without a project slug) is provided.However, the underlying API call (
getDetailedTrace) does not actually require a project slug to fetch trace details, making this restriction unnecessary for thetrace viewcommand.This fix addresses the issue by:
resolveTraceOrgOptionalProject, insrc/lib/trace-target.ts. This function handlesorg-scopedtargets by returning the organization and trace ID (with an undefined project), allowing the command to proceed. Other target types are delegated to the existingresolveTraceOrgProjectto maintain strict project requirements for commands likespan listandspan view.src/commands/trace/view.tsto useresolveTraceOrgOptionalProject. The command's subsequent logic already correctly handles an optional project, so no further changes were needed there.test/commands/trace/view.func.test.tsto reflect the new, correct behavior for org-scoped targets.Fixes CLI-VT
Comment
@sentry <feedback>on this PR to have Autofix iterate on the changes.