Skip to content

feat(cli): Support magic selectors in event view, defaulting to @latest - #1793

Merged
BYK merged 4 commits into
mainfrom
seer/fix/cli-event-view-project-latest
Nov 2, 2026
Merged

BYK merged 4 commits into
mainfrom
seer/fix/cli-event-view-project-latest

Conversation

@sentry

@sentry sentry Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

sentry event view without an event ID used to fail with ContextError: Event ID is required. AI agents hit this a lot. Now event view accepts the issue selectors the other commands already take, and with no event ID it falls back to @latest.

  • @latest and @most_frequent (and the existing aliases such as @most-frequent) show the selected issue's latest event.
  • Scopes: bare (the auto-detected org, as issue view @latest uses), <org>/@sel, <org>/<project>/@sel, or a bare selector before or after a separate target (my-org/my-project @latest).
  • With no event ID it defaults to @latest: sentry event view, sentry event view <org>/, and sentry event view <org>/<project> all work. <org>/<project>/ (an empty ID typed after the slash) and "" still raise the missing-event-ID error.
  • A selector combined with event or issue IDs is rejected with a ValidationError.

Project-scoped selectors go through a new findSelectorIssue helper in issue/utils.ts, which resolveSelector now uses too. It picks the project by numeric ID (resolveProjectIdsInOrg), so projects that are not actively selected still match (#1317).

The selectors are now described once, in ISSUE_SELECTORS next to parseSelector. issueSelectorHelp() renders the --help lines for event view, event list, and the issue commands from it, and their existing help text is unchanged. Shell completion now suggests the selectors for a word that starts with @, bare or after org/, in every issue argument. event view now completes as an issue argument, so it also suggests cached issue short IDs.

This PR first added a separate errors-dataset lookup for <org>/<project>. That lookup is gone, along with the project param it added to explore.ts. One behavior difference: the old lookup returned the project's newest error event of any kind, while @latest returns the latest event of the most recently seen unresolved issue. That matches what @latest means everywhere else.

When no target is given, the selector searches the auto-detected org (the same scope issue view @latest uses). It is not narrowed to a DSN-detected project. If a project-scoped default would be better there, that's a small follow-up.

Fixes CLI-CG

--

View Session in Sentry

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 2, 2026 11:53am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 2, 2026
Comment thread packages/cli/src/lib/api/events.ts Resolved
`sentry event view` now takes the issue selectors `@latest` and
`@most_frequent` (also as `<org>/@sel`, `<org>/<project>/@sel`, or after a
separate target) and shows the selected issue's latest event. Without an
event ID it defaults to `@latest`, so `sentry event view`,
`sentry event view <org>/`, and `sentry event view <org>/<project>` all
work instead of failing with "Event ID is required".

Project-scoped selectors pick the project by numeric ID, so projects
that are not actively selected still match (#1317). This replaces the
errors-dataset lookup for `<org>/<project>`, which is no longer needed.

Co-Authored-By: BYK <[email protected]>
Co-Authored-By: Claude <[email protected]>
@sentry-junior sentry-junior Bot changed the title fix(cli): Show latest project event when event view is passed org/project without event ID feat(cli): Support magic selectors in event view, defaulting to @latest Nov 2, 2026
Comment thread packages/cli/src/commands/event/view.ts Resolved
Describe `@latest` and `@most_frequent` once in `ISSUE_SELECTORS`, next to
the selector parser, and render the help lines of `event view`,
`event list`, and the issue commands from it.

Shell completion now suggests the selectors for a word that starts one,
bare or after `org/`, in every issue argument. `event view` completes as
an issue argument, so it also suggests cached issue short IDs.

Co-Authored-By: BYK <[email protected]>
Co-Authored-By: Claude <[email protected]>
@BYK
BYK enabled auto-merge (squash) November 2, 2026 11:58
@BYK
BYK merged commit b035e80 into main Nov 2, 2026
27 checks passed
@BYK
BYK deleted the seer/fix/cli-event-view-project-latest branch November 2, 2026 12:05

This branch was previously deployed

1 inactive deployment
Preview — 394323b7 Deployed Nov 2, 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