[sergo] Sergo Report: reverify-plus-unchecked-type-assertion-audit - 2026-05-25 #34581
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-05-26T05:24:19.176Z.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Executive Summary
Run 18 reverified the three open Sergo-tracked findings and ran a new audit on unchecked single-value type assertions (
.(T)without, ok) in production Go code. The reverify is the headline:#aw_sg17a2(magictime.Sleepliterals) is FULLY RESOLVED — all six previously-flagged literals inpkg/cli/now use namedtime.Durationconstants (trialRepoInitDelay,betweenWorkflowsDelay,mcpScriptsServerStartupDelay,mcpScriptsServerShutdownDelay,mcpStdioServerStartupDelay,mcpProcessCleanupDelay). Resolution path: thenamed_durationpattern established last run is now load-bearing acrosspkg/cli/.#aw_sg14a1(silent syscall discards, 10 sites) and#aw_sg17a1(16 prodpanic()sites with unenforcedpanicinlibrarycodelinter) are unchanged — line-drift only on two files, no new sites, no fixes.The new audit (50% novel exploration) turned up one clean high-value finding:
pkg/cli/project_command.go:159callsproject["id"].(string)without the, okform while the very sameprojectmap isok-checked for"url"(L167) and"number"(L172). The asymmetry is the smoking gun — same variable, same trust boundary (a GraphQL response), three sibling reads, two defended, one not. Anullor missingidfrom a future or malformed GitHub GraphQL response panics the CLI. Fix is six lines and mirrors the pattern already used three lines below. Filed as#34580. The other unchecked.(T)sites found acrosspkg/are either local-literal safe-by-construction,sync.Map/sync.Poolsingle-type idioms, or thepass.ResultOf[inspect.Analyzer].(*inspector.Inspector)framework idiom — flagged in the issue body for awareness but no action recommended.Success score: 9/10. One new high-quality issue, one finding fully resolved between runs, clear evidence of the codebase absorbing prior Sergo recommendations.
🛠️ Serena Tools Update
Tools Snapshot
Tool Capabilities Used Today
activate_project/home/runner/work/gh-aw/gh-aw(6.7 s — cold container)Grep(preferred overfind_symbolfor broad patterns).(T)sites across 250 files; verified panic-site count; locatedtime.Sleepcall sitesReadcreateProjectenvelope validation, sibling, okchecksgh api search/issues#33459already tracks#aw_sg14a1. Bridge wraps results in a recursive envelope when total_count is real — workaround: filterselect(.html_url)📊 Strategy Selection
Strategy name:
reverify-plus-unchecked-type-assertion-auditCached Reuse Component (50%)
reverify-plus-Xtemplate (R13–R17, five consecutive runs, avg success 8.6/10)#aw_sgar1/#aw_sgar2in R12,#aw_sg15a1/#aw_sg15a2in R16,#aw_sg16a1in R17). This run continued the streak:#aw_sg17a2resolved within one run of being flagged.#aw_sg14a1,#aw_sg17a1,#aw_sg17a2) using onlyGrep(LSP not needed for line-count comparisons against cached site lists). Avoided the 70 s+ broadfind_symbolcalls noted in the tools-cache gotchas.New Exploration Component (50%)
.(T)(no, ok) in production code. Not incompleted_scanscache. Panic-risk pattern complementary to (but distinct from)#aw_sg17a1's explicitpanic()audit.Grepextended regex,Readfor context verification.pkg/cli/,pkg/workflow/,pkg/parser/,pkg/linters/(all.go, excluding_test.go).Combined Strategy Rationale
Reverify locks in cumulative value (catches regressions and resolutions); the type-assertion audit extends the panic-risk taxonomy started by
#aw_sg17a1. Together they cover both explicit panic paths (panic(...)) and implicit panic paths (.(T)without, ok) — a complete picture of the codebase's runtime-failure surface.🔍 Analysis Execution
Codebase Context
pkg/(excluding_test.go), ok, framework idioms, etc.).(T)sites in production: ~12 (after excluding.(type)and, okforms)Findings Summary
#34580uncheckedproject["id"].(string)(issue created)#aw_sg14a1,#aw_sg17a1)#34580issue body)📋 Detailed Findings
High Priority — NEW
#34580— Uncheckedproject["id"].(string)atpkg/cli/project_command.go:159projectmap (amap[string]anyfrom a GraphQL response) isok-checked for"url"(L167) and"number"(L172). The"id"read is the only unchecked sibling.null/ missing / unexpectedly-typedidin the GraphQL response panics the CLI instead of returning"failed to get project ID from response".#34580).Open Findings — Reverified
#aw_sg17a2magictime.Sleepnamed_durationpattern adopted; fastest fix yet (1 run)#aw_sg14a1silent syscall discardsos.Setenv+ 6os.Chdir)#aw_sg17a1panic()in library codeagentic_engine463→464,claude_tools179→185,model_aliases84→86,strings176→177)cmd/linters/main.go:43butcgo.yml:1040runsLINTER_FLAGS=-errstringmatch -test=falseonlyInformational — Unchecked `.(T)` sites that are safe-by-convention
pkg/cli/jsonworkflow_to_markdown.go:448intervalType.(string)parts["_interval"]is populated only by this function withstringvaluespkg/cli/jsonworkflow_to_markdown.go:455intervalType.(string)pkg/workflow/safe_outputs_workflow_helpers.go:41tool["inputSchema"].(map[string]any)[...]pkg/workflow/mcp_scripts_generator.go:61inputSchema["properties"].(map[string]any)pkg/workflow/yaml.go:173cached.(*regexp.Regexp)sync.Mapstores only*regexp.Regexppkg/workflow/repository_features_validation.go:185, 212cached.(*RepositoryFeatures),actual.(*RepositoryFeatures)sync.Map/OnceLoader[T]invariantpkg/cli/workflows.go:357workflowTitleScannerBufferPool.Get().(*[]byte)sync.Poolstores only*[]bytepkg/linters/*(12 sites)pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)go/analysisframework idiom — required form✅ Improvement Tasks Generated
Task 1 —
#34580Fix uncheckedproject["id"].(string)createProjectFromConfigblock inproject_command.go)TestCreateProject_MissingIDtable case📈 Success Metrics
This Run
#34580)pkg/**/*.goexcluding_test.go)Reasoning for Score
#34580is a clear inconsistency-with-sibling-code bug-risk, not a stylistic nit. Self-fixing PRs land easily on patterns like this.pkg/but no deep LSP cross-reference (deliberate; Grep was sufficient).#aw_sg17a2fully resolved in one cycle — Sergo'snamed_durationrecommendation taken up immediately.📊 Historical Context
Strategy Performance (R13–R18)
Cumulative Statistics (through R18)
reverify-plus-*(avg 8.67/10 across 6 uses; 4 of 5 prior open findings resolved within ≤2 cycles)🎯 Recommendations
Immediate Actions
#34580— Apply the 6-LOC fix toproject_command.go:159. Smallest issue Sergo has filed in months; easy win.#aw_sg17a1— Make a decision: refine thepanicinlibrarycodelinter to skip the established idiomatic patterns (sync.Once.Doinit-load,BUG:prefix,init()registration failures, defense-in-depth preconditions), OR annotate the 16 sites with//nolint+ justification, OR retire the linter. Current state — registered but unenforced viacgo.yml:1040's positive-allowlistLINTER_FLAGS=-errstringmatch -test=false— is the worst of three worlds (dev-time intent without CI enforcement).#aw_sg14a1— Open issue Silent error discards on os.Setenv / os.Chdir in pkg/cli (10 prod sites) #33459 covers this. No new Sergo action.Long-term Improvements
unchecktypeassertthat warns on.(T)(single-value form) except in the documented safe contexts:sync.{Map,Pool}callbacks,go/analysisframework, and immediately-after-literal-construction. The taxonomy is concrete enough to encode.OnceLoader[T],actionUpdateDepsdeps-struct,named_duration,errors.Isfor stdlib-unwrapped sentinels). Sergo can shift more weight toward auditing new code for adoption rather than legacy-cleanup.🔄 Next Run Preview
Suggested Focus Areas
%wvs%vfor wrapped errors inpkg/workflow/(large surface, no prior scan).deferordering / placement: aredefer mu.Unlock()calls always immediately aftermu.Lock()?#34580fixed and#aw_sg17a1/#aw_sg14a1still unchanged.Strategy Evolution
Continue the
reverify-plus-Xtemplate — it's been the most productive format (6 consecutive uses, all scoring 8–9). Rotate theXaudit dimension to keep coverage broad without losing the reverify backbone.Generated by Sergo - The Serena Go Expert
Run ID: 26384351150
Strategy: reverify-plus-unchecked-type-assertion-audit
References:
project_command.go:159unchecked type assertion#aw_sg14a1(silent syscall discards)Beta Was this translation helpful? Give feedback.
All reactions