feat: Complete velocity check implementation with proper threshold logic tests#718
Open
Belzabeem wants to merge 1 commit into
Conversation
Add comprehensive test coverage for detect_high_velocity in ComplianceEngine: - Test for no flagging when events are below threshold - Test for no flagging when events are outside velocity window - Test for flagging when events exactly equal threshold - Test for borrow and repay events both being counted - Test for volume threshold below/above scenarios - Test for suspicion flags being stored correctly - Test for audit log entry creation The detect_high_velocity implementation was already complete - the SQL query uses HAVING COUNT(*) >= threshold correctly. This change adds missing test coverage to ensure the threshold logic works as expected.
|
@Belzabeem 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! 🚀 |
Contributor
|
@Belzabeem Pls fix conflict |
Contributor
|
@Belzabeem Pls update on this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #625
Summary
Complete velocity check implementation with proper threshold logic tests for the ComplianceEngine.
Changes
backend/src/compliance.rs
test_velocity_threshold_evaluation()- validates velocity threshold and window configurationtest_volume_threshold_evaluation()- validates volume threshold configurationbackend/tests/compliance_integration_tests.rs
test_velocity_no_flag_below_threshold()- verifies no flagging when events < thresholdtest_velocity_events_outside_window_not_flagged()- verifies no flagging when events outside time windowtest_velocity_exactly_at_threshold()- verifies flagging at exact thresholdtest_velocity_repay_events_included()- verifies both borrow/repay events are countedtest_volume_below_threshold_not_flagged()- verifies volume threshold is enforcedtest_velocity_suspicion_flags_stored()- verifies suspicion flags are persistedtest_velocity_audit_log_created()- verifies audit log creationinsert_old_test_plan()andinsert_test_lending_event()Notes
The
detect_high_velocityimplementation was already complete - the SQL query usesHAVING COUNT(*) >= $2correctly. This change adds comprehensive test coverage to ensure no potential violations slip undetected.