* fix(costs): keep the daily average for a measured-zero range averageDailyValue returned null whenever the accumulated total was zero, so a cost history window the CLI measured as zero throughout lost its "Average/day" line entirely. The history rows built from the same points print those zeros since #274, and the function already counts a measured zero day in its denominator, so the summary contradicted the rows right below it. A provider with no priced usage in the window, such as a local model, hit this on every visit. Gate the null on an empty denominator instead of a zero total. That keeps a range with no measured day without an average and avoids the 0/0 the bare total check was hiding. Constraint: peak selection stays metric-based and still names no day when nothing was spent Rejected: returning zero from peakPoint too | its comment and test pin the empty peak deliberately Confidence: high Scope-risk: narrow Documentation impact: CHANGELOG Unreleased gained an entry; docs/usage.md and docs/cost-history.md describe the measured-zero average. TODO is unaffected: presentation-only change, no CLI contract touched. No new user-facing string, so the catalogs are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(costs): pin the formatted zero the average line prints The average test asserted the numeric result only, so a regression in the formatters could still print "Average/day: -" for a range measured as zero. amountString returns the dash for anything that is not a finite number, and no test covered either formatter at zero. Assert the two figures the caller composes the line from. Confidence: high Scope-risk: narrow Documentation impact: none; test-only change with no behavior difference. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
5 files changedLine totals unavailable