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
This report covers a semantic analysis of 665 non-test Go source files in pkg/. The analysis identified several naming collisions, near-duplicate struct definitions, and intentional but noteworthy any/map[string]any usage patterns.
Key Metrics
Total non-test Go files analyzed: 665
Total type definitions found: ~677 (494 structs, 17 interfaces, 8 type aliases, remainder function/string types)
Duplicate name clusters: 6 (across different packages)
TrialArtifacts is essentially WorkflowTrialResult minus WorkflowName, RunID, and Timestamp. The three core map[string]any fields are identical in name, type, and JSON tags.
Recommendation:
Embed TrialArtifacts inside WorkflowTrialResult to eliminate the field duplication:
These serve different serialization formats (YAML vs JSON) and different pipeline stages. The shared BaseMCPServerConfig embedding is correct architecture.
Recommendation: No structural change needed. Consider adding package-level doc comments clarifying the distinction. Risk is low since Go's package qualification prevents ambiguity at usage sites.
Cluster 3: LogParser — Function Type vs Interface (Naming Collision)
Type: Naming collision — same name, fundamentally different kinds Impact: Medium — can cause confusion in code reviews and IDE navigation
Locations:
pkg/cli/log_aggregation.go:29 — Generic function type
pkg/workflow/agentic_engine.go:166 — Interface type
Recommendation: Rename the CLI function type to LogParserFunc[T LogAnalysis] to follow the Go convention of suffixing function types with Func and to eliminate the cross-package naming collision.
Recommendation: Rename the workflow interface to FileTrackerWriter or FileCreationTracker to clarify its role and avoid the struct/interface naming confusion.
Estimated effort: 20 minutes
Benefits: Clear distinction between the concrete CLI implementation and the compiler-contract interface
Clusters 5-6: RepoConfig and EngineConfig — Unrelated Types Sharing a Name
Type: Coincidental naming — completely different fields and purposes Impact: Low — no real risk since they live in separate packages
These use //go:build js || wasm build constraints. No action needed.
Untyped Usages
Summary Statistics
Category
Locations
Struct fields using any
~8
Struct fields using map[string]any
~17
Function parameters using map[string]any (codemod pattern)
28+
Untyped numeric constants
4
Category 1: map[string]any as Codemod Frontmatter
Impact: Low — intentional design; YAML is inherently dynamic
The Codemod.Apply function signature (pkg/cli/fix_codemods.go:13) and PostTransformFunc (pkg/cli/codemod_factory.go:13) both use map[string]any for YAML frontmatter. This pattern propagates to 150+ call sites.
Since YAML frontmatter structure is inherently open-ended (keys are user-defined), this pattern is appropriate. However, WorkflowMCPMetadata.Frontmatter map[string]any in pkg/cli/mcp_workflow_scanner.go:21 could potentially be refined if the keys accessed from it are well-known.
Recommendation: No change for the codemod pattern — it represents valid use of map[string]any for dynamic YAML. Consider whether WorkflowMCPMetadata.Frontmatter could expose a typed accessor for its known fields.
Impact: Medium — runtime type assertions required for these fields
Location
Field
Current Type
Suggested Type
Reasoning
pkg/cli/logs_models.go:300
RunID
any
int64 or string
GitHub run IDs are numeric
pkg/cli/logs_models.go:301
RunNumber
any
int64
GitHub run numbers are always integers
pkg/workflow/mcp_scripts_parser.go:36
Default
any
json.RawMessage or string
JSON Schema default values can be typed via RawMessage
pkg/cli/gateway_logs.go:194
ID
any
any (keep)
JSON-RPC 2.0 spec: ID is string, number, or null
pkg/cli/gateway_logs.go:205
ID
any
any (keep)
Same JSON-RPC spec reason
pkg/cli/list_workflows_command.go:25
On
any
any (keep)
GitHub Actions on: is string, array, or object
pkg/cli/copilot_setup.go:147
RunsOn
any
any (keep)
GitHub Actions runs-on: can be string or array
The RunID any and RunNumber any fields in logs_models.go:300-301 stand out — the comment says "Additional fields that might be present" suggesting backward-compatibility concern. Other RunID fields in the same file (lines 112, 120, 131, 140) are correctly typed as int64.
Benefits: Consistent with the other 5+ RunID int64 fields in the same file
Category 3: map[string]any in Trial Artifact Structs
Impact: Low — these fields represent arbitrary JSON blobs from workflow outputs
Location
Fields
pkg/cli/trial_types.go:9-12
SafeOutputs, AgenticRunInfo, AdditionalArtifacts
pkg/cli/trial_support.go:20-23
Same 3 fields (see Cluster 1 above)
Since safe outputs are user-defined JSON payloads of arbitrary shape, map[string]any is appropriate here. The issue is duplication (covered in Cluster 1 above), not the type choice.
Category 4: Untyped Numeric Constants
Impact: Low-Medium — unclear units/semantics
Location
Constant
Value
Suggested Type
pkg/constants/job_constants.go:185
DefaultRateLimitMax
5
int (or named type RateLimitCount)
pkg/constants/job_constants.go:186
DefaultRateLimitWindow
60
Could be time.Duration or int with comment clarifying units (minutes)
pkg/constants/constants.go:280
MaxSymlinkDepth
5
int
pkg/constants/constants.go:142
DefaultMCPGatewayPayloadSizeThreshold
524288
int64 (bytes)
DefaultRateLimitWindow = 60 is particularly worth typing — the comment says "minutes" but the constant is a bare int. Adding a type (or at minimum using 60 * time.Minute if compatible) would prevent accidental unit confusion.
Recommendation:
// BeforeconstDefaultRateLimitMax=5// Default maximum runs per time windowconstDefaultRateLimitWindow=60// Default time window in minutes (1 hour)// After (minimal change — add int types)constDefaultRateLimitMaxint=5constDefaultRateLimitWindowint=60// minutes
Estimated effort: 10 minutes
Benefits: Explicit types prevent accidental misuse in typed contexts
Refactoring Recommendations by Priority
Priority 1: WorkflowTrialResult / TrialArtifacts Field Deduplication
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
This report covers a semantic analysis of 665 non-test Go source files in
pkg/. The analysis identified several naming collisions, near-duplicate struct definitions, and intentional but noteworthyany/map[string]anyusage patterns.Key Metrics
anyormap[string]any: ~25 distinct locationsFull Analysis Report
Duplicated Type Definitions
Summary Statistics
Cluster 1:
WorkflowTrialResult/TrialArtifacts— Near-Duplicate StructsType: Near-duplicate (overlapping fields)
Impact: Medium — two structs in the same package carrying the same core fields
Locations:
pkg/cli/trial_types.go:6—WorkflowTrialResultpkg/cli/trial_support.go:19—TrialArtifactsDefinition Comparison:
TrialArtifactsis essentiallyWorkflowTrialResultminusWorkflowName,RunID, andTimestamp. The three coremap[string]anyfields are identical in name, type, and JSON tags.Recommendation:
TrialArtifactsinsideWorkflowTrialResultto eliminate the field duplication:Cluster 2:
MCPServerConfig— Same Base, Different ExtensionsType: Semantic near-duplicate (shared embedded base)
Impact: Low-Medium — same name in two packages, both embedding
types.BaseMCPServerConfigLocations:
pkg/workflow/tools_types.go:366— Runtime workflow tool configurationpkg/parser/mcp.go:35— Parsed/inspected MCP configurationThese serve different serialization formats (YAML vs JSON) and different pipeline stages. The shared
BaseMCPServerConfigembedding is correct architecture.Recommendation: No structural change needed. Consider adding package-level doc comments clarifying the distinction. Risk is low since Go's package qualification prevents ambiguity at usage sites.
Cluster 3:
LogParser— Function Type vs Interface (Naming Collision)Type: Naming collision — same name, fundamentally different kinds
Impact: Medium — can cause confusion in code reviews and IDE navigation
Locations:
pkg/cli/log_aggregation.go:29— Generic function typepkg/workflow/agentic_engine.go:166— Interface typeRecommendation: Rename the CLI function type to
LogParserFunc[T LogAnalysis]to follow the Go convention of suffixing function types withFuncand to eliminate the cross-package naming collision.pkg/cli)http.HandlerFunc, etc.)Cluster 4:
FileTracker— Struct vs Interface (Naming Collision)Type: Naming collision — same name, struct in one package, interface in another
Impact: Medium — could mislead readers about which they're importing
Locations:
pkg/cli/file_tracker.go:19— Concrete structpkg/workflow/compiler_types.go:65— InterfaceRecommendation: Rename the workflow interface to
FileTrackerWriterorFileCreationTrackerto clarify its role and avoid the struct/interface naming confusion.Clusters 5-6:
RepoConfigandEngineConfig— Unrelated Types Sharing a NameType: Coincidental naming — completely different fields and purposes
Impact: Low — no real risk since they live in separate packages
RepoConfigpkg/cli/trial_types.go:24RepoConfigpkg/workflow/repo_config.go:68EngineConfigpkg/cli/audit_expanded.go:19EngineConfigpkg/workflow/engine.go:16Recommendation: No structural change needed. Document-level comments are sufficient. Go's package system handles the disambiguation.
Clusters 7-9: Platform-Specific Build Tag Pairs (Expected)
Three type names appear twice with platform-specific implementations — these are intentional and correct:
SpinnerWrapperpkg/console/spinner.go(native) /pkg/console/spinner_wasm.go(WASM stub)ProgressBarpkg/console/progress.go(native) /pkg/console/progress_wasm.go(WASM stub)RepositoryFeaturespkg/workflow/repository_features_validation.go/_wasm.goThese use
//go:build js || wasmbuild constraints. No action needed.Untyped Usages
Summary Statistics
anymap[string]anymap[string]any(codemod pattern)Category 1:
map[string]anyas Codemod FrontmatterImpact: Low — intentional design; YAML is inherently dynamic
The
Codemod.Applyfunction signature (pkg/cli/fix_codemods.go:13) andPostTransformFunc(pkg/cli/codemod_factory.go:13) both usemap[string]anyfor YAML frontmatter. This pattern propagates to 150+ call sites.Since YAML frontmatter structure is inherently open-ended (keys are user-defined), this pattern is appropriate. However,
WorkflowMCPMetadata.Frontmatter map[string]anyinpkg/cli/mcp_workflow_scanner.go:21could potentially be refined if the keys accessed from it are well-known.Recommendation: No change for the codemod pattern — it represents valid use of
map[string]anyfor dynamic YAML. Consider whetherWorkflowMCPMetadata.Frontmattercould expose a typed accessor for its known fields.Category 2:
any-typed Struct Fields (Strong Typing Opportunities)Impact: Medium — runtime type assertions required for these fields
pkg/cli/logs_models.go:300RunIDanyint64orstringpkg/cli/logs_models.go:301RunNumberanyint64pkg/workflow/mcp_scripts_parser.go:36Defaultanyjson.RawMessageorstringpkg/cli/gateway_logs.go:194IDanyany(keep)pkg/cli/gateway_logs.go:205IDanyany(keep)pkg/cli/list_workflows_command.go:25Onanyany(keep)on:is string, array, or objectpkg/cli/copilot_setup.go:147RunsOnanyany(keep)runs-on:can be string or arrayThe
RunID anyandRunNumber anyfields inlogs_models.go:300-301stand out — the comment says "Additional fields that might be present" suggesting backward-compatibility concern. OtherRunIDfields in the same file (lines 112, 120, 131, 140) are correctly typed asint64.Recommendation:
RunID int64fields in the same fileCategory 3:
map[string]anyin Trial Artifact StructsImpact: Low — these fields represent arbitrary JSON blobs from workflow outputs
pkg/cli/trial_types.go:9-12SafeOutputs,AgenticRunInfo,AdditionalArtifactspkg/cli/trial_support.go:20-23Since safe outputs are user-defined JSON payloads of arbitrary shape,
map[string]anyis appropriate here. The issue is duplication (covered in Cluster 1 above), not the type choice.Category 4: Untyped Numeric Constants
Impact: Low-Medium — unclear units/semantics
pkg/constants/job_constants.go:185DefaultRateLimitMax5int(or named typeRateLimitCount)pkg/constants/job_constants.go:186DefaultRateLimitWindow60time.Durationorintwith comment clarifying units (minutes)pkg/constants/constants.go:280MaxSymlinkDepth5intpkg/constants/constants.go:142DefaultMCPGatewayPayloadSizeThreshold524288int64(bytes)DefaultRateLimitWindow = 60is particularly worth typing — the comment says "minutes" but the constant is a bareint. Adding a type (or at minimum using60 * time.Minuteif compatible) would prevent accidental unit confusion.Recommendation:
Refactoring Recommendations by Priority
Priority 1:
WorkflowTrialResult/TrialArtifactsField Deduplicationpkg/cli/trial_types.go,pkg/cli/trial_support.goTrialArtifactsinWorkflowTrialResultPriority 2:
LogParserRename (CLI function type →LogParserFunc)pkg/cli/log_aggregation.go+ callerstype LogParserFunc[T LogAnalysis] func(...)to follow Go conventionsPriority 3:
FileTrackerInterface Renamepkg/workflow/compiler_types.go+ callersFileCreationTrackerorFileTrackerWriterPriority 4:
RunID any/RunNumber any→int64pkg/cli/logs_models.go:300-301int64(consistent with other fields)Priority 5: Type numeric constants
pkg/constants/job_constants.go,pkg/constants/constants.gointorint64types to bare numeric constantsImplementation Checklist
TrialArtifactsinWorkflowTrialResult(Priority 1)LogParserfunction type toLogParserFuncinpkg/cli(Priority 2)FileTrackerinterface inpkg/workflow/compiler_types.go(Priority 3)RunID any/RunNumber anytoint64inlogs_models.go(Priority 4)DefaultRateLimitMax,DefaultRateLimitWindow,MaxSymlinkDepth,DefaultMCPGatewayPayloadSizeThreshold(Priority 5)RepoConfigandEngineConfiginclivsworkflowAnalysis Metadata
pkg/any-typed struct fieldsmap[string]anystruct fieldsReferences:
Beta Was this translation helpful? Give feedback.
All reactions