[sergo] Sergo Report: Symbol-Navigation + Pattern-Grep — 2026-04-29 #29186
Closed
Replies: 1 comment
-
|
This discussion was automatically closed because it expired on 2026-04-30T20:44:51.408Z.
|
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.
-
Date: 2026-04-29
Strategy:
symbol-navigation-plus-grepSuccess Score: 8/10
Executive Summary
This is the inaugural Sergo run on
github/gh-aw. Analysis combined Serena's LSP-powered symbol navigation tools with ripgrep pattern searches to perform a broad scan of the utility and workflow packages. The codebase is a large, well-structured Go monorepo (~400+ files inpkg/workflow/alone) with strong test coverage.Three actionable findings were identified spanning idiom consistency, error chain integrity, and logging architecture. None are correctness bugs, but two of them (error wrapping and logger bypass) directly affect production debuggability. Three GitHub issues were filed.
Serena Tools Snapshot
Tool Capabilities Used Today
activate_projectcheck_onboarding_performedlist_dirfind_file.gofiles by packageget_symbols_overviewfind_symbolfind_referencing_symbolssearch_for_patternwrite_memoryStrategy Selection
New Exploration Component (100% — first run, no cache to draw from)
Since this is the inaugural run, there is no prior strategy history. Both components of the 50/50 split were treated as new exploration. For future runs, today's strategy will serve as the cached baseline.
Strategy Name:
symbol-navigation-plus-grepApproach:
get_symbols_overviewandfind_symbolto read bodies of utility functions acrosspkg/sliceutil,pkg/stringutil,pkg/envutil,pkg/typeutil,pkg/fileutil, andpkg/gitutil. These small packages are high-leverage: they define idioms inherited by the larger packages.search_for_patternandGrepto quantify the spread ofmap[T]bool(set idiom),fmt.Errorfwithout%w(error wrapping), andfmt.Fprintln(os.Stderr)(logger bypass) across all non-test production code.find_referencing_symbolsto understand the blast radius of issues (e.g., confirmingDeduplicateis called from 14 production sites acrosspkg/cli,pkg/parser,pkg/workflow).Hypothesis: Small utility packages with weak idiomatic choices propagate bad patterns into larger packages that call them.
Codebase Context
pkg/: Hundreds (pkg/workflow alone has 400+ files)sliceutil,stringutil,envutil,typeutil,fileutil,gitutil,parser,workflow(selectively)Findings Summary
map[T]boolfor set semantics instead ofmap[T]struct{}fmt.Errorfwithout%wbreakserrors.Is/AschainsGetIntFromEnvbypasses logger for warning messagesDetailed Findings
Finding 1 —
map[T]boolUsed for Set Semantics (Medium)Location:
pkg/sliceutil/sliceutil.go:64,pkg/workflow/validation_helpers.go:212,pkg/stringutil/sanitize.go:22Pattern: Using
map[T]boolto track "seen" items (set membership) is valid but not idiomatic Go. The idiomatic approach ismap[T]struct{}becausestruct{}is a zero-size type — the value slot in the map requires no memory storage. Additionally, the intent ("this is a set") is clearer withstruct{}{}as the sentinel value.Quantified spread:
make(map[...bool): 153+ non-test filesmap[T]struct{}: 14 non-test filesThe ratio (153:14) shows the
boolpattern dominates, largely because the utility functionsDeduplicateandvalidateNoDuplicateIDsuse it, and callers copy the idiom.Finding 2 —
fmt.ErrorfMissing%w(High)Location: 173 non-test files, 580 occurrences
High-concentration files:
pkg/parser/schedule_fuzzy_scatter.go— 31 instancespkg/workflow/engine_validation.go— 17 instancespkg/workflow/stop_after.go— 16 instancespkg/workflow/compiler_pre_activation_job.go— 10 instancespkg/workflow/call_workflow_validation.go— 9 instancesWhen
%s(or no verb) is used for an error, the error chain is severed.errors.Is(err, target)anderrors.As(err, &target)cannot traverse the chain. This limits sentinel-error-based control flow upstream and makes production debugging harder.Note: errors with no underlying
errto wrap are intentionally plain — only cases where anerrvariable is included as%s(not%w) need migration.Finding 3 —
GetIntFromEnvBypasses Logger (Medium)Location:
pkg/envutil/envutil.go:38,48The function signature is:
The
logparameter is used only for the success path. Both warning paths (invalid format, out-of-bounds) usefmt.Fprintln(os.Stderr, ...), bypassing the caller-provided logger. This means callers cannot control the warning output channel, cannot suppress them in tests, and cannot redirect them to structured logging infrastructure.Improvement Tasks Generated
Task 1: Migrate set-semantics maps to
map[T]struct{}Impact: Medium | Effort: Medium
Start with:
pkg/sliceutil/sliceutil.go(Deduplicate),pkg/workflow/validation_helpers.go(validateNoDuplicateIDs),pkg/stringutil/sanitize.go(commonWorkflowKeywords)Then: Sweep remaining
make(map[...bool)set usages in production codeTask 2: Add
%wtofmt.Errorfcalls that include an errorImpact: High | Effort: Medium
Start with: High-count files:
schedule_fuzzy_scatter.go,engine_validation.go,stop_after.goTool:
go vet+golangci-lint errorlintto find and prevent regressionCaveat: Only wrap where an
errvariable is embedded — don't blindly add%wto format-only errorsTask 3: Route
GetIntFromEnvwarnings through the logger parameterImpact: Medium | Effort: Small
File:
pkg/envutil/envutil.go(2 warning sites)Pattern: Use the logger when non-nil, fall back to stderr when nil
Success Metrics
This Run
Score Reasoning
pkg/clileft mostly unexploredHistorical Context
This is the first Sergo run. No historical comparison available. Baseline established for future runs.
Cumulative Statistics:
symbol-navigation-plus-grepRecommendations
Immediate Actions
fmt.Errorfwithout%w— start withschedule_fuzzy_scatter.go(31 sites),engine_validation.go(17 sites),stop_after.go(16 sites). Consider enablingerrorlintin.golangci.yml.GetIntFromEnvlogger bypass — single-function change, low risk, high observability gain.DeduplicateandvalidateNoDuplicateIDstomap[T]struct{}— sets a better pattern for the rest of the codebase to follow.Long-term Improvements
errorlintorwrapcheckto thegolangci-lintconfig to prevent future error-wrapping gaps.go vetcheck) formap[T]boolset usage.pkg/cli/package — large surface area not yet analyzed for similar patterns.Next Run Preview
Suggested Focus Areas:
pkg/cli/commands (unexplored),pkg/parser/import cycle detection logic, error aggregation patterns inpkg/workflow/compiler_orchestrator.goStrategy Evolution: Next run should use
symbol-navigation-plus-grepas the 50% cached component, with a new 50% component targeting interface satisfaction and type assertion patterns inpkg/types/andpkg/workflow/engine_definition.go.References:
Generated by Sergo — The Serena Go Expert
Run ID: 25132435628 | Strategy: symbol-navigation-plus-grep
Beta Was this translation helpful? Give feedback.
All reactions