Skip to content

fix: cleaning of fields after dismissUntil expiration #5188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

lucaspgz
Copy link

Closes #5047

📑 Description
This pull request addresses two main points:

Fixes the bug related to cleaning the dismissed, dismissUntil, and disposable_* fields of an alert after dismissUntil expiration, and also restores the alert's previous status (sent in batch_enrich now) when dismissUntil expires.
Fixes the bug in the UI where selecting two alerts in the feed, even if both are dismissed, triggers the dismiss pop-up, instead of the restore one in that case.
✅ Checks
My pull request adheres to the code style of this project
My code requires changes to the documentation
I have updated the documentation as required
All the tests have passed
ℹ Additional Information
It has been tested both with dedicated tests and via direct alert sending through API, dismissing them with a workflow, and also via the UI tool. It works correctly for single or multiple alerts, as needed.

Copy link

vercel bot commented Jul 16, 2025

@lucaspgz is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Bug Something isn't working UI User interface related issues labels Jul 16, 2025
cursor[bot]

This comment was marked as outdated.

@CLAassistant
Copy link

CLAassistant commented Jul 16, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Batch Enrichment Function Requires List Input

The batch_enrich function (and enrich_entity which calls it) was updated to expect enrichments_list as a list of dictionaries, with one dictionary per fingerprint. However, several call sites incorrectly pass a single dictionary instead of a list. This requires wrapping the dictionary in a list (e.g., [enrichments]) or replicating it for multiple fingerprints (e.g., [enrichments] * len(fingerprints)).

keep/api/bl/enrichments_bl.py#L954-L963

# Save the updated enrichment data in the database and Elasticsearch
batch_enrich(
tenant_id,
[fingerprint],
updated_enrichments,
action_type=ActionType.DISPOSE_ENRICHED_ALERT,
action_callee='system',
action_description='Restore previous status after dismiss',
session=session,
)

keep/api/routes/alerts.py#L911-L912

fingerprints=fingerprints,
enrichments_list=enrichments,

keep/api/routes/alerts.py#L935-L936

fingerprints=formatted_alert_ids,
enrichments_list=enrichments,

Fix in CursorFix in Web


Bug: Method Parameter Mismatch Causes Error

The enrich_entity method is called with the parameter enrichments_list, but its signature still expects enrichments. This parameter name mismatch will cause a TypeError.

keep/api/routes/alerts.py#L438-L439

fingerprint=fingerprint,
enrichments_list=enrichments,

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files. UI User interface related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: CEL filters not returning alerts with dismissed: false after dismissedUntil expires
3 participants