Skip to content

fix(alert): guard against undefined conditions/actions in list command - #1313

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-2ca-alert-list-undefined-props
Open

fix(alert): guard against undefined conditions/actions in list command#1313
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-2ca-alert-list-undefined-props

Conversation

@sentry

@sentry sentry Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR addresses CLI-2CA, a TypeError occurring in the sentry alert issues list command.

The error "TypeError: Cannot read properties of undefined (reading 'length')" was triggered when r.conditions or r.actions were undefined in the alert rule object returned by the Sentry API. The code at src/commands/alert/issues/list.ts lines 478-479 was directly accessing .length on these potentially undefined properties.

The fix involves adding optional chaining (?.) and nullish coalescing (?? 0) to safely handle cases where conditions or actions might be undefined, ensuring that String(undefined.length) is avoided and 0 is used instead.

Fixes CLI-2CA

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

@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-07-29 22:38 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

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

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.75%    81.75%        —%
==========================================
  Files          430       430         —
  Lines        30063     30063         —
  Branches     19707     19711        +4
==========================================
+ Hits         24578     24578         —
- Misses        5485      5485         —
- Partials      2043      2043         —

Generated by Codecov Action

@sentry
sentry Bot marked this pull request as ready for review July 29, 2026 22:47
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 29, 2026
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.

0 participants