Skip to content

[deep-report] Replace loose any typing in pkg/typeutil/lookup.go and pkg/cli/token_usage_parse.go with concrete types #66973

Description

@github-actions

Description

pkg/typeutil/lookup.go (e.g. LookupMap/LookupString, lines 20-41) and pkg/cli/token_usage_parse.go (e.g. extractUsageRecord/usageNumericValue/usageStringValue, lines 146-190) both center their logic on map[string]any lookups with repeated ad-hoc type assertions. These sit on the hot path for frontmatter parsing and token-usage-log parsing — two frequently-touched, easy-to-regress areas, per the 2026-10-08 Typist (Go Type Consistency Analysis) report.

Expected Impact

Fewer silent type-assertion failures (value.(map[string]any) returning ok=false is easy to miss downstream), and better compile-time safety on two parsing paths that are touched often.

Suggested Fix

Introduce small generic helpers in pkg/typeutil (e.g. LookupTyped[T any](m map[string]any, key string) (T, bool)) to replace the repeated per-type Lookup* functions, and introduce a concrete struct for usage records in token_usage_parse.go instead of threading any/map[string]any through multiple helper functions.

Code Region: pkg/typeutil/lookup.go:20-90, pkg/cli/token_usage_parse.go:146-190

Suggested Agent

Developer (Go, generics-savvy)

Estimated Effort

Medium (2-4 hours)

Data Source

DeepReport Intelligence Briefing, 2026-10-08 (cycle 3). Source discussion #66860 (Typist). Live-verified today: both files still use the any/map[string]any patterns described.

Generated by 🔬 Deep Report · claude · agent · 343.4 AIC · ⌖ 9.25 AIC · ⊞ 7.1K · ◷

  • expires on Oct 10, 2026, 10:48 AM UTC-08:00

Activity

  1. github-actions commented on Oct 10, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-10-10T18:48:00.948Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions