Problem
NaN passes the typeof === "number" check, then NaN == null and NaN > limit are both false, so the refund resolves with amount: NaN. Distinct from #3 (zero/negative).
Where
lib/agent.ts (amount extraction) + lib/policy.ts (decision).
Acceptance
Add a failing test first asserting decide({...refund, refundAmount: NaN}, ...) escalates asking to confirm the amount. Then fix.
Problem
NaNpasses thetypeof === "number"check, thenNaN == nullandNaN > limitare both false, so the refund resolves withamount: NaN. Distinct from #3 (zero/negative).Where
lib/agent.ts(amount extraction) +lib/policy.ts(decision).Acceptance
Add a failing test first asserting
decide({...refund, refundAmount: NaN}, ...)escalates asking to confirm the amount. Then fix.