Skip to content

Cancel stale security-check notifications on Verified or Skipped#449

Merged
Monkopedia merged 1 commit into
mainfrom
fix-448-cancel-stale-security-notifications
May 5, 2026
Merged

Cancel stale security-check notifications on Verified or Skipped#449
Monkopedia merged 1 commit into
mainfrom
fix-448-cancel-stale-security-notifications

Conversation

@Monkopedia
Copy link
Copy Markdown
Owner

Summary

When a security check posts an alert/info notification and a later run
returns Verified or Skipped, the warning streak is reset in
SecurityCheckPreferences but the visible notification used to linger
in the shade until the user manually dismissed it.

  • Add SecurityCheckNotifier.cancel(check) to the contract interface
  • Implement in AndroidSecurityCheckNotifier by cancelling both the
    alert AND info notification ids (NotificationManager.cancel is
    idempotent, so cancelling an absent id is a no-op)
  • Call notifier.cancel(check) from SecurityCheckWorker.handleResult
    in the Verified and Skipped branches alongside the existing
    prefs.resetWarningStreak(sourceName) call

Test plan

  • :notifications:testDebugUnitTest — new tests in
    SecurityCheckNotifierTest verify cancel clears both alert+info,
    only targets the requested check, and is idempotent on empty shade
  • :work:testDebugUnitTest — new tests in SecurityCheckWorkerTest
    verify Verified and Skipped paths invoke cancel(check), an
    end-to-end repro (3 warnings -> info posted -> Verified -> cancel
    fires), and that Alert paths do NOT cancel themselves
  • ktlintCheck clean for :notifications and :work
  • detekt clean tree-wide

Closes #448

Previously, when a security check (CT log or self-cert) crossed the
warning threshold and posted an info/alert notification, a subsequent
Verified or Skipped run reset the in-prefs streak counter but never
cleared the notification from the shade. Users were left with stale
warnings indicating an outage that had already recovered.

Add SecurityCheckNotifier.cancel(check), implement in
AndroidSecurityCheckNotifier by cancelling both the alert and info
notification ids for the given check, and call it from
SecurityCheckWorker's Verified and Skipped branches alongside
prefs.resetWarningStreak(). NotificationManager.cancel is idempotent,
so cancelling an absent id is a no-op.

Closes #448
@Monkopedia Monkopedia merged commit dcfda5e into main May 5, 2026
3 checks passed
@Monkopedia Monkopedia deleted the fix-448-cancel-stale-security-notifications branch May 5, 2026 16:24
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.

Security check notifications never cancel after successful check

1 participant