Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(alert): Handle missing conditions/actions in issue alert view - #1331

Merged
BYK merged 1 commit into
mainfrom
seer/fix/alert-view-missing-conditions-actions
Aug 1, 2026
Merged

BYK merged 1 commit into
mainfrom
seer/fix/alert-view-missing-conditions-actions

Conversation

@sentry

@sentry sentry Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

The sentry alert issues view command would crash with a TypeError when the Sentry API's /workflows/ endpoint omitted the conditions or actions arrays for an issue alert rule. This happened because formatIssueAlertView in packages/cli/src/commands/alert/issues/view.ts directly accessed .length on these potentially undefined properties.

This fix addresses the issue by:

  1. Updating the IssueAlertRule type in packages/cli/src/lib/api/alerts.ts to mark conditions and actions as optional (?: unknown[]), accurately reflecting the API's behavior.
  2. Modifying formatIssueAlertView to use optional chaining and nullish coalescing (rule.conditions?.length ?? 0 and rule.actions?.length ?? 0), ensuring that 0 is displayed if these properties are missing, preventing the TypeError.

Fixes CLI-2CY

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-01 16:06 UTC

@sentry
sentry Bot marked this pull request as ready for review August 1, 2026 10:49
@BYK
BYK merged commit 04efb12 into main Aug 1, 2026
30 checks passed
@BYK
BYK deleted the seer/fix/alert-view-missing-conditions-actions branch August 1, 2026 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant