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-153 — CreatedItemReport.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 · ◷
Description
CreatedItemReport.BeforeState/AfterStatefields are typed asmap[string]any, but the key set is fully enumerated with fixed value types wherever they are consumed. This forcesmutableString/mutableBool/mutableStringSlicehelper-assertion functions to exist purely to unwrap the untyped map.Suggested Changes
type MutableItemState struct{ Title, BodyHash, State, Base, HeadSHA string; Labels, Assignees []string; Draft bool }.map[string]anyusage onBeforeState/AfterStatewithMutableItemState.mutableString/mutableBool/mutableStringSlicehelper-assertion functions once no longer needed.Files Affected
pkg/cli/audit_report.go:152-153—CreatedItemReport.BeforeState/AfterStatepkg/cli/outcome_eval_update.go:153-222— consumers doing key-based map access and assertionsSuccess Criteria
BeforeState/AfterStateare strongly typed asMutableItemStateSource
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