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
Good news first: gh-aw is in genuinely healthy shape. I swept all 873 non-test Go files under pkg/ (β610 struct/interface definitions) and found zero real cross-package duplicate type names. The three names that appear twice (ProgressBar, SpinnerWrapper, RepositoryFeatures) are all legitimate //go:build wasm vs. native variants in the same package β the pattern you want, not duplication.
The findings worth acting on are two small structural near-duplicates and a recurring habit of modeling the same semantic concept as untyped any in several places (RunsOn, On, Headers, GuardPolicies, Stats). One nice thing: the codebase has fully migrated off interface{} (0 occurrences) to the any alias. The win here is turning a handful of repeated any fields into small shared named types β deleting scattered assertions and documenting intent. None of this is urgent; treat it as a friendly polish pass.
// both, byte-for-byte apart from the name:typeAntigravityResponsestruct {
Responsestring`json:"response"`Statsmap[string]any`json:"stats"`
}
Fix: one shared type EngineJSONResponse struct { Response string; Stats map[string]any }; both ParseLogMetrics paths unmarshal into it. Few refs, all in-file. Effort ~1h. This also covers the repeated Stats field below.
WorkflowTrialResult reproduces all three TrialArtifacts fields verbatim (down to the same commented-out AgentStdioLogs line):
pkg/cli/trial_support.go:19 β TrialArtifacts
pkg/cli/trial_types.go:6 β WorkflowTrialResult
// duplicated block in both:SafeOutputsmap[string]any`json:"safe_outputs"`AgenticRunInfomap[string]any`json:"agentic_run_info,omitempty"`AdditionalArtifactsmap[string]any`json:"additional_artifacts,omitempty"`
Fix: embed TrialArtifacts inside WorkflowTrialResult so the shared fields live in one place. Effort ~1h (confirm the embedded JSON layout matches consumers).
Build-tag variants β reviewed, NOT flagged
Correct platform-specific implementations, no action:
Most any use is legitimate polymorphic frontmatter (the code even notes too dynamic to type). I only flag concepts modeled as any in multiple places.
Category 1: Repeated polymorphic fields deserving a named type
RunsOn any (GitHub Actions runs-on; string/array/object) β workflow/safe_jobs.go:20, workflow/frontmatter_types.go:329, cli/copilot_setup.go:150. β shared type RunsOn any (optionally with UnmarshalYAML).
On any (workflow on: trigger) β cli/status_command.go:35, cli/jsonworkflow_to_markdown.go:38, cli/copilot_setup.go:158, cli/list_workflows_command.go:25. β one shared trigger type so the four CLI display paths agree.
Headers any (HTTP headers) β workflow/frontmatter_types.go:208 & :238, parser/import_field_extractor.go:764. β map[string]string (or map[string][]string, like http.Header) removes the assertions.
GuardPolicies map[string]any β workflow/mcp_renderer_types.go:84 & :111, workflow/tools_types.go:427, workflow/mcp_config_types.go:54 (+ WriteSinkGuardPolicies at mcp_renderer_types.go:21). β shared type GuardPolicies map[string]any to hang validation on.
Accept either a JSON string or number, forcing per-site assertions / fmt.Sprintf:
cli/gateway_logs_types.go:148 & :159 β ID any
cli/logs_models.go:304-305 β RunID / RunNumber any
cli/mcp_tools_privileged.go:254-255 β RunID / RunIDOrURL any
Fix: a small type FlexInt int64 (or StringOrInt) with custom UnmarshalJSON accepting both forms; consumers get a real value, no assertions.
Category 3: Untyped constants
Go untyped constants are idiomatic, so blanket-typing is not recommended β and I found none whose lack of a type creates a correctness risk. Only add a named type (e.g. type Seconds int) where a unit is genuinely ambiguous at call sites, not mechanically.
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.
-
π€ Typist β Go Type Consistency Analysis
Analysis of repository: github/gh-aw
Executive Summary
Good news first:
gh-awis in genuinely healthy shape. I swept all 873 non-test Go files underpkg/(β610 struct/interface definitions) and found zero real cross-package duplicate type names. The three names that appear twice (ProgressBar,SpinnerWrapper,RepositoryFeatures) are all legitimate//go:build wasmvs. native variants in the same package β the pattern you want, not duplication.The findings worth acting on are two small structural near-duplicates and a recurring habit of modeling the same semantic concept as untyped
anyin several places (RunsOn,On,Headers,GuardPolicies,Stats). One nice thing: the codebase has fully migrated offinterface{}(0 occurrences) to theanyalias. The win here is turning a handful of repeatedanyfields into small shared named types β deleting scattered assertions and documenting intent. None of this is urgent; treat it as a friendly polish pass.Full Analysis Report
Duplicated Type Definitions
Summary
pkg/, excl.*_test.go+testdata/) Β· Type defs: ~610Cluster 1:
AntigravityResponseβGeminiResponseβ structural duplicateIdentical field set, same
workflowpackage:pkg/workflow/antigravity_logs.go:13pkg/workflow/gemini_logs.go:13Fix: one shared
type EngineJSONResponse struct { Response string; Stats map[string]any }; bothParseLogMetricspaths unmarshal into it. Few refs, all in-file. Effort ~1h. This also covers the repeatedStatsfield below.Cluster 2:
TrialArtifactsβWorkflowTrialResultβ embed candidateWorkflowTrialResultreproduces all threeTrialArtifactsfields verbatim (down to the same commented-outAgentStdioLogsline):pkg/cli/trial_support.go:19βTrialArtifactspkg/cli/trial_types.go:6βWorkflowTrialResultFix: embed
TrialArtifactsinsideWorkflowTrialResultso the shared fields live in one place. Effort ~1h (confirm the embedded JSON layout matches consumers).Build-tag variants β reviewed, NOT flagged
Correct platform-specific implementations, no action:
ProgressBarβconsole/progress.go:31+progress_wasm.go:7SpinnerWrapperβconsole/spinner.go:92+spinner_wasm.go:10RepositoryFeaturesβworkflow/repository_features_validation.go:58+..._wasm.go:5Untyped Usages
Summary
interface{}: 0 (allanyβ good) Β·anytokens: ~3,450 Β·map[...]any: ~2,078anystruct fields: 31 Β·map[string]anystruct fields: 72 Β· func sigs w/any: ~866Most
anyuse is legitimate polymorphic frontmatter (the code even notes too dynamic to type). I only flag concepts modeled asanyin multiple places.Category 1: Repeated polymorphic fields deserving a named type
RunsOn any(GitHub Actionsruns-on; string/array/object) βworkflow/safe_jobs.go:20,workflow/frontmatter_types.go:329,cli/copilot_setup.go:150. β sharedtype RunsOn any(optionally withUnmarshalYAML).On any(workflowon:trigger) βcli/status_command.go:35,cli/jsonworkflow_to_markdown.go:38,cli/copilot_setup.go:158,cli/list_workflows_command.go:25. β one shared trigger type so the four CLI display paths agree.Headers any(HTTP headers) βworkflow/frontmatter_types.go:208&:238,parser/import_field_extractor.go:764. βmap[string]string(ormap[string][]string, likehttp.Header) removes the assertions.GuardPolicies map[string]anyβworkflow/mcp_renderer_types.go:84&:111,workflow/tools_types.go:427,workflow/mcp_config_types.go:54(+WriteSinkGuardPoliciesatmcp_renderer_types.go:21). β sharedtype GuardPolicies map[string]anyto hang validation on.Stats map[string]anyβworkflow/antigravity_logs.go:15,gemini_logs.go:15,pi_logs.go:36. β folded intoEngineJSONResponse(Cluster 1).Category 2: String-or-number JSON IDs
Accept either a JSON string or number, forcing per-site assertions /
fmt.Sprintf:cli/gateway_logs_types.go:148&:159βID anycli/logs_models.go:304-305βRunID/RunNumber anycli/mcp_tools_privileged.go:254-255βRunID/RunIDOrURL anyFix: a small
type FlexInt int64(orStringOrInt) with customUnmarshalJSONaccepting both forms; consumers get a real value, no assertions.Category 3: Untyped constants
Go untyped constants are idiomatic, so blanket-typing is not recommended β and I found none whose lack of a type creates a correctness risk. Only add a named type (e.g.
type Seconds int) where a unit is genuinely ambiguous at call sites, not mechanically.Recommendations (by priority)
EngineJSONResponse(replacesAntigravityResponse+GeminiResponse); embedTrialArtifactsinWorkflowTrialResult.RunsOn,On,GuardPolicies(and optionallyHeaders) types/aliases; adopt at listed sites.FlexInt/StringOrInt+ customUnmarshalJSON; adopt atID/RunID/RunNumber.After each step run
go build ./...and the test suite to confirm no breakage.Metadata
interface{}: 0pkg/References: Β§27347015436
Beta Was this translation helpful? Give feedback.
All reactions