-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: dismissed bug #5181
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
fix: dismissed bug #5181
Conversation
…, and also fix the restore/dismiss bug from the ui
|
@lucaspgz is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
🚨 BugBot couldn't runSomething went wrong. Try again by commenting "bugbot run", or contact support (requestId: serverGenReqId_bf29c8c0-631a-4f95-908b-558ae99a67cb). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Function Calls Pass Incorrect Data Type
The batch_enrich function and the enrich_entity method were updated to expect a list[dict] for their enrichment parameter (now named enrichments_list). However, at two call sites, a single dict is still being passed instead of a list containing the dictionary. This occurs in restore_previous_status when calling batch_enrich with updated_enrichments, and in assign_alert when calling enrich_entity with enrichments. The passed dictionaries should be wrapped in a list (e.g., [dict_variable]).
keep/api/bl/enrichments_bl.py#L954-L963
keep/keep/api/bl/enrichments_bl.py
Lines 954 to 963 in c4759ed
| # 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#L438-L439
keep/keep/api/routes/alerts.py
Lines 438 to 439 in c4759ed
| fingerprint=fingerprint, | |
| enrichments_list=enrichments, |
keep/api/routes/alerts.py#L911-L912
keep/keep/api/routes/alerts.py
Lines 911 to 912 in c4759ed
| fingerprints=fingerprints, | |
| enrichments_list=enrichments, |
keep/api/routes/alerts.py#L935-L936
keep/keep/api/routes/alerts.py
Lines 935 to 936 in c4759ed
| fingerprints=formatted_alert_ids, | |
| enrichments_list=enrichments, |
Bug: Test Ineffectiveness: Missing Disposable Fields
The tests test_dispose_dismiss_in_future_keeps_disposables and test_dispose_dismiss_no_dismissUntil are ineffective. They are intended to verify the preservation of disposable_* enrichments but do not add any disposable_* fields to the alert, rendering their assertions for these keys meaningless.
tests/test_enrichments.py#L1243-L1248
keep/tests/test_enrichments.py
Lines 1243 to 1248 in c4759ed
| # Verify disposable_* keys still exist (not removed) | |
| enrichment = get_enrichments(mock_session, mock_alert_dto.fingerprint) | |
| for key in enrichment: | |
| if key.startswith("disposable_"): | |
| # At least one disposable key should still be present | |
| assert key in enrichment |
tests/test_enrichments.py#L1263-L1268
keep/tests/test_enrichments.py
Lines 1263 to 1268 in c4759ed
| # Verify disposable_* keys still exist (nothing should be removed) | |
| enrichment = get_enrichments(mock_session, mock_alert_dto.fingerprint) | |
| # Tu código debe verificar que los "disposable_*" permanecen | |
| for key in enrichment: | |
| if key.startswith("disposable_"): | |
| assert key in enrichment |
Bug: Method Parameter Mismatch Causes Error
The enrich_entity method is called with the parameter enrichments_list, but its signature was not updated and still expects enrichments, which will cause a TypeError.
keep/api/routes/alerts.py#L436-L442
keep/keep/api/routes/alerts.py
Lines 436 to 442 in c4759ed
| enrichment_bl = EnrichmentsBl(tenant_id) | |
| enrichment_bl.enrich_entity( | |
| fingerprint=fingerprint, | |
| enrichments_list=enrichments, | |
| action_type=ActionType.ACKNOWLEDGE, | |
| action_description=f"Alert assigned to {user_email}, status: {status}", | |
| action_callee=user_email, |
Was this report helpful? Give feedback by reacting with 👍 or 👎
…, and also fix the restore/dismiss bug from the ui
Closes #5047
📑 Description
This pull request addresses two main points:
dismissed,dismissUntil, anddisposable_*fields of an alert afterdismissUntilexpiration, and also restores the alert's previous status (sent inbatch_enrichnow) when dismissUntil expires.✅ Checks
ℹ 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.