Skip to content

chore: upgrade Bazel to 9.1.1 - #127

Merged
menny merged 7 commits into
mainfrom
bazel-upgrade
Aug 1, 2026
Merged

chore: upgrade Bazel to 9.1.1#127
menny merged 7 commits into
mainfrom
bazel-upgrade

Conversation

@menny

@menny menny commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Upgrade Bazel to 9.1.1 and update module dependencies (rules_go v0.62.0, gazelle v0.52.2, aspect_rules_lint v2.7.2, rules_cc v0.2.22) for compatibility. All tests, linters, and formatters pass cleanly.

@cassandra-reviewer

cassandra-reviewer Bot commented Jul 31, 2026

Copy link
Copy Markdown

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.

@cassandra-reviewer cassandra-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Bazel 9 upgrade is handled well, but a test hermeticity issue due to hardcoded host machine paths needs to be resolved for reproducible builds.

@codecov-commenter

codecov-commenter commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.29%. Comparing base (d6bda80) to head (a1fe174).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
core/reviewer.go 0.00% 1 Missing ⚠️
tools/mcp_servers/godoc/server.go 75.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cassandra-reviewer
cassandra-reviewer Bot dismissed their stale review August 1, 2026 17:42

Superseded by a new AI review.

@cassandra-reviewer cassandra-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress on Bazel 9 upgrade and rules_cc dependency, but error handling in test initialization needs to be tightened to prevent silently falling back to host binaries.

@cassandra-reviewer
cassandra-reviewer Bot dismissed their stale review August 1, 2026 17:51

Superseded by a new AI review.

@cassandra-reviewer cassandra-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel 9 and rules_cc dependencies were resolved successfully, but an inefficient logic inversion in the test initialization needs to be fixed.

@cassandra-reviewer
cassandra-reviewer Bot dismissed their stale review August 1, 2026 18:11

Superseded by a new AI review.

@cassandra-reviewer cassandra-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Bazel 9 and dependency upgrades look good, but a small flow control tweak is needed in the test initialization logic to finalize the hermetic toolchain fix.

@cassandra-reviewer
cassandra-reviewer Bot dismissed their stale review August 1, 2026 18:22

Superseded by a new AI review.

@cassandra-reviewer cassandra-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a fix for a logic gap in the init script where goroot is not set in the fast path, defeating the optimization.

@cassandra-reviewer
cassandra-reviewer Bot dismissed their stale review August 1, 2026 22:07

Superseded by a new AI review.

@cassandra-reviewer cassandra-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Bazel upgrades and hermetic SDK improvements look excellent overall, but the directory scan in the test setup needs to be removed to directly derive the path.

Comment on lines +35 to +51
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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread core/reviewer.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"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread MODULE.bazel

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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@menny
menny merged commit f31cf61 into main Aug 1, 2026
2 checks passed
@menny
menny deleted the bazel-upgrade branch August 1, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants