GPT-5 finding
Division by zero can produce NaN for successRate when all runs are in progress
mediumbughigh
- dashboard/app/api/analytics/route.ts:105-117
successRate is computed as Math.round((success / (total - inProgress)) * 100). When inProgress equals total, the denominator is 0 and success/(0) yields NaN or Infinity. NaN comparisons later can misclassify insights, and JSON serialization will turn NaN into null, breaking clients expecting a number.
Recommendation
Compute completed = total - inProgress and handle completed <= 0 explicitly (e.g., set successRate to 0 or make the type number|null and set to null). Optionally exclude cancelled from the denominator as well: completed = success + failure.