Description
fraudRiskScorer returns a numeric risk score but gives no insight into which signals drove it. Contributors should add an explain option that, when true, attaches a factors array to the result — each factor listing its name, contribution weight, and the raw observed value — so risk reviewers can understand and audit the score.
Acceptance Criteria
Context
- Target file:
src/lib/fraudRiskScorer.ts
Description
fraudRiskScorerreturns a numeric risk score but gives no insight into which signals drove it. Contributors should add anexplainoption that, when true, attaches afactorsarray to the result — each factor listing its name, contribution weight, and the raw observed value — so risk reviewers can understand and audit the score.Acceptance Criteria
explain: trueis passed, the result includesfactors: Array<{name: string, weight: number, value: number}>factorsarray is sorted byweightdescending (highest-impact first)explainis false (default) thefactorsfield is absent from the result objectContext
src/lib/fraudRiskScorer.ts