Skip to content

[Code Quality] Type BeforeState/AfterState audit fields as MutableItemState instead of map[string]any #50679

Description

@github-actions

Description

CreatedItemReport.BeforeState/AfterState fields are typed as map[string]any, but the key set is fully enumerated with fixed value types wherever they are consumed. This forces mutableString/mutableBool/mutableStringSlice helper-assertion functions to exist purely to unwrap the untyped map.

Suggested Changes

  • Define a concrete struct: type MutableItemState struct{ Title, BodyHash, State, Base, HeadSHA string; Labels, Assignees []string; Draft bool }.
  • Replace map[string]any usage on BeforeState/AfterState with MutableItemState.
  • Remove the mutableString/mutableBool/mutableStringSlice helper-assertion functions once no longer needed.

Files Affected

  • pkg/cli/audit_report.go:152-153CreatedItemReport.BeforeState/AfterState
  • pkg/cli/outcome_eval_update.go:153-222 — consumers doing key-based map access and assertions

Success Criteria

  • BeforeState/AfterState are strongly typed as MutableItemState
  • Assertion helper functions removed or simplified
  • All existing tests pass, no behavior change

Source

Extracted from Typist: Go Type Consistency Analysis discussion #50544

Priority

Medium - removes untyped map usage and several assertion helpers; a few hours of mechanical work

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 44.7 AIC · ⌖ 3.06 AIC · ⊞ 10.3K ·

  • expires on Aug 6, 2026, 11:12 AM UTC-08:00

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