Skip to content

feat: add duplicate alert check service#585

Open
jerrymusaga wants to merge 1 commit into
StellaBridge:mainfrom
jerrymusaga:feature/backend-duplicate-alert-check
Open

feat: add duplicate alert check service#585
jerrymusaga wants to merge 1 commit into
StellaBridge:mainfrom
jerrymusaga:feature/backend-duplicate-alert-check

Conversation

@jerrymusaga
Copy link
Copy Markdown

Summary

Closes #511

  • Adds DuplicateAlertCheckService — a pre-save/pre-dispatch gate that fingerprints incoming alert events and matches them against recently-seen alerts within configurable time windows
  • Three configurable severity behaviors per rule: block (drop silently), escalate (allow but upgrade priority), review (queue for manual resolution)
  • Ships 3 sensible default dedup rules (exact-match block at 10 min, cross-source review at 5 min, critical escalation at 30 min) with full CRUD to add/update/delete custom rules
  • alert.service.ts calls duplicateAlertCheckService.check() before persistEvent and record() after, so every persisted alert is tracked for future dedup
  • REST API under /api/v1/duplicate-alert-check: rule management (/dedup-rules) and review queue (/review-queue + /review-queue/:id/resolve)
  • Unit tests covering: block within window, allow outside window, source matching, severity escalation, review queue enqueue/resolve

Test plan

  • npm run test:unit passes for duplicateAlertCheck.service.unit.ts
  • POST an alert that matches an existing event within 10 min → confirm it is blocked (not persisted)
  • POST a higher-priority re-trigger within 30 min → confirm priority escalated on the stored event
  • GET /api/v1/duplicate-alert-check/dedup-rules returns the 3 default rules
  • POST /api/v1/duplicate-alert-check/dedup-rules with a custom rule → rule appears in list and influences future checks
  • GET /api/v1/duplicate-alert-check/review-queue?status=pending lists queued near-duplicates
  • POST /api/v1/duplicate-alert-check/review-queue/:id/resolve with { action: "approved", reviewedBy: "..." } resolves the entry

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@jerrymusaga Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@jerrymusaga jerrymusaga force-pushed the feature/backend-duplicate-alert-check branch from d6b1925 to ea99228 Compare June 2, 2026 10:06
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.

Add Duplicate Alert Check Service

1 participant