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
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 · ◷
Description
pkg/cli/audit_report_experiments.godeclares two types —experimentStateJSONandexperimentRunRecord— that are field- and tag-identical to the exportedExperimentStateandExperimentRunRecordin 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
experimentStateJSON(line 35 ofaudit_report_experiments.go) and replace all usages withExperimentStateexperimentRunRecord(line 42 ofaudit_report_experiments.go) and replace all usages withExperimentRunRecordpkg/cli), so no import changes are neededFiles 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
experimentStateJSONandexperimentRunRecordare deletedaudit_report_experiments.goreference the exported typesmake fmt && make golint-custom && go test ./pkg/cli/...passesEffort
~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