refactor: generalize resolveOrgProjectTarget to support org-all mode#875
Merged
refactor: generalize resolveOrgProjectTarget to support org-all mode#875
Conversation
Add a sibling to resolveOrgProjectTarget that allows org-all mode (`<org>/`) by returning project as optional. Commands like `explore` that work without a project filter can use this instead of building local resolution glue. - Add ResolvedOrgOptionalProject type (project is optional) - Add resolveOrgOptionalProjectTarget — delegates to existing function for explicit/project-search, handles org-all/auto-detect locally - Add resolveOrgOptionalProjectFromArg convenience wrapper - Replace explore's local resolveExploreTarget with the shared helper Closes #860
Contributor
|
Contributor
Codecov Results 📊✅ 6237 passed | Total: 6237 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 66.67%. Project has 13070 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 75.99% 75.84% -0.15%
==========================================
Files 293 293 —
Lines 54000 54100 +100
Branches 0 0 —
==========================================
+ Hits 41036 41030 -6
- Misses 12964 13070 +106
- Partials 0 0 —Generated by Codecov Action |
Contributor
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 2ba2008. Configure here.
Assert that ContextError.command contains 'explore' to ensure the commandName parameter is actually propagated.
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.

Summary
resolveOrgOptionalProjectTarget— a sibling ofresolveOrgProjectTargetthat allowsorg-allmode (<org>/) by returningprojectas optionalResolvedOrgOptionalProjecttype with optionalprojectfieldresolveExploreTarget()(~50 lines) with the shared helperresolveOrgOptionalProjectFromArgconvenience wrapper (mirrorsresolveOrgProjectFromArg)Motivation
Commands like
sentry explorework without a project filter — they accept<org>/as a valid target. The existingresolveOrgProjectTargetrejects this with aContextError, forcing each such command to duplicate resolution logic locally. This refactoring generalizes the pattern so future org-scoped commands can reuse it.Test Plan
test/lib/resolve-target.test.tsfor the new functionCloses #860