Files
buzz/desktop/tests
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7andWill Pfleger 031541a301 fix(agent-usage): clear Thufir pass-1 findings (5 correctness fixes)
1. Gate unknown-intervals caveat on direct i/o incompleteness
   (isPartialField(inputTokens) || isPartialField(outputTokens)) instead
   of hasUnknownUsage, which ORs total/cost incompleteness too and cannot
   prove an i/o interval claim. Narrow copy to 'Some input/output usage
   could not be counted and is omitted rather than shown as zero.' Fix the
   incorrect deltaReliable comment.

2. deriveDisplayTotal fail-closed: approximate only when BOTH input and
   output are non-null. One-sided i/o returns unknown for the total (the
   independent display fields may still show the known value). Replace
   one-sided approximate tests with fail-closed tests.

3. sumKnownBucketTotals returns a single provenance-bearing DisplayTotal
   instead of parallel {knownTotal, approxTotal, partial}. Exact when
   every report-bearing bucket is exact; approximate (summing
   exact+approx display values) when any bucket is approximate; unknown
   when any report-bearing bucket has no display value. Partial derives
   from the union of each bucket's DisplayTotal.partial (i/o and total
   completeness) — not from total absence. Add mixed-bucket test.

4. Partial provenance end-to-end: AgentUsageSection header consumes the
   single DisplayTotal and derives partial from its .partial field.
   deriveBarState carries dt.partial in the approx bar (new
   'approx-partial' kind) so genuinely incomplete i/o is identified in
   daily bar styling and accessible copy. Approximation alone no longer
   triggers Partial.

5. Behavioral e2e guard: new scenario seeds both i/o + totalTokens:null
   and asserts all four surfaces (overview row, header, daily bar,
   focused total) render '≈'. Fix stale 'in 800' assertion to '≈ 1K'.
   Update the coverage-dates partial-explanation fixture to use
   incomplete i/o fields so the new gate fires correctly.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-07-29 16:50:19 -04:00
..