Description
typist analysis (discussion #49984) flagged a recurring "Minutes-suffix-as-unit" anti-pattern: several constants encode their time unit only in the name/comment, not the type, risking unit-mismatch bugs.
Suggested Changes
workflowCompletionWaitTimeoutMinutes = 6 * 60 in pkg/cli/run_workflow_execution.go:26 — passed as a bare int into a timeoutMinutes int parameter of WaitForWorkflowCompletion (used at run_workflow_execution.go:470), while a neighboring constant in the same file already correctly uses time.Duration.
- Five
*TimeoutMinutes constants in pkg/cli/mcp_tools_privileged.go:21,28,34,40,44
defaultSafeOutputsTimeoutMinutes = 45 in pkg/workflow/compiler_safe_outputs_job.go:539
Convert each to a time.Duration constant (e.g. 6 * time.Hour, 1 * time.Minute) and update the corresponding parameter/field types and call sites.
Files Affected
pkg/cli/run_workflow_execution.go
pkg/cli/mcp_tools_privileged.go
pkg/workflow/compiler_safe_outputs_job.go
Success Criteria
- All
*TimeoutMinutes constants replaced with time.Duration typed constants
- No remaining bare-int minute values used as durations at these call sites
- Existing tests pass
Source
Extracted from Typist - Go Type Consistency Analysis discussion #49984
Priority
Medium - closes off a unit-mismatch bug class. Estimated effort: 1-2 hours.
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 88.4 AIC · ⌖ 4.01 AIC · ⊞ 10.3K · ◷
Description
typistanalysis (discussion #49984) flagged a recurring "Minutes-suffix-as-unit" anti-pattern: several constants encode their time unit only in the name/comment, not the type, risking unit-mismatch bugs.Suggested Changes
workflowCompletionWaitTimeoutMinutes = 6 * 60inpkg/cli/run_workflow_execution.go:26— passed as a bareintinto atimeoutMinutes intparameter ofWaitForWorkflowCompletion(used atrun_workflow_execution.go:470), while a neighboring constant in the same file already correctly usestime.Duration.*TimeoutMinutesconstants inpkg/cli/mcp_tools_privileged.go:21,28,34,40,44defaultSafeOutputsTimeoutMinutes = 45inpkg/workflow/compiler_safe_outputs_job.go:539Convert each to a
time.Durationconstant (e.g.6 * time.Hour,1 * time.Minute) and update the corresponding parameter/field types and call sites.Files Affected
pkg/cli/run_workflow_execution.gopkg/cli/mcp_tools_privileged.gopkg/workflow/compiler_safe_outputs_job.goSuccess Criteria
*TimeoutMinutesconstants replaced withtime.Durationtyped constantsSource
Extracted from Typist - Go Type Consistency Analysis discussion #49984
Priority
Medium - closes off a unit-mismatch bug class. Estimated effort: 1-2 hours.