Repository navigation
Scope the project-mode Go crawl to the modules go.sum records #1207
Description
[agent] Filed by the scheduled architecture refactor routine (Go child of #595). Register: discussion #560 register.
Kind: refactor. Source: review §3 #3, Part 6.6; register E05 (tracking #595, checklist item "Go: scope to go.sum module lines (the /go.mod-only lines don't count)").
Problem (main @ 793edd4)
In project mode, GoCrawler::crawl_all walks the whole GOMODCACHE as soon as cwd has a go.mod or go.sum (get_module_cache_paths).`` The project's go.sum is never consulted, so `scan` reports (and sends to the API, and agent apply sees) every module version any project on the machine downloaded. The walk also visits every directory of the cache tree, so its cost grows with the machine cache.
Impact
Wrong answers (modules the project never resolves) and a crawl whose cost grows with the machine cache, not the project.
Proposed change
- In project mode with a readable
<cwd>/go.sumand no Go workspace in effect (go.workincwdor an ancestor, orGOWORKset to a file), look up eachgo.summodule-zip line (<module> <version> h1:…;/go.modlines skipped) as<GOMODCACHE>/<encoded module>@<encoded version>/instead of walking. - The lookup is the one
find_by_purlsalready does (traversal guard, case encoding, partial-extraction marker): one sharedlocate_modulefor both. - Keep the walk for
--global/--global-prefix, a project without ago.sum, and workspaces (their build list spans other modules'go.sumandgo.work.sum). get_module_cache_paths/find_by_purls(agent apply, VEX consumed copies) are unchanged.
Size and scope
crawlers/go_crawler.rs only; ~+80 production lines. Out of scope: the shared crawl_unscoped_cache warning (#595's last item).
Acceptance criteria
- A project with a
go.sumcrawls only the modules it records (red on main). - No-
go.sum, workspace and global crawls are unchanged; the crawler oracle suites stay green. - Traversal-shaped
go.sumcoordinates and partially extracted modules are not reported. -
crawler_go_e2eand the CLI Go suites stay green.
Activity
mikolalysenko commentedon Oct 9, 2026
[agent] Claiming this issue for the architecture refactor routine (highest leverage: free hot-path crawl fix, S 3, next #595 child with the locator shape of #1204). Branch: arch-refactor/1207-go-sum-scope. Claim-ID: 2026-10-09T01:55:39Z-d73e58
Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
[agent] Draft PR: #1209.
Generated by Claude Code
Scope project-mode Go crawl to go.sum modules
Find a parent go.work from a relative cwd
Keep go.mod requires in the Go crawl scope