Skip to content

feat(arg-parsing): accept comma-separated project slugs - #1607

Open
betegon wants to merge 2 commits into
mainfrom
feat/comma-separated-project-slugs
Open

betegon wants to merge 2 commits into
mainfrom
feat/comma-separated-project-slugs

Conversation

@betegon

@betegon betegon commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Summary

sentry issue list acme/web,api currently requests the concatenated slug and 404s. This lets issue list and project list accept a comma-separated project selector after the org (<org>/a,b). Parsing is enabled per command via parseOrgProjectArg(target, { allowProjectList: true }); every other command keeps today's semantics, including comma-containing project names in project create.

issue list <org>/a,b resolves each slug to its numeric ID with the same cache-first lookup a single <org>/<project> target uses (fetchProjectId), in parallel, then issues a single SDK request with the IDs through the repeated project query parameter. Sorting, --limit, and cursor pagination stay server-side and share the org-all code path.

  • Unknown slugs fail with a ResolutionError before the request; the issues endpoint would otherwise answer with a 403 that reads like a permissions problem.
  • Lookups are strict: if one fails, the command errors instead of sending a slug, since self-hosted releases before 26.6 reject non-numeric project values.
  • Aliases for the ALIAS column are stored without a DSN fingerprint, so sentry issue view <ALIAS> works from any directory.
  • The cursor context key uses the sorted slugs, so -c next still works when the slugs are retyped in another order.

project list <org>/a,b looks up each project directly and preserves input order, reporting slugs that do not exist separately from slugs excluded by --platform. Lookup errors other than 404 propagate like org-all instead of rendering as "no projects found".

A plain <org>/<project> target is unchanged in both commands (same handlers, hints, and cursor behaviour as main).

Implementation notes

  • listIssuesPaginated/listIssuesAllPages take projects?: ReadonlyArray<number | string> instead of a single projectId; existing callers pass [id].
  • resolve-target.ts adds resolveProjectIdsInOrg (strict, for issue list) and findProjectsInOrg (404 as missing, for project list); fetchProjectId gains { strict } to re-throw non-404 failures.
  • Selectors are looked up slug by slug rather than through the org catalog: the cost follows the number of slugs instead of the org size, and a project is never reported missing because the catalog stopped at the pagination cap.
  • formatProjectTarget and explicitProjectSlugs in arg-parsing.ts keep titles, hints, and cursor context keys formatted identically.

Test plan

  • sentry issue list <org>/web,api --json resolves both IDs without a catalog request and sends one SDK request with both project IDs
  • unknown slugs fail before querying issues (one keeps the single-project error with suggestions; several produce one combined error that keeps each slug's suggestions); a failed lookup errors instead of falling back to slugs
  • selector aliases resolve with a DSN fingerprint present; stale aliases are replaced even on an empty page
  • -c next resumes when the slugs are retyped in another order
  • comma selectors trim empty entries, de-duplicate, reject display names, and validate each slug
  • <org>/a,b targets render the multi-project footer tip and -c next/prev hints with the full selector
  • sentry project list <org>/web,api looks up each project directly and preserves input order; non-404 errors propagate
  • project listing distinguishes missing projects from --platform filtering
  • single-project issue list / project list targets and comma-containing project create names behave as before
  • Manually against SaaS: in an org with ~1,000 projects the selector makes 2 project lookups cold and none warm (previously 11 sequential catalog pages); with a lowered pagination cap, a project beyond the first pages is still found; sentry issue view <ALIAS> resolves from a directory whose .env contains a DSN

@vercel

vercel Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Sep 29, 2026 3:35pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Sep 29, 2026 3:35pm UTC

Request Review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/cli/src/lib/arg-parsing.ts
Comment thread packages/cli/src/commands/project/list.ts Outdated

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/cli/src/lib/resolve-target.ts Outdated
Comment thread packages/cli/src/lib/resolve-target.ts Outdated
Comment thread packages/cli/src/commands/issue/list.ts Outdated

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/cli/src/commands/issue/list.ts Outdated
@betegon
betegon force-pushed the feat/comma-separated-project-slugs branch from 12a82a3 to 3160071 Compare September 28, 2026 17:16
@vercel
vercel Bot temporarily deployed to Preview – sentry-local September 28, 2026 17:16 Inactive

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/cli/src/commands/issue/list.ts Outdated
Comment thread packages/cli/src/commands/issue/list.ts Outdated
Comment thread packages/cli/src/commands/issue/list.ts Outdated
Comment thread packages/cli/src/commands/issue/list.ts Outdated
Comment thread packages/cli/src/commands/issue/list.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 27ad430. Configure here.

Comment thread packages/cli/src/commands/issue/list.ts Outdated
Comment thread packages/cli/src/lib/api/issues.ts
Comment thread packages/cli/src/lib/arg-parsing.ts
Allow same-org project subsets on issue and project list. Issue listing
passes all slugs through one SDK request; other commands preserve commas
as literal positional content.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Merge unknown-slug errors with each slug's suggestions instead of a
  generic hint; suggestions shared by every slug are listed once
- Narrow the issues API `projects` option to numeric IDs
- Document OrganizationIssuesOptions fields and list the selector
  helpers under Target Resolution in AGENTS.md
- Drop a unit test duplicated by the arg-parsing property test
- Add a `project list <org>/a,b` docs example

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — 18a23de1 Deployed Sep 29, 2026 by vercel[bot]
Preview – sentry-local — 18a23de1 Deployed Sep 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant