Skip to content

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

Open
toufali wants to merge 4 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 4 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 thread scripts/post_alert_action.py Outdated
Comment thread tests/scripts/test_post_alert_action.py
Comment thread scripts/post_alert_action.py Outdated
toufali added 2 commits August 5, 2026 15:20
Reasoning for ordering dismiss before bump_pr already lives in commit
d857acb and the PR description; keeping it out of the code per reviewer
preference.
…erity

The dismiss guard only blocked high/critical, so an unaffected alert with
an empty or 'unknown' severity (the workflow input defaults to '') slipped
through and got auto-dismissed — even though it could really be high/
critical. Also refuse to dismiss empty/unknown severities; add a regression
test. Flagged by Copilot on #118.
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

3 participants