Repository navigation
Fix Go version gate ignoring go.work members (#1751) - #1752
Mikola Lysenko (mikolalysenko) merged 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
In a go.work workspace Go builds the highest version any member requires. The version check behind apply, apply --check, vendor and vex read only the current module's go.mod, so when another member required a newer version, apply wrote a replace the build ignored, apply --check said "in sync" and vex attested not_affected for a module the workspace still built unpatched. The check now reads every `use` member's go.mod and go.sum and treats a higher version anywhere in the workspace as the one built. apply and vendor refuse, apply --check fails and vex leaves the patch out (go_version_not_selected). Fixes #1751. Assisted-by: Claude Code:claude-opus-5-5
When every go.work member proves a version below the patched one and none is undecided, the workspace builds the highest of them, so the refusal now names that version instead of this module's own or "unknown". Reading go.work's members is shared with the conflict check, and the Go workspace docs say which commands read the other members. Assisted-by: Claude Code:claude-opus-5-5
The workspace member list now answers whether a go.work is in effect, so the separate check has no callers left. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ac7071b. Configure here.
|
Burn-down agent: labeled Ready for review at head
Generated by Claude Code |
Final review briefWhat it does. In a Risk: low. The change is limited to Look here
Verified
Changes I made. None. Open questions. None blocking. Known limits are in the PR description: the hosted rewriter is still single-module (#1753, and vex no longer attests those pins), and a newer version that enters only through a member's dependency isn't seen. Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Assisted-by: Claude Code:claude-opus-5-5
Main landed lighter fixes for the same go.work gaps this PR models in full: #1752 (version gate reads every member), #1753 (hosted pins outranked by another member), #1767 (stale go.work vendor warning) and the squashed #1748. Resolve them onto this PR's GoWorkspace model instead of keeping two workspace readers: - go_build_list: keep project_selection on GoWorkspace. Drop main's ModuleEvidence / workspace_selection / other_workspace_members and its three on-disk selection tests: GoWorkspace::selection covers those cases from the module graph (go_workspace tests), and without a module cache it answers Unknown by design. - hosted: drop #1753's go_members plumbing (engine RewriteOptions closure, rewrite_golang argument, CLI wiring). The PR's HostedGoWorkspace already refuses a pin another member outranks. Main's e2e test for it now seeds the module cache the workspace graph reads, and passes, including the rescan that removes the pin. - go_consumer_sync: port #1767's modules.txt audit (per-member replace resolution, member_owned, unreadable members skipped) onto go_workspace::load and its shared same_dir_key / lexical_target. - vex discover, CLI_CONTRACT, e2e_golang_hosted_build: keep the PR's stricter rules (a zip pin is checked against the workspace selection too; sum-file zip lines are no evidence of it). Co-Authored-By: Claude <noreply@anthropic.com>
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1751
Summary
In a
go.workworkspace, Go builds the highest version of a module that anyusemember requires. The Go version check behind agentapply,apply --check,vendorandvexread only the current module'sgo.mod/go.sum. So when another member required a newer version,applywrote a replace the build ignored,apply --checksaid "in sync", andvexattestednot_affectedwhile the workspace linked the unpatched module.Root cause
go_build_list::project_selectiontrusted the member's ownrequire. In workspace mode it only relaxedNotInGraphtoUnknown, never looking at what other members select.Fix
project_selectionnow also reads everyusemember'sgo.mod/go.sum(go_consumer_sync::workspace_member_dirs, which shares go.work parsing with the existing conflict check). It weighs the versions they prove the way MVS does: a higher version anywhere isOther(v), and the patched version proven anywhere isSelected. When every member proves a lower version and none is undecided, that version is reported.applyandvendorrefuse,apply --checkfails, andvexomits the patch withgo_version_not_selected. That includes hosted pins, since vex checks every Socket-owned replace.Follow-up (not in this PR)
The hosted write gate (
rewrite_golanginpatch/redirect/mod.rs) is an in-memory rewriter that only sees the root module's files, soscan --mode hostedin a member can still write a pin another member outranks. vex no longer attests it. Tracked in #1753. Fixing it means feeding member files into the hosted read set, which is a separate change to the hosted pipeline.Test evidence
go_build_list::tests::workspace_member_requiring_a_higher_version_winsgo_build_list::tests::workspace_lower_or_unused_members_do_not_change_the_selectiongo_build_list::tests::workspace_lower_versions_decide_only_without_unknown_memberse2e_golang_build::go_work_member_requiring_a_newer_version_makes_the_replace_inert(real go 1.24.7: apply refuses,--checkexits 1, vex omits withgo_version_not_selected, positive control)Commands run locally:
cargo fmt --all -- --check: okcargo clippy --workspace --all-features -- -D warnings: okSOCKET_PATCH_GO_E2E_REQUIRED=1 cargo test --workspace --all-features --no-fail-fast: 15078 passed, 12 failed. All Go, vendor and vex suites pass (e2e_golang 23, e2e_golang_build 28, e2e_golang_hosted_build 22, e2e_golang_hosted_state 29, e2e_golang_workspace_build 16, e2e_vendor_golang_build 38, vendor 151, vex 47). The 12 failures are outside this diff and come from this container:e2e_bun_lockbrun with local bun 1.4.4, while CI pins 1.4.2.CI runs these suites on the PR.
CI on ac7071b: 32 success, 50 skipped by path filters, Bugbot clean. The
Go patch compatibilityworkflow (multi-Go-release matrix) is disabled in this repo, so it did not run andworkflow_dispatchreturns 422. The same suites passed locally on go 1.24.7 (above).No wrapper (
npm/,pypi/,gem/) changes: they only dispatch to the binary./code-review highfindings not fixedproject_selectionreads go.mod/go.sum evidence only, the same limit as the single-module check (a pruned graph trustsrequire). Seeing it would mean reading dependency go.mod files from the module cache.GOWORK: the same dependency as the existing go.work tests ingo_consumer_sync. CI doesn't set it.https://claude.ai/code/session_011f9aePrKGvQCvZ5cTmj8ZB
Generated by Claude Code