chore: upgrade Bazel to 9.1.1 - #127
Conversation
|
These Bazel upgrades and hermetic SDK improvements look excellent overall. We just need to remove the directory scan in the test setup so it directly derives the path. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #127 +/- ##
==========================================
+ Coverage 70.27% 70.29% +0.02%
==========================================
Files 31 31
Lines 3956 3959 +3
==========================================
+ Hits 2780 2783 +3
Misses 1176 1176 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Superseded by a new AI review.
Superseded by a new AI review.
Superseded by a new AI review.
Superseded by a new AI review.
Superseded by a new AI review.
| var goroot string | ||
| entries, err := os.ReadDir(runfilesDir) | ||
| if err != nil { | ||
| panic(fmt.Sprintf("failed to read runfiles directory %q: %v", runfilesDir, err)) | ||
| } | ||
| for _, entry := range entries { | ||
| if entry.IsDir() && strings.Contains(entry.Name(), "go_sdk") { | ||
| goroot = filepath.Join(runfilesDir, entry.Name()) | ||
| break | ||
| } | ||
| } | ||
|
|
||
| if goroot == "" { | ||
| panic(fmt.Sprintf("failed to locate Go SDK GOROOT directory under %q", runfilesDir)) | ||
| } | ||
|
|
||
| goBin := filepath.Join(goroot, "bin", "go") |
There was a problem hiding this comment.
The previous review requested an O(1) approach to resolve GOROOT. While replacing the recursive tree walk with a top-level os.ReadDir is faster, scanning the runfiles directory to guess the SDK path via strings.Contains(entry.Name(), "go_sdk") is still imprecise and unnecessary. Since candidate is the exact, validated physical path to the go binary provided by Bazel's rlocationpath, we can derive GOROOT directly via goroot := filepath.Dir(filepath.Dir(candidate)). You can eliminate this entire directory scan and the subsequent os.Stat fallback by simply using candidate as the target for GO_BIN and its grandparent directory as GOROOT.
There was a problem hiding this comment.
Thanks for the feedback! I tested setting GOROOT := filepath.Dir(filepath.Dir(candidate)), but in Bazel 8/9 with Bzlmod, $(rlocationpath @rules_go//go) resolves to rules_go+/go/tools/go_bin_runner/bin/go (the rules_go go_bin_runner launcher wrapper).
Its grandparent directory is rules_go+/go/tools/go_bin_runner, which is not a valid GOROOT (it lacks standard library packages like src/fmt). Executing go doc with that grandparent set as GOROOT fails with exit code 1 (runfiles: no runfiles found).
The actual Go SDK containing src/fmt resides in a sibling runfiles directory (rules_go++go_sdk+...). Scanning the top-level RUNFILES_DIR via os.ReadDir (which iterates over only ~4 top-level entries without any recursive tree walking) is required to locate the actual go_sdk directory for GOROOT and bin/go.
| mcpConfig.MCPServers["mcp-server-fetch"] = mcp.ServerConfig{ | ||
| Command: "uvx", | ||
| Args: []string{"mcp-server-fetch"}, | ||
| Args: []string{"--with", "mcp<1.3.0", "mcp-server-fetch"}, |
There was a problem hiding this comment.
Pinning the mcp-server-fetch dependency to <1.3.0 via --with is a great defensive move to prevent upstream breakages from affecting the agent's startup.
|
|
||
| go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") | ||
| go_sdk.download(version = "1.24.4") | ||
| go_sdk.download(version = "1.24.12") |
There was a problem hiding this comment.
Thank you for verifying compatibility between rules_go 0.62.0 and Bazel 9, and for bringing in rules_cc to ensure the CGo pipeline remains functional on macOS after the legacy Xcode configuration targets were removed. This correctly navigates the constraints defined in our project guidelines.
Upgrade Bazel to 9.1.1 and update module dependencies (
rules_gov0.62.0,gazellev0.52.2,aspect_rules_lintv2.7.2,rules_ccv0.2.22) for compatibility. All tests, linters, and formatters pass cleanly.