feat: harden AML velocity rule for sliding-window smurfing detection - #2
Open
Tobore2000 wants to merge 1 commit into
Open
feat: harden AML velocity rule for sliding-window smurfing detection#2Tobore2000 wants to merge 1 commit into
Tobore2000 wants to merge 1 commit into
Conversation
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.
Summary\n- Add PostgreSQL-backed persistence for aml_investment_velocity using a composite-key upsert.\n- Wire the production AML factory to the database velocity repository.\n- Make repeated alerts for the same investment and rule version idempotent.\n- Add repository and service regression tests plus security and operations documentation.\n\n## Security and correctness\n- Failed investments are excluded and investor/window boundaries are enforced.\n- Late-arriving events update the existing aggregate row without duplication.\n- Alert details retain linked investment IDs for analyst traceability.\n- Monetary aggregate persistence uses PostgreSQL NUMERIC; evaluator precision assumptions are documented.\n\n## Validation\n- Focused AML tests: npx jest --runInBand src/aml/ruleEvaluator.test.ts src/aml/amlService.test.ts src/aml/velocityRepository.test.ts\n- Result: 3 suites passed, 80 tests passed.\n- Full npm test: blocked by broad ts-jest transform failures (221 failed, 11 passed) with TypeError: Cannot read properties of undefined (reading toString).\n- npm run build: blocked by unrelated pre-existing TypeScript errors in distribution/reconciliation services.\n- ESLint: unavailable because the repository has no ESLint 9 flat config.\n