Skip to content

[deep-report] [Code Quality] Unify token-usage metrics quartet and fix camelCase/snake_case json-tag inconsistency #46024

Description

@github-actions

Description

The token-usage metrics quartet {InputTokens, OutputTokens, CacheReadTokens, CacheWriteTokens} (plus Effective/Reasoning) is modeled four times, with an inconsistency worth fixing during consolidation:

  • pkg/cli/copilot_events_jsonl.go:100copilotUsageMetrics (uses camelCase json tags)
  • pkg/cli/token_usage.go:75ModelTokenUsage (snake_case json tags)
  • pkg/cli/token_usage.go:90ModelTokenUsageRow (a flattened near-dup of ModelTokenUsage)
  • pkg/cli/token_usage.go:27TokenUsageEntry

Extract a shared token-metrics core struct and embed it, aligning the json tag casing (the camelCase vs snake_case split is a latent serialization footgun).

Expected Impact

Single source of truth for token metrics, removes the camelCase/snake_case json-tag inconsistency, and collapses the ModelTokenUsage/ModelTokenUsageRow near-dup.

Suggested Agent

Code Quality agent (Go refactor). Typist audit context available.

Estimated Effort

Medium (1-4 hours)

Data Source

DeepReport Intelligence Briefing 2026-07-16, from the [typist] Go Type Consistency report (Cluster 8). Clusters 1/2/3/6 were already filed (#46000/#46001/#46002); Cluster 8 was un-filed as of this run.

Generated by 🔬 Deep Report · 247.5 AIC · ⌖ 12.4 AIC · ⊞ 10K ·

  • expires on Jul 18, 2026, 7:30 AM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions