Skip to content

refactor: generalize resolveOrgProjectTarget to support org-all mode#875

Merged
BYK merged 2 commits intomainfrom
refactor/resolve-target-org-all-860
Apr 29, 2026
Merged

refactor: generalize resolveOrgProjectTarget to support org-all mode#875
BYK merged 2 commits intomainfrom
refactor/resolve-target-org-all-860

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 29, 2026

Summary

  • Add resolveOrgOptionalProjectTarget — a sibling of resolveOrgProjectTarget that allows org-all mode (<org>/) by returning project as optional
  • Add ResolvedOrgOptionalProject type with optional project field
  • Replace explore command's local resolveExploreTarget() (~50 lines) with the shared helper
  • Add resolveOrgOptionalProjectFromArg convenience wrapper (mirrors resolveOrgProjectFromArg)

Motivation

Commands like sentry explore work without a project filter — they accept <org>/ as a valid target. The existing resolveOrgProjectTarget rejects this with a ContextError, forcing each such command to duplicate resolution logic locally. This refactoring generalizes the pattern so future org-scoped commands can reuse it.

Test Plan

  • 5 new tests in test/lib/resolve-target.test.ts for the new function
  • All 21 existing explore tests still pass
  • Typecheck and lint clean

Closes #860

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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-875/

Built to branch gh-pages at 2026-04-29 00:42 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

Codecov Results 📊

6237 passed | Total: 6237 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +5
Passed Tests 📈 +5
Failed Tests
Skipped Tests

All tests are passing successfully.

❌ Patch coverage is 66.67%. Project has 13070 uncovered lines.
❌ Project coverage is 75.84%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/resolve-target.ts 58.82% ⚠️ 14 Missing
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

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread test/lib/resolve-target.test.ts
Assert that ContextError.command contains 'explore' to ensure the
commandName parameter is actually propagated.
@BYK BYK merged commit d1ca245 into main Apr 29, 2026
26 checks passed
@BYK BYK deleted the refactor/resolve-target-org-all-860 branch April 29, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: generalize resolveOrgProjectTarget to support org-all mode

1 participant