-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(api): resolve ticket and implement unit tests #5050
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(api): resolve ticket and implement unit tests #5050
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
🚨 BugBot couldn't runBugbot requires usage-based pricing. Have a team administrator enable usage-based pricing in your Cursor dashboard to continue using BugBot. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5050 +/- ##
==========================================
+ Coverage 46.21% 46.24% +0.03%
==========================================
Files 172 173 +1
Lines 17833 17901 +68
==========================================
+ Hits 8241 8279 +38
- Misses 9592 9622 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚨 BugBot couldn't runSomething went wrong. Try again by commenting "bugbot run", or contact support (requestId: serverGenReqId_70472267-dc01-4f78-867f-5d45b4beecaf). |
close #5047
The core issue #5047 involved CEL filters failing to return alerts with
dismissed: falseafter theirdismissedUntilperiod expired. This occurred because SQL-based CEL filtering directly queried raw database values, bypassing theAlertDtovalidation that correctly handles dismissal expiration.The fix introduced a
cleanup_expired_dismissals()function inkeep/api/core/db.py. This function updates the database, settingdismissed=falsefor alerts wheredismissedUntilhas passed. This ensures SQL queries reflect the correct dismissal status. The cleanup is now exclusively called withinquery_last_alerts()inkeep/api/core/alerts.py. A previous duplicate call inkeep/searchengine/searchengine.pywas removed to ensure cleanup occurs only once at the lowest query level, preventing redundant operations.Comprehensive testing was added in
tests/test_expired_dismissal_cel_fix_enhanced.pyusingfreezegunto simulate time progression, verifying the fix across various expiration scenarios, API integration, and edge cases. Thetest_fix_demo.pyscript was also updated for standalone verification.Redundant code from an initial misunderstanding was removed:
_generate_rss_feed,get_preset_rss_feed) and an unusedescapeimport were removed fromkeep/api/routes/preset.py.tests/test_rss_feed.pyfile was deleted.EXPIRED_DISMISSAL_FIX_SUMMARY.md,FINAL_COMPLETION_SUMMARY.md) andtest_fix_demo.pywere moved to thetests/directory for better organization.