Repository navigation
[repository-quality] Repository Quality: Concurrency Safety & Race Detection #67208
Closed
Replies: 1 comment
|
This discussion was automatically closed because it expired on 2026-10-10T13:07:02.288Z.
|
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.
🎯 Repository Quality Improvement Report - Concurrency Safety & Race Detection
Analysis Date: 2026-10-09
Focus Area: Concurrency safety & race detection
Strategy Type: Custom
Custom Area: Yes — prior runs covered errors, contexts, function size and test isolation; concurrency/race coverage is not yet examined.
Executive Summary
The repo has solid concurrency discipline: 37 non-test
gostatements, all inspected ones recover from panics, and custom linters exist (goroutinemissingrecover,wgdonenotdeferred,timeafterleak,manualmutexunlock). The biggest gap is that no-racerun is configured in theMakefileorci.yml, despite ~4,100t.Parallel()/RunParallelusages and shared package-level caches.Secondary items: ~15 package-level
sync.Mapcaches (pkg/cli/update_workflows.go:25-27,pkg/workflow/yaml.go:108,pkg/workflow/behavior_defined_engine.go:806,824) with no documented lifecycle or reset for tests; ~87 package-level maps/sync vars that are safe only by "read-only by convention"; and twotime.Afteruses in select statements (pkg/cli/mcp_inspect.go:139,pkg/cli/mcp_inspect_inspector.go:243).Full Analysis Report
Current State Assessment
-racein Makefile/CIgostatementssync.Mapcachestime.AfterStrengths
defer wg.Done()enforced by linters.errgroupand semaphores used for fan-out (audit_analysis_fanout.go,forecast_compute.go).Areas for Improvement
sync.Mapcaches without invalidation/test-reset helpers.time.Afterinmcp_inspect*.go; read-only global maps not enforced (pkg/cli/outcome_eval.go:78,pkg/workflow/safe_outputs_handler_registry_issues.go:4).🤖 Tasks for Copilot Agent
NOTE TO PLANNER AGENT: Split the following tasks into individual work items.
Improvement Tasks
Task 1: Add race-detector test target
Priority: High
Estimated Effort: Small
Focus Area: Concurrency
Description: Add
make test-racerunninggo test -raceon concurrency-heavy packages (./pkg/cli,./pkg/console,./pkg/syncutil,./pkg/parser) and wire it into CI (scheduled or non-blocking first).Acceptance Criteria:
make test-raceexists and is documentedCode Region:
Makefile,.github/workflows/ci.ymlTask 2: Consolidate global sync.Map caches
Priority: Medium
Estimated Effort: Medium
Focus Area: Concurrency
Description: Replace raw package-level
sync.Mapcaches with typed wrappers (generic cache inpkg/syncutil) that provide typed access and aReset()for tests.Acceptance Criteria:
update_workflows.go,yaml.go,behavior_defined_engine.gocaches migratedCode Region:
pkg/cli/update_workflows.go,pkg/workflow/yaml.go,pkg/workflow/behavior_defined_engine.goTask 3: Replace time.After in MCP inspect selects
Priority: Low
Estimated Effort: Small
Focus Area: Concurrency
Description: Use
time.NewTimer+defer Stop()inmcp_inspect.go:139andmcp_inspect_inspector.go:243, or justify with(nolint/redacted):timeafterleak.Acceptance Criteria:
time.Afterin non-test codeCode Region:
pkg/cli/mcp_inspect.go,pkg/cli/mcp_inspect_inspector.goTask 4: Freeze read-only global lookup maps
Priority: Low
Estimated Effort: Medium
Focus Area: Concurrency
Description: Convert package-level lookup maps (e.g.
outcomeEvaluators,issueHandlerRegistry,jsonToolToToolset) to accessor functions orsync.OnceValuebuilders so mutation cannot happen from parallel tests; confirmpackagelevelmutableslicemaplinter covers them.Acceptance Criteria:
Code Region:
pkg/cli/outcome_eval.go,pkg/workflow/safe_outputs_handler_registry_issues.go,pkg/cli/jsonworkflow_to_markdown.go📊 Historical Context
Previous Focus Areas
🎯 Recommendations
Immediate Actions (This Week)
make test-raceand CI job — Priority: HighShort-term Actions (This Month)
Long-term Actions (This Quarter)
📈 Success Metrics
Next Steps
Generated by Repository Quality Improvement Agent
Next analysis: 2026-10-10 — Focus area selected by diversity algorithm
All reactions