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
Analysis of 668 non-test Go files across 19 packages in pkg/. The codebase is in generally good shape: only 8 type name collisions were found, most expected (WASM variants), and the project already applies a strong semantic-typing pattern for critical constants. The main opportunities are a naming conflict, two consolidation candidates, and extension of the existing typed-constant pattern to cover artifact names, output names, and filenames.
Go allows a struct and interface to share the same name across packages, but having two types named FileTracker — one an interface, one a struct — in sibling packages creates reader confusion and could break if one package ever imports the other.
Recommendation: Rename the interface to FileTrackerInterface (or simply FileTracking) following Go idiom (interfaces named by behavior). Alternatively, rename the struct to DefaultFileTracker.
Estimated effort: 30 min (rename + update callers with find_referencing_symbols).
Priority 2 — Same Name, Different Purpose: RepoConfig
Both extend the same base type (types.BaseMCPServerConfig) but add phase-specific fields. They are not true duplicates, but the shared name creates confusion about which "MCPServerConfig" a given function expects.
Location
Phase
Extra fields
pkg/parser/mcp.go:35
Parse-time
Name, Registry, ProxyArgs, Allowed
pkg/workflow/tools_types.go:366
Runtime
Mode, Toolsets, GuardPolicies, CustomFields
Recommendation: Rename to distinguish phases:
pkg/parser/mcp.go: ParsedMCPServerConfig or MCPServerSpec
pkg/workflow/tools_types.go: keep as MCPServerConfig (it is the runtime canonical form) or rename to RuntimeMCPServerConfig
Estimated effort: 1–2 hours.
Untyped any Usage
The codebase correctly uses any (Go 1.18+ alias for interface{}) and no raw interface{} was found. Of 1,862 usages across 118 files, the vast majority are justified:
YAML/JSON parsing from frontmatter and workflow files requires map[string]any / []any because schema types are determined at runtime.
MCP config GuardPolicies map[string]any and CustomFields map[string]any are intentionally open extension points.
The top contributors are in workflow compilation and tool parsing code that directly handles YAML unmarshalling. No immediate action is recommended for these — they represent legitimate use of dynamic typing at serialization boundaries.
The one case to review is compiler_safe_outputs_config.go (53 usages), which uses type handlerBuilder func(*SafeOutputsConfig) map[string]any. If the return values have known structure, a typed struct could replace map[string]any here.
Untyped Constants
The codebase already has a strong foundation with semantic type aliases in pkg/constants/:
However, several groups of related constants lack types. The pattern is established — these are straightforward extensions.
Group 1 — Artifact Names (high value)
File: pkg/constants/job_constants.go:70–132
// Current (untyped)constSafeOutputArtifactName="safe-output"constAgentOutputArtifactName="agent-output"constAgentArtifactName="agent"constDetectionArtifactName="detection"constActivationArtifactName="activation"constSarifArtifactName="code-scanning-sarif"constSafeOutputItemsArtifactName="safe-outputs-items"// SuggestedtypeArtifactNamestringconstSafeOutputArtifactNameArtifactName="safe-output"constAgentOutputArtifactNameArtifactName="agent-output"// ...
Benefit: Functions that upload or download artifacts can accept ArtifactName instead of string, preventing accidental use of a filename or step ID where an artifact name is expected.
Group 2 — Step Output Names (medium value)
File: pkg/constants/job_constants.go:178–191
// Current (untyped)constIsTeamMemberOutput="is_team_member"constStopTimeOkOutput="stop_time_ok"constCommandPositionOkOutput="command_position_ok"constMatchedCommandOutput="matched_command"constRateLimitOkOutput="rate_limit_ok"constActivatedOutput="activated"// SuggestedtypeOutputNamestringconstIsTeamMemberOutputOutputName="is_team_member"// ...
The StepID type already exists — a companion OutputName type would complete the job/step output contract.
Group 3 — System Filenames (low–medium value)
File: pkg/constants/job_constants.go:85–141
// Current (untyped)constAgentOutputFilename="agent_output.json"constSafeOutputsFilename="safeoutputs.jsonl"constTokenUsageFilename="agent_usage.json"constGithubRateLimitsFilename="github_rate_limits.jsonl"constOtelJsonlFilename="otel.jsonl"constSarifFileName="code-scanning-alert.sarif"// SuggestedtypeArtifactFilenamestringconstAgentOutputFilenameArtifactFilename="agent_output.json"// ...
Group 4 — Numeric Rate Limit Defaults (low value)
File: pkg/constants/job_constants.go:191–192
// Current (untyped)constDefaultRateLimitMax=5// Default maximum runs per time windowconstDefaultRateLimitWindow=60// Default time window in minutes (1 hour)
The comment indicates the unit is minutes, but nothing enforces it. A Minutes or RateLimitWindow type would encode the unit in the type system. Low priority given there are only two constants.
Implementation Checklist
Rename FileTracker interface to avoid struct/interface name collision (pkg/workflow/compiler_types.go:46)
Rename RepoConfig in pkg/cli/trial_types.go to TrialRepoConfig
Rename EngineConfig in pkg/cli/audit_expanded.go to AuditEngineInfo
Rename MCPServerConfig in pkg/parser/mcp.go to MCPServerSpec (or similar)
Add ArtifactName type and apply to artifact name constants in pkg/constants/job_constants.go
Add OutputName type and apply to step output name constants in pkg/constants/job_constants.go
Add ArtifactFilename type and apply to filename constants in pkg/constants/job_constants.go
Review compiler_safe_outputs_config.go handler builders for potential typed return values
Analysis Metadata
Total Go files analyzed: 668 (non-test, pkg/ only)
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.
-
Analysis of 668 non-test Go files across 19 packages in
pkg/. The codebase is in generally good shape: only 8 type name collisions were found, most expected (WASM variants), and the project already applies a strong semantic-typing pattern for critical constants. The main opportunities are a naming conflict, two consolidation candidates, and extension of the existing typed-constant pattern to cover artifact names, output names, and filenames.Summary
anyusages (wasinterface{})JobName,StepID,MCPServerID,LineLength,CommandPrefix,WorkflowID)Full Analysis Report
Duplicated Type Definitions
Expected Duplicates (WASM build variants — no action needed)
These exist in both a native and a
_wasm.gofile. The Go build tag system handles this correctly.SpinnerWrapperpkg/console/spinner.go,pkg/console/spinner_wasm.goProgressBarpkg/console/progress.go,pkg/console/progress_wasm.goRepositoryFeaturespkg/workflow/repository_features_validation.go,pkg/workflow/repository_features_validation_wasm.goCorrect Pattern (type alias to avoid circular imports — no action needed)
LogMetricsinpkg/cli/logs_models.gois a type alias pointing to the canonical definition inpkg/workflow/metrics.go. This is intentional.Priority 1 — Naming Conflict:
FileTrackerImpact: High confusion risk — same name, different kinds, different packages.
pkg/workflow/compiler_types.go:46pkg/cli/file_tracker.go:19Go allows a struct and interface to share the same name across packages, but having two types named
FileTracker— one an interface, one a struct — in sibling packages creates reader confusion and could break if one package ever imports the other.Recommendation: Rename the interface to
FileTrackerInterface(or simplyFileTracking) following Go idiom (interfaces named by behavior). Alternatively, rename the struct toDefaultFileTracker.Estimated effort: 30 min (rename + update callers with
find_referencing_symbols).Priority 2 — Same Name, Different Purpose:
RepoConfigpkg/cli/trial_types.go:24pkg/workflow/repo_config.go:69These serve completely different purposes and should not share a name. A developer importing both packages would need to qualify every usage.
Recommendation: Rename to clarify purpose:
pkg/cli/trial_types.go: rename toTrialRepoConfigpkg/workflow/repo_config.go: rename toWorkflowRepoConfig(orMaintenanceConfigifMaintenanceConfigis not already taken)Estimated effort: 1 hour.
Priority 3 — Same Name, Different Purpose:
EngineConfigpkg/cli/audit_expanded.go:19pkg/workflow/engine.go:16Recommendation: Rename to reflect their distinct roles:
pkg/cli/audit_expanded.go: rename toAuditEngineInfoorEngineRunInfopkg/workflow/engine.go: keep asEngineConfig(it is the authoritative runtime config)Estimated effort: 1–2 hours.
Priority 4 — Consolidation Candidate:
MCPServerConfigBoth extend the same base type (
types.BaseMCPServerConfig) but add phase-specific fields. They are not true duplicates, but the shared name creates confusion about which "MCPServerConfig" a given function expects.pkg/parser/mcp.go:35Name,Registry,ProxyArgs,Allowedpkg/workflow/tools_types.go:366Mode,Toolsets,GuardPolicies,CustomFieldsRecommendation: Rename to distinguish phases:
pkg/parser/mcp.go:ParsedMCPServerConfigorMCPServerSpecpkg/workflow/tools_types.go: keep asMCPServerConfig(it is the runtime canonical form) or rename toRuntimeMCPServerConfigEstimated effort: 1–2 hours.
Untyped
anyUsageThe codebase correctly uses
any(Go 1.18+ alias forinterface{}) and no rawinterface{}was found. Of 1,862 usages across 118 files, the vast majority are justified:map[string]any/[]anybecause schema types are determined at runtime.Printf(format string, args ...any)) follow stdlib convention.navigateToSchemaPath(schema map[string]any, ...)) deal with heterogeneous JSON Schema documents.GuardPolicies map[string]anyandCustomFields map[string]anyare intentionally open extension points.The top contributors are in workflow compilation and tool parsing code that directly handles YAML unmarshalling. No immediate action is recommended for these — they represent legitimate use of dynamic typing at serialization boundaries.
The one case to review is
compiler_safe_outputs_config.go(53 usages), which usestype handlerBuilder func(*SafeOutputsConfig) map[string]any. If the return values have known structure, a typed struct could replacemap[string]anyhere.Untyped Constants
The codebase already has a strong foundation with semantic type aliases in
pkg/constants/:However, several groups of related constants lack types. The pattern is established — these are straightforward extensions.
Group 1 — Artifact Names (high value)
File:
pkg/constants/job_constants.go:70–132Benefit: Functions that upload or download artifacts can accept
ArtifactNameinstead ofstring, preventing accidental use of a filename or step ID where an artifact name is expected.Group 2 — Step Output Names (medium value)
File:
pkg/constants/job_constants.go:178–191The
StepIDtype already exists — a companionOutputNametype would complete the job/step output contract.Group 3 — System Filenames (low–medium value)
File:
pkg/constants/job_constants.go:85–141Group 4 — Numeric Rate Limit Defaults (low value)
File:
pkg/constants/job_constants.go:191–192The comment indicates the unit is minutes, but nothing enforces it. A
MinutesorRateLimitWindowtype would encode the unit in the type system. Low priority given there are only two constants.Implementation Checklist
FileTrackerinterface to avoid struct/interface name collision (pkg/workflow/compiler_types.go:46)RepoConfiginpkg/cli/trial_types.gotoTrialRepoConfigEngineConfiginpkg/cli/audit_expanded.gotoAuditEngineInfoMCPServerConfiginpkg/parser/mcp.gotoMCPServerSpec(or similar)ArtifactNametype and apply to artifact name constants inpkg/constants/job_constants.goOutputNametype and apply to step output name constants inpkg/constants/job_constants.goArtifactFilenametype and apply to filename constants inpkg/constants/job_constants.gocompiler_safe_outputs_config.gohandler builders for potential typed return valuesAnalysis Metadata
pkg/only)anyusage locations: 1,862 across 118 filesReferences:
Beta Was this translation helpful? Give feedback.
All reactions