Skip to content

[Code Quality] Remove duplicate experiment types in audit_report_experiments.go #46000

Description

@github-actions

Description

pkg/cli/audit_report_experiments.go declares two types — experimentStateJSON and experimentRunRecord — that are field- and tag-identical to the exported ExperimentState and ExperimentRunRecord in the same package (pkg/cli/experiments_command.go). The private copies silently drift from the exported ones, creating a risk of schema mismatch between the writer and the auditor.

Suggested Changes

  • Delete experimentStateJSON (line 35 of audit_report_experiments.go) and replace all usages with ExperimentState
  • Delete experimentRunRecord (line 42 of audit_report_experiments.go) and replace all usages with ExperimentRunRecord
  • Both types are in the same package (pkg/cli), so no import changes are needed

Files Affected

  • pkg/cli/audit_report_experiments.go (lines 35-55, remove duplicate type declarations and update usages)
  • pkg/cli/experiments_command.go (source of truth — no changes needed)

Success Criteria

  • experimentStateJSON and experimentRunRecord are deleted
  • All usages in audit_report_experiments.go reference the exported types
  • make fmt && make golint-custom && go test ./pkg/cli/... passes
  • No behavior change (same JSON tags preserved via reuse)

Effort

~30 min · XS

Source

Extracted from Typist — Go Type Consistency Analysis discussion #45983

Priority

High — exact duplicates in the same package with risk of silent drift

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 156.6 AIC · ⌖ 7.84 AIC · ⊞ 7K ·

  • expires on Jul 17, 2026, 5:23 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