Skip to content

fix(event-view): add cross-org fallback when event not found#744

Merged
BYK merged 5 commits intomainfrom
fix/event-view-cross-org-fallback
Apr 14, 2026
Merged

fix(event-view): add cross-org fallback when event not found#744
BYK merged 5 commits intomainfrom
fix/event-view-cross-org-fallback

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 14, 2026

Summary

Fixes #734sentry event view now finds events even when the user specifies the wrong organization.

  • Adds a cross-org fallback to fetchEventWithContext: after project-scoped and same-org lookups both return 404, fans out to all accessible orgs via findEventAcrossOrgs
  • Warns the user when the event is found in a different org/project
  • Adds excludeOrgs option to findEventAcrossOrgs to skip the already-searched org
  • Extracts fallback logic into tryEventFallbacks() helper to stay under Biome's complexity limit

Fallback chain (updated)

  1. getEvent(org, project, eventId) — project-scoped
  2. resolveEventInOrg(org, eventId) — same-org, cross-project
  3. NEW: findEventAcrossOrgs(eventId, { excludeOrgs: [org] }) — all accessible orgs
  4. ResolutionError with suggestions

Test plan

  • Updated 1 existing test, added 4 new tests covering cross-org success, excludeOrgs passthrough, error swallowing, and cascading from same-org errors
  • All 68 event view tests pass
  • Typecheck and lint clean

When a user specifies the wrong org (e.g., `sentry event view wrong-org/cli/<id>`),
the event lookup now searches across all accessible organizations as a last resort,
instead of only searching within the specified org.

Fallback chain: project-scoped fetch → same-org eventids → cross-org fan-out.
Warns the user when the event is found in a different org/project.

Also adds `excludeOrgs` option to `findEventAcrossOrgs` to skip the org already
searched, avoiding a redundant API call.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (cli) Add sentry cli defaults command for persistent settings by BYK in #721
  • (docs) Auto-generate driftable documentation sections by BYK in #739
  • (issue-list) Add search syntax docs, case-insensitive AND/OR, and JSON syntax reference by BYK in #738
  • (trace) Consistent project filtering across trace commands (feat: support filtering spans by project within a trace #737) by BYK in #743
  • (trace-view) Expose span attributes in trace and span views by BYK in #742

Bug Fixes 🐛

Init

  • Treat no-op edits as passthrough instead of throwing by betegon in #731
  • Remove JSON minification that breaks edit-based codemods by betegon in #719

Resolve

  • Address review comments and add tests for fuzzy project recovery by BYK in #732
  • Fuzzy auto-recovery for project slug resolution by BYK in #728

Upgrade

  • Detect npm install method from node_modules path by BYK in #723
  • Add shell option on Windows for .cmd package managers by BYK in #722

Other

  • (ci) Add retry logic to ORAS/bsdiff downloads and upgrade ORAS by BYK in #741
  • (dashboard) Remove overly restrictive dataset-display cross-validation by BYK in #720
  • (errors) Improve ContextError wording for auto-detect failures by BYK in #726
  • (event-view) Add cross-org fallback when event not found by BYK in #744
  • (issue) Support share issue URLs by BYK in #718
  • (issue-list) Auto-correct AND and reject OR in --query to prevent 400 by BYK in #727
  • (telemetry) Rename isClientApiError to isUserApiError and exclude 400 by BYK in #729
  • Bug fixes from Sentry error monitoring (CLI-FR, CLI-RN) + auth default by BYK in #740

Internal Changes 🔧

  • Regenerate skill files by github-actions[bot] in ca16b2ff

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-04-14 01:26 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Codecov Results 📊

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

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1628 uncovered lines.
✅ Project coverage is 95.3%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.29%    95.30%    +0.01%
==========================================
  Files          234       234         —
  Lines        34606     34646       +40
  Branches         0         0         —
==========================================
+ Hits         32977     33018       +41
- Misses        1629      1628        -1
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review April 14, 2026 00:55
…gation

- Only exclude the org from cross-org search when same-org search completed
  successfully (returned null). Transient errors (500, timeout) no longer
  prevent the cross-org fallback from retrying that org.
- Re-throw AuthError from cross-org fallback instead of swallowing it,
  matching the behavior in findEventAcrossOrgs and resolveAutoDetectTarget.
Same-org catch block now also re-throws AuthError, consistent with the
cross-org catch block. Prevents masking auth problems behind misleading
"event not found" errors.
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 07c0a34. Configure here.

@BYK BYK merged commit c70677a into main Apr 14, 2026
26 checks passed
@BYK BYK deleted the fix/event-view-cross-org-fallback branch April 14, 2026 01:35
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.

bug: sentry event view cannot find events visible in trace view

1 participant