Skip to content

feat(compliance): add the aml rules engine and rolling-window aggregator - #279

Merged
tiana-code merged 1 commit into
mainfrom
feat/E-04-aml-engine
Jun 19, 2026
Merged

feat(compliance): add the aml rules engine and rolling-window aggregator#279
tiana-code merged 1 commit into
mainfrom
feat/E-04-aml-engine

Conversation

@tiana-code

Copy link
Copy Markdown
Owner

E-04 Compliance #266 - generic AML building blocks (the event consumer that composes them is #267).

What

  • AmlEvaluator (@Component): embeds the decision-engine lib in-process (like payments screening), parses the configured rule fail-closed at construction, and maps a match on the configured flagLabel to Flagged(reasonCodes), else Clear. The default rule is neutral (always yields CLEAR != flagLabel) so an unconfigured engine never flags - no business logic baked in.
  • RollingWindowAggregator (pure @Component): generic count + BigDecimal sum over PER_TRANSACTION (most recent by time), MONTH (>= now-30d, boundary inclusive) and LIFETIME windows. No thresholds - the caller interprets the result.
  • Value types (AmlTransactionView, AmlDecision, AmlObservation, WindowAggregate, AmlWindow), AmlRulesProperties + ComplianceConfig (@EnableConfigurationProperties), decision-engine added as a project dependency.

Clean-room (§5.3.1)

No real AML rules, thresholds, score-bands, lists, PEP, or foreign IP. Generic attributes (amount/currency/subjectReference) + neutral labels (CLEAR/FLAG). subjectReference opaque.

Gate chain

  • critic: GO-WITH-CHANGES (ComplianceConfig binding, neutral-label inertness + tests, 30 named const, per-tx by-time - all applied).
  • security-auditor (opus): PASS - the epic's highest §5.3 risk, audited clean; BigDecimal money; fail-closed; 4/4 ACs.
  • code-reviewer: 2 must-fix applied (specific DecisionDslException in the fail-closed test; a label-discriminator test).
  • evaluator: PASS (0.90).
    All local gates green; pure unit tests (no new IT).

Closes #266

Add two generic, reusable AML building blocks. The AmlEvaluator embeds
the decision engine in-process to score a transaction against a
configurable rule, parsing the rule fail-closed at construction so an
invalid rule fails startup rather than silently clearing; its default
rule is neutral and never flags. The RollingWindowAggregator counts and
sums observations over per-transaction, month and lifetime windows
without baking in any threshold. No real rules or business values; the
event consumer that composes them lands in a later slice.

Closes #266
@tiana-code tiana-code added this to the v0.3.0 milestone Jun 19, 2026
@tiana-code
tiana-code merged commit 0743ab1 into main Jun 19, 2026
8 checks passed
@tiana-code
tiana-code deleted the feat/E-04-aml-engine branch June 19, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F-04.6 AML rules engine + rolling-window aggregation

1 participant