Skip to content

Add configurable anomaly sensitivity and opt-in fraud risk factor explanations - #779

Open
GenesisPray wants to merge 2 commits into
Stellar-split:mainfrom
GenesisPray:drips/697-698
Open

GenesisPray wants to merge 2 commits into
Stellar-split:mainfrom
GenesisPray:drips/697-698

Conversation

@GenesisPray

@GenesisPray GenesisPray commented Sep 24, 2026 •

Copy link
Copy Markdown

Summary

Add configurable anomaly sensitivity and opt-in fraud risk factor explanations

What was solved

#697 — anomalyDetector: Add configurable sensitivityLevel option (low/medium/high)

Add a configurable sensitivityLevel option to anomalyDetector that maps low/medium/high to Z-score thresholds 3.0/2.0/1.5 (default medium), and include the active sensitivityLevel in every anomaly report object for auditability, while keeping existing behavior/tests passing.

Addressed:

  • Changed: src/lib/anomalyDetector.ts
  • Accept a sensitivityLevel: "low" | "medium" | "high" option with default "medium"
  • Map levels to Z-score thresholds: low→3.0, medium→2.0, high→1.5
  • Include the current sensitivityLevel in every anomaly report object

#698 — fraudRiskScorer: Add explainability output listing contributing risk factors

Add an opt-in explain capability to fraudRiskScorer so that when explain: true is passed, the returned result includes a factors array of {name, weight, value} entries sorted by weight descending, while the default (no explain) result omits factors entirely.

Addressed:

  • Changed: src/lib/fraudRiskScorer.ts
  • When explain: true is passed, the result must include factors: Array<{name: string, weight: number, value: number}>
  • The factors array must be sorted by weight descending (highest-impact first)
  • When explain is false or omitted (default), the factors field must be absent from the result object

Changes

  • src/lib/anomalyDetector.ts (modify)
  • src/lib/fraudRiskScorer.ts (modify)

Approach

  1. anomalyDetector: Add configurable sensitivityLevel option (low/medium/high) #697 — anomalyDetector: Add configurable sensitivityLevel option (low/medium/high) (Changed: src/lib/anomalyDetector.ts)
  2. fraudRiskScorer: Add explainability output listing contributing risk factors #698 — fraudRiskScorer: Add explainability output listing contributing risk factors (Changed: src/lib/fraudRiskScorer.ts)

Issues

Closes #697
Closes #698
Closes #695
Closes #696

@vercel

vercel Bot commented Sep 24, 2026

Copy link
Copy Markdown

@GenesisPray is attempting to deploy a commit to the kingsman-99's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Sep 24, 2026

Copy link
Copy Markdown

@GenesisPray 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! 🚀

Learn more about application limits

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant