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 repository: github/gh-aw Β· 2026-07-03
Hi team! π I swept every non-test .go file under pkg/ (942 files, 953 type definitions) hunting for two things: types we've accidentally defined twice, and places where we lean on any where a real type would keep us safer.
The good news first: there is essentially no accidental type duplication in this codebase. Every "duplicate name" I found turned out to be intentional β a type X = pkg.X re-export alias or a //go:build wasm platform variant. That's genuinely disciplined package design. π
The real opportunity is weak typing. The codebase has fully migrated off interface{} (great!) but now threads a raw map[string]any frontmatter/config blob through 365 of 942 files, tearing it apart with 1,111 .(map[string]any) + 814 .(string) + 316 .([]any) assertions (1,708 total). A typed model (FrontmatterConfig) already exists but sits half-adopted. Finishing that migration plus adding a few named enum types (following the existing EngineName precedent) would remove the bulk of our runtime type-assertion risk. Nothing urgent β just high leverage.
Full Analysis Report
Duplicated Type Definitions β clean bill of health
All 13 clusters are intentional and need no action:
9 alias re-exports (type X = pkg.X, single source of truth): ActionYAMLInput, ActionPin, ActionPinsData, ContainerPin, SHAResolver (all pkg/actionpins/actionpins.go β pkg/workflow/action_pins.go); InputDefinition (pkg/types/input_definition.go:15 β pkg/workflow/inputs.go:18); SanitizeOptions (pkg/stringutil/sanitize.go:60 β pkg/workflow/strings.go:94); LogMetrics, ToolCallInfo (pkg/workflow/metrics.go β pkg/cli/logs_models.go).
3 //go:build platform variants (same package, !js && !wasm vs js || wasm β Go requires both): ProgressBar (pkg/console/progress.go:31), SpinnerWrapper (pkg/console/spinner.go:92), RepositoryFeatures (pkg/workflow/repository_features_validation.go:67; the only byte-identical redefinition, mandated by build constraints).
1 benign name collision: LogParser is an interface in pkg/workflow/agentic_engine.go:189 and a generic func type in pkg/cli/log_aggregation.go:37 β unrelated, different packages.
Untyped / Weakly-Typed Usages
interface{} literals: 0 (already migrated to any π)
any usages: 3,625 total β map[string]any2,171 (365 files), []any 415, []map[string]any 59, bare any params ~213
Type assertions on any: 1,708 across 333 files
Category 1: the map[string]any config blob β π΄ highest impact
map[string]any is used as a YAML/frontmatter config blob dismantled by hand. Assertion histogram: .(map[string]any) 1,111 Β· .(string) 814 Β· .([]any) 316 Β· .(bool) 146. A typed model already exists β FrontmatterConfig at pkg/workflow/frontmatter_types.go:301 (114-line struct, verified via Serena) β but the raw map is still threaded through hundreds of call sites in parallel.
Named-type opportunities
1. type FrontmatterMap map[string]any with accessor methods β biggest single win. The frontmatter/rawFrontmatter param appears 270Γ across 124 files. Seed points: pkg/parser/frontmatter_content.go:20 (FrontmatterResult.Frontmatter, verified), pkg/workflow/workflow_data.go:150 (RawFrontmatter), pkg/cli/mcp_workflow_scanner.go:21. Add GetString/GetMap/GetSlice/GetBool methods so 124 files stop asserting by hand.
2. Finish the parse*Config(outputMap map[string]any) migration β 48 functions share this signature (e.g. pkg/workflow/publish_artifacts.go:53parseUploadArtifactConfig, pkg/workflow/dispatch_repository.go:30, update_project.go:36, assign_to_user.go:19, hide_comment.go:19, ...), each re-implementing pullβassertβdefault.
3. tools map[string]any blob β 64Γ, e.g. pkg/workflow/claude_tools.go:20expandNeutralToolsToClaudeTools(tools map[string]any) map[string]any.
Leave alone (idiomatic any): true JSON/YAML decode boundaries, template payloads, and genuine polymorphic Default any fields (pkg/types/input_definition.go:18).
Category 2: missing semantic types on enum-like constants β π‘ medium
The codebase shows the good pattern once (pkg/constants/engine_constants.go:13type EngineName string). These bare-string/int groups are effectively enums that didn't get it:
Enum candidates
MCP server type β pkg/types/mcp.go:13Type string (verified), validated in pkg/parser/mcp.go:22 and compared to literals ~12Γ (mcp_config_custom.go:104,119). β type MCPServerType string.
MCP auth type β pkg/types/mcp.go:33 (only github-oidc). β type MCPAuthType string.
InputDefinition.Type β pkg/types/input_definition.go:19 (5-value enum, switched at build_input_schema.go:44-49). β type InputType string.
Registry β pkg/cli/mcp_registry_types.go:108-115StatusActive/Inactive, ArgumentTypePositional/Named (bare). β type ServerStatus string, type ArgumentType string.
Safe-output kinds β raw literals at pkg/cli/outcome_eval.go:125,391 (noop/missing_tool/missing_data/report_incomplete), also logs_metrics.go:380,510,641. β type SafeOutputKind string.
Ports β pkg/constants/constants.go:105-135 (DefaultMCPGatewayPort=8080, MinNetworkPort=1, MaxNetworkPort=65535, ..., bare int). β type Port int.
Leave alone: arithmetic constants in pkg/workflow/time_delta.go:489-501 and byte-size limits in pkg/workflow/compiler.go:25-38; env-var-name strings in engine_constants.go:213-364.
π― Recommendations (impact-per-effort)
High β FrontmatterMap + accessors. Define the type, retype FrontmatterResult.Frontmatter & WorkflowData.RawFrontmatter, migrate the 5 hottest decoder files. Incremental; removes the bulk of 1,700+ assertions.
Medium β named enum types. Start with MCPServerType, InputType, SafeOutputKind. Compile-time safety against typos.
Low β finish parse*Config standardization onto the accessors. Mechanical; less boilerplate.
Checklist: β FrontmatterMap + methods + tests β retype seed fields β migrate top-5 decoder files β MCPServerType/MCPAuthType/InputType β SafeOutputKind/ArgumentType/ServerStatus β type Port int β run tests per package.
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 repository: github/gh-aw Β· 2026-07-03
Hi team! π I swept every non-test
.gofile underpkg/(942 files, 953 type definitions) hunting for two things: types we've accidentally defined twice, and places where we lean onanywhere a real type would keep us safer.The good news first: there is essentially no accidental type duplication in this codebase. Every "duplicate name" I found turned out to be intentional β a
type X = pkg.Xre-export alias or a//go:build wasmplatform variant. That's genuinely disciplined package design. πThe real opportunity is weak typing. The codebase has fully migrated off
interface{}(great!) but now threads a rawmap[string]anyfrontmatter/config blob through 365 of 942 files, tearing it apart with 1,111.(map[string]any)+ 814.(string)+ 316.([]any)assertions (1,708 total). A typed model (FrontmatterConfig) already exists but sits half-adopted. Finishing that migration plus adding a few named enum types (following the existingEngineNameprecedent) would remove the bulk of our runtime type-assertion risk. Nothing urgent β just high leverage.Full Analysis Report
Duplicated Type Definitions β clean bill of health
All 13 clusters are intentional and need no action:
type X = pkg.X, single source of truth):ActionYAMLInput,ActionPin,ActionPinsData,ContainerPin,SHAResolver(allpkg/actionpins/actionpins.goβpkg/workflow/action_pins.go);InputDefinition(pkg/types/input_definition.go:15βpkg/workflow/inputs.go:18);SanitizeOptions(pkg/stringutil/sanitize.go:60βpkg/workflow/strings.go:94);LogMetrics,ToolCallInfo(pkg/workflow/metrics.goβpkg/cli/logs_models.go).//go:buildplatform variants (same package,!js && !wasmvsjs || wasmβ Go requires both):ProgressBar(pkg/console/progress.go:31),SpinnerWrapper(pkg/console/spinner.go:92),RepositoryFeatures(pkg/workflow/repository_features_validation.go:67; the only byte-identical redefinition, mandated by build constraints).LogParseris aninterfaceinpkg/workflow/agentic_engine.go:189and a genericfunctype inpkg/cli/log_aggregation.go:37β unrelated, different packages.Untyped / Weakly-Typed Usages
interface{}literals: 0 (already migrated toanyπ)anyusages: 3,625 total βmap[string]any2,171 (365 files),[]any415,[]map[string]any59, bareanyparams ~213any: 1,708 across 333 filesCategory 1: the
map[string]anyconfig blob β π΄ highest impactmap[string]anyis used as a YAML/frontmatter config blob dismantled by hand. Assertion histogram:.(map[string]any)1,111 Β·.(string)814 Β·.([]any)316 Β·.(bool)146. A typed model already exists βFrontmatterConfigatpkg/workflow/frontmatter_types.go:301(114-line struct, verified via Serena) β but the raw map is still threaded through hundreds of call sites in parallel.Named-type opportunities
1.
type FrontmatterMap map[string]anywith accessor methods β biggest single win. Thefrontmatter/rawFrontmatterparam appears 270Γ across 124 files. Seed points:pkg/parser/frontmatter_content.go:20(FrontmatterResult.Frontmatter, verified),pkg/workflow/workflow_data.go:150(RawFrontmatter),pkg/cli/mcp_workflow_scanner.go:21. AddGetString/GetMap/GetSlice/GetBoolmethods so 124 files stop asserting by hand.2. Finish the
parse*Config(outputMap map[string]any)migration β 48 functions share this signature (e.g.pkg/workflow/publish_artifacts.go:53parseUploadArtifactConfig,pkg/workflow/dispatch_repository.go:30,update_project.go:36,assign_to_user.go:19,hide_comment.go:19, ...), each re-implementing pullβassertβdefault.3.
tools map[string]anyblob β 64Γ, e.g.pkg/workflow/claude_tools.go:20expandNeutralToolsToClaudeTools(tools map[string]any) map[string]any.Assertion hotspots (migrate first):
pkg/workflow/frontmatter_extraction_security.go(70 β unmarshal into typedNetworkConfig/SandboxConfig),repo_memory.go(47),safe_outputs_config.go(39),engine.go(39),pkg/parser/import_field_extractor.go(34).Leave alone (idiomatic
any): true JSON/YAML decode boundaries, template payloads, and genuine polymorphicDefault anyfields (pkg/types/input_definition.go:18).Category 2: missing semantic types on enum-like constants β π‘ medium
The codebase shows the good pattern once (
pkg/constants/engine_constants.go:13type EngineName string). These bare-string/int groups are effectively enums that didn't get it:Enum candidates
pkg/types/mcp.go:13Type string(verified), validated inpkg/parser/mcp.go:22and compared to literals ~12Γ (mcp_config_custom.go:104,119). βtype MCPServerType string.pkg/types/mcp.go:33(onlygithub-oidc). βtype MCPAuthType string.InputDefinition.Typeβpkg/types/input_definition.go:19(5-value enum, switched atbuild_input_schema.go:44-49). βtype InputType string.pkg/cli/mcp_registry_types.go:108-115StatusActive/Inactive,ArgumentTypePositional/Named(bare). βtype ServerStatus string,type ArgumentType string.pkg/github/label_objective_mapping_constants.go:21+(24 bare-string consts). βtype ObjectiveLabel string.pkg/cli/outcome_eval.go:125,391(noop/missing_tool/missing_data/report_incomplete), alsologs_metrics.go:380,510,641. βtype SafeOutputKind string.pkg/constants/constants.go:105-135(DefaultMCPGatewayPort=8080,MinNetworkPort=1,MaxNetworkPort=65535, ..., bare int). βtype Port int.Leave alone: arithmetic constants in
pkg/workflow/time_delta.go:489-501and byte-size limits inpkg/workflow/compiler.go:25-38; env-var-name strings inengine_constants.go:213-364.π― Recommendations (impact-per-effort)
FrontmatterMap+ accessors. Define the type, retypeFrontmatterResult.Frontmatter&WorkflowData.RawFrontmatter, migrate the 5 hottest decoder files. Incremental; removes the bulk of 1,700+ assertions.MCPServerType,InputType,SafeOutputKind. Compile-time safety against typos.parse*Configstandardization onto the accessors. Mechanical; less boilerplate.Checklist: β
FrontmatterMap+ methods + tests β retype seed fields β migrate top-5 decoder files βMCPServerType/MCPAuthType/InputTypeβSafeOutputKind/ArgumentType/ServerStatusβtype Port intβ run tests per package.Metadata
942 files analyzed Β· 953 types Β· 13 duplicate clusters (0 actionable) Β· 3,625
any+ 1,708 assertions Β· Method: pattern sweep + Serena semantic verification (activate_project,find_symbol) Β· 2026-07-03References: Β§28659147298
Beta Was this translation helpful? Give feedback.
All reactions