Skip to content

fix(investigate): check dismiss before npm_bump so dismiss_unaffected fires for npm - #118

Open
toufali wants to merge 2 commits into
mainfrom
fix/dismiss-before-npm-bump
Open

fix(investigate): check dismiss before npm_bump so dismiss_unaffected fires for npm#118
toufali wants to merge 2 commits into
mainfrom
fix/dismiss-before-npm-bump

Conversation

@toufali

@toufali toufali commented Aug 4, 2026

Copy link
Copy Markdown
Member

Fixes #112.

For an unaffected alert, the recommended == "bump_pr" branch (→ npm_bump) was evaluated before the dismiss_enabled branch, so on npm repos unaffected alerts always routed to npm_bump and investigate.dismiss_unaffected: true never took effect.

This moves the dismiss check (unaffected + low/medium) above the bump branch in post_alert_action.py, so unaffected low/medium alerts are dismissed as intended. Critical/high are unchanged (still blocked from auto-dismiss).

🤖 Generated with Claude Code

… fires for npm

Fixes #112

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@toufali
toufali requested a review from groovecoder as a code owner August 4, 2026 20:30
)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the alert routing logic in scripts/post_alert_action.py so that, for unaffected alerts, the “dismiss if enabled (and severity allows)” path is evaluated before the recommended_action == "bump_pr" path—preventing npm alerts from always taking the npm_bump route and making investigate.dismiss_unaffected: true effective for npm (per #112).

Changes:

  • Reordered the “dismiss unaffected (low/medium)” check to run before the bump_pr / npm_bump routing logic.
  • Added a regression test ensuring unaffected npm alerts are dismissed (not routed to npm_bump) when dismissal is enabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
scripts/post_alert_action.py Moves the dismiss-unaffected check earlier so it takes precedence over the bump path (including npm).
tests/scripts/test_post_alert_action.py Adds a regression test to ensure dismissal wins over npm_bump for unaffected npm alerts.

Comment on lines +473 to +480
elif dismiss_enabled and severity.lower() not in DISMISS_BLOCKED_SEVERITIES:
# Checked before bump_pr: dismissing is the intended outcome for an
# unaffected low/medium alert, and it must take precedence over the
# npm bump path (which is npm-only and never fired dismiss for npm
# alerts — see #112).
print(" Unaffected + dismiss enabled (low/medium). Dismissing alert.")
dismiss_alert(repo, alert_number, reason, dry_run)
action = "dismissed"
outputs = open(output_file).read()
assert "action=dismissed" in outputs
assert "action=npm_bump" not in outputs

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.

fix(investigate): npm alerts route to npm_bump before the dismiss check, so dismiss_unaffected never fires

2 participants