Files
buzz/desktop
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7andWill Pfleger b384fc9a56 fix(agent-usage): centralize DisplayTotal, re-sort by display tier, split caveat
Fold Thufir's three blocking amendments into cbfbe1ed0:

1. Centralize display metric as DisplayTotal {kind, value, partial}.
   deriveApproxTotal() replaced by deriveDisplayTotal() returning an
   explicit exact|approximate|unknown discriminant with provenance:
   - exact: totalTokens.value present; partial mirrors wire incomplete flag
   - approximate: totalTokens null, i/o known; value = bigint-safe i/o sum;
     partial = inputTokens.incomplete || outputTokens.incomplete
   - unknown: no token counts at all; value null, partial false
   All surfaces (Section header/bars/rows, DailyBars, FocusedView stat)
   now consume this single result — no surface can drift independently.

2. Re-sort agents/models by display tier.
   sortAgentsByKnownTotal/sortModelsByKnownTotal replaced by
   sortAgentsByDisplayTotal/sortModelsByDisplayTotal using a three-tier
   key (exact=0, approximate=1, unknown=2), descending by value within
   tier, then existing tiebreaks. With all-null prod totals the list
   order and bar widths now agree instead of disagreeing.

3. Split caveat paragraph into per-condition sentences.
   The single agent-usage-focused-partial-explanation block replaced by
   two separately-gated <p> elements:
   - agent-usage-focused-unknown-intervals-caveat: gates on hasUnknownUsage
   - agent-usage-focused-invalid-reports-caveat: gates on invalidReportCount > 0
   Each sentence claims only what its gate proves.

Test updates:
- deriveApproxTotal tests replaced with deriveDisplayTotal tests covering
  all three kinds, partial provenance, and i/o-only combinations.
- Sort tests updated for new export names and assertions.
- Mixed exact/approximate/unknown population tests added for both
  sortAgentsByDisplayTotal and sortModelsByDisplayTotal.
- e2e spec updated from single partial-explanation testid to the two
  per-condition testids.
- 3567 tests pass, tsc --noEmit clean.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-07-29 14:23:51 -04:00
..
…

Buzz

Desktop chat shell with:

  • Tauri + React + TypeScript + Vite
  • Tailwind CSS
  • shadcn/ui-ready shared components
  • Biome (lint/format/check)
  • Feature-driven frontend structure

Scripts

  • pnpm dev - run the web frontend
  • pnpm tauri dev - run the desktop app
  • pnpm build - typecheck and build frontend
  • pnpm typecheck - TypeScript checks
  • pnpm lint - Biome lint
  • pnpm format - Biome format (write)
  • pnpm check - Biome check

Structure

  • src/shared - reusable app-wide code (ui, lib, styles)
  • src/features - feature modules (vertical slices)
  • src/app - top-level app composition