Repository navigation
Fix vendored Go undo missing modules.txt warning (#1777) - #1778
Merged
Mikola Lysenko (mikolalysenko) merged 4 commits intoOct 28, 2026
Merged
Mikola Lysenko (mikolalysenko) merged 4 commits into
Mikola Lysenko (mikolalysenko) merged 4 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Adds failing e2e tests for #1777. A vendored Go patch plus the `go mod vendor` its warning asks for leaves vendor/modules.txt recording the socket replace. Undoing it with `vendor --revert`, `rollback` or `remove` breaks every default build with "inconsistent vendoring", yet none of them names `go mod vendor`. Assisted-by: Claude Code:claude-opus-5-5
After a vendored Go patch was undone with `vendor --revert`, `rollback` or `remove`, a committed vendor/modules.txt kept recording the dropped replace, and every default build failed with "inconsistent vendoring". Nothing told the user, and `vendor --check` passed. The shared vendored revert step now audits the Go consumer state once after it unwires a Go entry, so every undo command warns `go_vendor_modules_txt_out_of_sync` and names `go mod vendor` (or `go work vendor`), as agent-mode rollback already did. `vendor --check` now fails on a modules.txt that still records a socket replace go.mod no longer has. Rollback no longer repeats the warning when its agent and vendored legs both report it. Fixes #1777 Assisted-by: Claude Code:claude-opus-5-5
Review follow-up. The audit no longer runs inside the shared revert step, so a forward `vendor` run that reconciles a dropped entry does not warn mid-run and again at the end. The undo commands (`vendor --revert`, `rollback`, `remove`) now call it explicitly, and it reports only issues for the Go modules they unwired, never unrelated issues under the wrong package. This also drops the rollback dedup that was only needed for that case. `vendor --check` runs the audit once. The docs now name `vendor --revert` and `remove` among the commands that warn. Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 28, 2026 11:18
Collaborator
Author
|
BugBot review Generated by Claude Code |
Bugbot is paused — your team has an unpaid invoiceBugbot is paused because your team has an unpaid invoice. Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically. (requestId: 07f7d8cd-ad93-4bf5-8cad-340e64c8d681) |
Bugbot is paused — your team has an unpaid invoiceBugbot is paused because your team has an unpaid invoice. Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically. (requestId: 289a9925-247f-41aa-802e-1db86d92cdf2) |
Collaborator
Author
|
bugbot run Generated by Claude Code |
Bugbot is paused — your team has an unpaid invoiceBugbot is paused because your team has an unpaid invoice. Pay it from the billing page in the Cursor dashboard and Bugbot resumes automatically. (requestId: 1fd7f5ba-84e0-4cd6-a600-2c823e408cf6) |
Tanmay Singla (Tanmay182003)
approved these changes
Oct 28, 2026
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-go-vendored-undo-modules-audit
branch
October 28, 2026 14:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1777
What users saw
Take a Go project with a committed
vendor/and a vendored socket patch,with
go mod vendorre-run as the forward warning asks. Undoing the patchwith
vendor --revert,rollbackorremove <purl>drops the go.modreplaceand exits 0 with no warning. Butvendor/modules.txtstillrecords the removed replace, so every default build fails with
"inconsistent vendoring".
vendor --checkalso passed afterwards.Agent-mode rollback already warned about this (#343).
Root cause
All three undo commands go through the shared vendored revert step
(
VendoredBackend::revert), but none of them runs thego_consumer_syncaudit afterwards:vendor --revert(run_revert) never called it.rollbackcalled it only after an agent-mode (is_local_go) Go result.removehad no Go consumer audit at all.vendor --checkaudits Go state only per ledger entry, so once the revertremoved the entry, it no longer saw the stale record.
Fix
VendoredBackend::go_undo_warningsaudits the Go consumer state onceafter a revert and returns the issues of the Go modules that revert
unwired (dry runs and kept entries excluded), keyed by ledger entry.
vendor --revert, rollback's vendored leg andremovecall it, so eachone warns
go_vendor_modules_txt_out_of_syncand namesgo mod vendor,or
go work vendorin a workspace. It is not built intorevertitself: the forward
vendorrun also reverts dropped entries, and italready audits once at the end of the run.
vendor --checkruns the audit once and fails on a modules.txt thatstill records a socket replace go.mod no longer has, for a module with
no Go ledger entry left (
go_vendor_modules_txt_out_of_sync, namingthe regeneration command).
docs/ecosystems.md: the "Files go derives from go.mod" section nownames
vendor --revertandremoveamong the commands that warn.No wrapper changes: the npm/PyPI/gem wrappers only dispatch the binary.
Tests
New e2e tests in
e2e_vendor_golang_build.rs(real go 1.24.7, hermeticfile GOPROXY). Each one runs vendor, then
go mod vendor(orgo work vendor), then the undo, and checks that:go_vendor_modules_txt_out_of_sync;apply --checkandvendor --checkexit 1 and name the regeneration command;vendor --checkno longer reports the modules.txt drift.
vendor --revertvendor_revert_needs_go_mod_vendor_with_committed_vendor_dirrollbackvendored_rollback_needs_go_mod_vendor_with_committed_vendor_dirremove <purl>vendored_remove_needs_go_mod_vendor_with_committed_vendor_diruse .) +vendor --revertvendor_revert_needs_go_work_vendor_in_workspaceuse .) +rollbackvendored_rollback_needs_go_work_vendor_in_workspaceuse .) +removevendored_remove_needs_go_work_vendor_in_workspaceLocal results:
cargo test -p socket-patch-cli --all-features --test e2e_vendor_golang_build --test e2e_golang_build --test e2e_golang_workspace_build --test e2e_golang_hosted_build: 44 + 27 + 16 + 22 passedcrates/socket-patch-cli/srcreset toorigin/main: 6 FAILED; with the fix: 6 okcargo fmt --all -- --check: ok.cargo clippy --workspace --all-features -- -D warnings: okcargo test --workspace --all-features: Go suites and everything this diff touches pass. A dozen tests in untouched areas (pypi/vlt/repair write-failure and copy_tree permission tests,e2e_bun_lockb) fail locally because the sandbox runs as root, which ignores the chmod-based failure injection, or because of the known Nightly e2e_bun_lockb red: offline takeover test predates #1648 #1770 bun issue. CI runs them non-root.CI
All 81 check runs on
61717deare green or skipped. The "Go patchcompatibility" workflow, which would run these Go e2e suites on a PR, is
disabled by hand in the repo (last run 2026-10-09), so the Go e2e evidence
above comes from local runs. Bugbot is paused for the team (unpaid Cursor
invoice).
@bugbot reviewwas posted at61717deand needs re-triggeringonce billing is fixed.
Scope notes
use ./a): the issue notes this overlapsGo rollback and remove in a go.work member stay silent about a stale
go work vendormodules.txt, so every workspace build fails with "inconsistent vendoring" #1766. Recognizing a member's./a/.socket/...replace in modules.txtis what Fix stale go.work vendor warning for members (#1766) #1767 fixes in
go_consumer_sync. This PR makes the vendoredundo paths run that same audit, so once Fix stale go.work vendor warning for members (#1766) #1767 lands they pick up its
member handling too. Not tested here, to avoid conflicting with Fix stale go.work vendor warning for members (#1766) #1767.
apply --checkwith no manifest file at all (aget --mode vendoredproject) still exits 0 under its "nothing to verify" contract. For that
shape,
vendor --checknow reports the drift./code-review highfindings and how they were handled:unrelated shows up under the wrong purl. This also removed the rollback
dedup.
vendor --checkaudit runs once.vendor --checkflags a stale agent-mode socket recordtoo. It breaks the same default build, and
apply --checkalreadyreports it.
That ordering predates this PR.
Generated by Claude Code