Description
pkg/cli/audit_comparison.go defines 5 near-identical delta/comparison structs — live-verified at lines 47/55/61/67/73: AuditComparisonDelta, AuditComparisonRouteDelta, AuditComparisonIntDelta, AuditComparisonStringDelta, AuditComparisonMCPFailureDelta. The 2026-10-08 Typist (Go Type Consistency Analysis) report flagged this family as its single highest-leverage type-consolidation opportunity, recommending they collapse into one generic Delta[T].
Expected Impact
Removes duplicated comparison-struct boilerplate and makes it easier to add new delta-tracked fields to audit comparisons without hand-writing another near-identical struct.
Suggested Fix
Introduce a generic AuditComparisonDelta[T any] struct { Before, After T; ... } (matching whatever shared fields the current 5 structs have — e.g. Before/After/Change), and replace the 5 call sites (e.g. pkg/cli/audit_comparison.go:391,396,401 and others) with instantiations of the generic type. Keep comparison output JSON-identical; run pkg/cli tests including audit_comparison_test.go.
Code Region: pkg/cli/audit_comparison.go:47-79 (struct defs) and usages throughout the same file.
Suggested Agent
Developer / Go generics-savvy agent.
Estimated Effort
Medium.
Data Source
DeepReport Intelligence Briefing analysis, 2026-10-08. Source: discussion "[typist] Typist - Go Type Consistency Analysis" (#66860). Live-verified: all 5 struct definitions exist today at the stated lines in pkg/cli/audit_comparison.go.
Generated by 🔬 Deep Report · claude · agent · 342.4 AIC · ⌖ 10.9 AIC · ⊞ 7.1K · ◷
Description
pkg/cli/audit_comparison.godefines 5 near-identical delta/comparison structs — live-verified at lines 47/55/61/67/73:AuditComparisonDelta,AuditComparisonRouteDelta,AuditComparisonIntDelta,AuditComparisonStringDelta,AuditComparisonMCPFailureDelta. The 2026-10-08 Typist (Go Type Consistency Analysis) report flagged this family as its single highest-leverage type-consolidation opportunity, recommending they collapse into one genericDelta[T].Expected Impact
Removes duplicated comparison-struct boilerplate and makes it easier to add new delta-tracked fields to audit comparisons without hand-writing another near-identical struct.
Suggested Fix
Introduce a generic
AuditComparisonDelta[T any] struct { Before, After T; ... }(matching whatever shared fields the current 5 structs have — e.g. Before/After/Change), and replace the 5 call sites (e.g.pkg/cli/audit_comparison.go:391,396,401and others) with instantiations of the generic type. Keep comparison output JSON-identical; runpkg/clitests includingaudit_comparison_test.go.Code Region:
pkg/cli/audit_comparison.go:47-79(struct defs) and usages throughout the same file.Suggested Agent
Developer / Go generics-savvy agent.
Estimated Effort
Medium.
Data Source
DeepReport Intelligence Briefing analysis, 2026-10-08. Source: discussion "[typist] Typist - Go Type Consistency Analysis" (#66860). Live-verified: all 5 struct definitions exist today at the stated lines in
pkg/cli/audit_comparison.go.