You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of the refactoring roadmap (see parent issue and docs/refactoring/roadmap.md). Phase 1.
Shared helpers created before the structural moves, so the new packages are written in the deduplicated idiom instead of inheriting today's copies.
Tasks
internal/fsatomic leaf package: WriteFileAtomic, WriteJSON, ReadJSON (one canonical atomic JSON codec, 0o600 perms). Migrate the three divergent writeJSONFile copies (pipeline.go:4401, benchmark/metrics.go:456, benchmarkcmd/run.go:829) package-by-package. Note: pipeline currently writes workbench metadata atomically on one path and non-atomically on another — unifying is a small deliberate behavior improvement; verify Windows rename semantics with a test.
ShortSHA standardized at 12 chars in an existing leaf package (three drifted copies: pipeline.go:3444 and reviewplan.go:1065 use 12, agents.go:990 uses 7). The agents 7→12 change is user-visible — ship last with golden-test updates.
Cobra Args constructors in exitcode: NoArgs(msg), ExactArgs(n, msg), NonEmptyArg(msg) — replaces 41 identical 6-line closures across 13 files (two sites need a dynamic-message variant).
configPath dedup — delete the five byte-identical private copies (agentscmd, mecmd, configcmd, benchmarkcmd, credentialcmd) in favor of cmdruntime.ConfigPath; fold configcmd's six RunE load-inline blocks into loadConfig.
Hoist newProgressLogger/endProgressSpan (byte-identical in 5 cmd packages); give (*progress.Span).End(err) error a return value so return span.End(err) replaces every wrapper.
ledger.OpenLedger helper for the duplicated layout→migrate→stat→open sequence (sessionscmd, datacmd).
Details: docs/refactoring/tactical-simplifications-report.md (Tier 1 items 3–7) and docs/refactoring/architecture-report.md proposal 4.
Part of the refactoring roadmap (see parent issue and
docs/refactoring/roadmap.md). Phase 1.Shared helpers created before the structural moves, so the new packages are written in the deduplicated idiom instead of inheriting today's copies.
Tasks
internal/fsatomicleaf package:WriteFileAtomic,WriteJSON,ReadJSON(one canonical atomic JSON codec, 0o600 perms). Migrate the three divergentwriteJSONFilecopies (pipeline.go:4401, benchmark/metrics.go:456, benchmarkcmd/run.go:829) package-by-package. Note: pipeline currently writes workbench metadata atomically on one path and non-atomically on another — unifying is a small deliberate behavior improvement; verify Windows rename semantics with a test.ShortSHAstandardized at 12 chars in an existing leaf package (three drifted copies: pipeline.go:3444 and reviewplan.go:1065 use 12, agents.go:990 uses 7). The agents 7→12 change is user-visible — ship last with golden-test updates.Argsconstructors inexitcode:NoArgs(msg),ExactArgs(n, msg),NonEmptyArg(msg)— replaces 41 identical 6-line closures across 13 files (two sites need a dynamic-message variant).configPathdedup — delete the five byte-identical private copies (agentscmd, mecmd, configcmd, benchmarkcmd, credentialcmd) in favor ofcmdruntime.ConfigPath; fold configcmd's six RunE load-inline blocks intoloadConfig.view.RenderJSON(w, v)/view.Render(w, asJSON, v, textFn)/root.AddJSONFlag(cmd, target)— kills 21+ identical encoder bodies, 18 json/text branch sites, 22--jsonflag registrations.newProgressLogger/endProgressSpan(byte-identical in 5 cmd packages); give(*progress.Span).End(err) errora return value soreturn span.End(err)replaces every wrapper.ledger.OpenLedgerhelper for the duplicated layout→migrate→stat→open sequence (sessionscmd, datacmd).Details:
docs/refactoring/tactical-simplifications-report.md(Tier 1 items 3–7) anddocs/refactoring/architecture-report.mdproposal 4.