Skip to content

burn summary: surface fidelity per-cell (partial-coverage notation, footer note, JSON block) #136

@willwashburn

Description

@willwashburn

Context

PR #76 (#41 first cut) landed summarizeFidelity / hasMinimumFidelity and per-turn fidelity flags. The granular fidelity-aware command follow-ups landed for compare (#95 → PR #135), waste (#100 → PR #133), limits (#105 → PR #132), and plans (#108 → PR #134). `burn summary` was never given its own granular issue.

PR #127 ("Complete fidelity-aware command contracts", closed in favor of the granular PRs) included a substantial `burn summary` block (~119 lines in `packages/cli/src/commands/summary.ts`) that no granular PR covers. This issue tracks porting that work.

Issue #41's "Command behavior contract → burn summary" bullet captures the intent:

`burn summary` should distinguish a literal $0 / 0 tokens from "no cost data" / "no token data" — render `—` (or equivalent) for the latter, and never imply $0.00 attribution where the source is silent.

Proposal

In `packages/cli/src/commands/summary.ts`:

  1. Per-field usage coverage accumulator. While building the per-(model, project, …) cells, track `{ knownTurns, missingTurns, unknownTurns }` for each token field (input/output/reasoning/cache_read/cache_create) using the `TurnRecord.fidelity.coverage` flags.
  2. Cell rendering.
    • When `knownTurns === 0` and `missingTurns > 0`: render `—` (no number, no $0.00).
    • When `knownTurns > 0` and `missingTurns > 0`: render the value with a `*` suffix (or equivalent partial-coverage marker) and add a footer note explaining the marker.
  3. Footer notice. When any cell carries the partial-coverage marker, append a single line: `* partial coverage: N of M turns omitted per-turn token data`. Suppress when every cell is fully covered (avoid noise in the common case).
  4. JSON contract. Add a `fidelity` block matching the shape used by sibling fidelity PRs — `{ summary: FidelitySummary, perCell?: { … } }`. Reuse `summarizeFidelity` for consistency with burn compare: honor fidelity (default-exclude aggregate-only/cost-only, annotate, --fidelity flag) #95/burn waste: honor fidelity (refuse aggregate-only/cost-only, name missing prerequisites) #100/burn limits: honor fidelity (mark forecasts low-confidence on partial usage) #105/burn plans: honor fidelity (mark monthly spend totals low-confidence on partial usage) #108.

Acceptance criteria

  • A summary over mixed-fidelity input shows `*` markers on cells where some turns lacked token data, plus a single footer note.
  • A summary over fully-missing fields renders `—` and never `$0.00` / `0%` for those fields.
  • Full-fidelity summaries show no marker and no footer note.
  • `--json` payload includes a `fidelity` block keyed off `summarizeFidelity` (same shape as `compare --json` from PR Honor fidelity in burn compare (#95) #135).
  • Tests in `packages/cli/src/commands/summary.test.ts` cover all-full, all-missing, and mixed cases.

Out of scope

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions