Repository navigation
Read the sum file go reads under a GOWORK that names another work file - #2458
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
Assisted-by: Claude Code
go keeps a workspace's checksums in the work file's name with `.sum` appended: `go.work.sum` for `go.work`, `ci.work.sum` under `GOWORK=/repo/ci.work`. The workspace loader read `go.work.sum` beside the work file whatever the file was called, and `vex` took a workspace's sums from it. So under a `GOWORK` that names another file `vex` judged a hosted Go pin by a file go does not read and never read the one go does: a `go.work.sum` go ignores could refuse a pin go builds, and a zip line in it could stand as the pin with none in a file go reads. The crawler had its own copy of the rule, which followed go. There is one now, `go_workspace::sum_file`, and the loader, the crawler and the hosted engine's list of files read all go by it. Nothing changes for a work file named `go.work`. Fixes #2439. Assisted-by: Claude Code
The CLI test stopped at the first row that went the wrong way. It now collects each row whose outcome (attested or not) differs from go's, and fails once with all of them; a row that goes the right way is still held to its whole shape. Against the loader that read `go.work.sum` it names eight of the ten rows. Refs #2439. Assisted-by: Claude Code
- The doc of the discovery's `outside_sums` still said "the governing `go.work.sum`"; it names the work file's sum file now. - The CLI test's row for a zip line in `go.work.sum` alone said go does not build the pin. go builds: it takes what the proxy serves and records it in `ci.work.sum` (run with go 1.24.7 and a stand-in replacement module). The row's point is that no file go reads pins the zip, and the message and the doc say so. No production code changes. Refs #2439. Assisted-by: Claude Code
|
bugbot run Generated by Claude Code |
PR SummaryMedium Risk Overview This PR introduces Unit and CLI e2e tests ( Reviewed by Cursor Bugbot for commit 014ef71. Configure here. |
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 014ef71. Configure here.
|
[agent] Five jobs on 014ef71 failed, and none of them reached a test result:
So the runners were lost, not the tests. I re-ran the failed jobs of the three workflow runs once (19:03Z and 19:06Z). If a re-run fails with a test result, that is this PR's to fix; the outcome goes in the description's Verification section. Generated by Claude Code |
Assisted-by: Claude Code
|
[agent] PR shepherd: review brief for the approver What it does. go names a workspace's sum file after the work file ( Risk: low. Production change is +16 −10 and only changes behavior when Look here
Verified. Read the whole diff. Checked that Changes I made. None. Open questions. None that block. Follow-ups listed in the description: the Generated by Claude Code |
LLM Description written by Claude Code
Fixes #2439.
Problem
go keeps a workspace's checksums in the work file's name with
.sumappended:go.work.sumforgo.work,ci.work.sumunderGOWORK=/repo/ci.work. The workspace loader readgo.work.sumbeside the work file whatever the file was called, andvextakes a workspace's sums from the loader. The crawler had its own copy of the rule, added in #2431, and that copy follows go. So two readers of one rule disagreed.Under a
GOWORKthat names another file,vexjudged a hosted Go pin by a file go does not read, and never read the one go does:go.work.sumgo ignores, or because the zip pin sits inci.work.sum, where go wrote it;go.work.sum, which binds nothing: go never checks a download against that file.Who it hurts: a repository that keeps a second work file for CI (
GOWORK=/repo/ci.work), beside or instead ofgo.work.Evidence on
main(7beca2f)What go does (go 1.24.7, modules served from a file proxy, one member
a,GOWORK=/repo/ci.workthroughout):And the pin itself, with a stand-in for the Socket module (
replace example.com/dep v0.9.1 => example.com/patched v0.9.2, the module cache emptied before each run):What
vexdoes. Two tests over the same table, each with the work file in the project root and one directory above it. Both are red onmainand green here.The unit test (core
vex/discover/golang.rs), onmain:The CLI test (
e2e_vex_lockfile,vex --offlineover a hostedreplacewith its record in the ledger), with the loader ofmain:(That run printed "go builds the pin" where the head prints "want"; the rows are the same.) Where
vexdoes not attest it exits 1 withpackage_not_foundfor the module and writes no document.The fix
One rule, go's:
vendor::go_workspace::sum_file(work_file)is the work file's name with.sumappended. Its three readers go by it:load_file), whichvexand hosted mode read the workspace through;go_sum_scope), which had the rule inline;go.work.sumbeside the work file.The contract already says it: "The sum files are the ones go reads".
Tests
vex::discover::golang::tests::a_named_gowork_reads_its_own_sum_file(unit): five rows by two places for the work file.golang::golang_named_gowork_reads_its_own_sum_file(CLI,e2e_vex_lockfile): the same ten cells through the binary. A row that goes the right way is held to its whole shape (the statement, or the skip and its code).What the review found
An independent review by a subagent given the diff and the issue, not my conclusions:
/code-review high, then its own probes and mutants in a worktree of its own, with go 1.24.7.GOWORKnamingci.work, naming ago.workelsewhere, and unset; no reader was missed...segments are kept as go keeps them; a symlinked work file's sum file is the one beside the link, as for go; a trailing separator is refused by go and makes the workspace invalid here; a non-UTF-8 name keeps its bytes.GOWORKnames (thevexside does). Read, not run.go.work.sum": a doc in the discovery, and the contract.Deleted
The crawler's inline copy of the rule, and the loader's wrong one.
Behavior change
Only under a
GOWORKthat names a work file not calledgo.work:vexreads<file>.sumand no longer reads ago.work.sumbeside it. A hosted Go pin whose zip line go wrote to<file>.sumattests (it was skipped, exit 1); ago.work.sumgo ignores no longer decides anything; a<file>.sumgo cannot parse stops the attestation (it was attested).scan's crawl already read<file>.sum.For a work file named
go.work, wherever it is, the file read is the same as before. No JSON shape, flag, code or exit-code meaning is new.Risk
Small. The changed path is one file name, and it differs from
mainonly for a work file not namedgo.work. A project that keepsgo.work.sumbeside aci.workand relied onvexreading it gets the answer go gives.Not in this PR
CLI_CONTRACT.mdsays "with ago.work, itsgo.work.sumand eachusemember'sgo.sum". It should say "its sum file (go.work.sum, or<file>.sumfor aGOWORKnaming another file)". Fix agent mode reading gemrc gem directories Ruby does not load (#2317) #2459, an openagent/PR, changes that file, and the routine does not edit a file another agent's open PR holds, so the sentence waits for it.rollbackandremovelook for the Socket module's sum lines ingo.sumandgo.work.sum. Lines go appended to aci.work.sumstay (read, not run); go tolerates them.Verification
Local, on 014ef71 (go 1.24.7):
cargo clippy --locked --workspace --all-features -- -D warnings: clean (run on 53b6aa3; only a doc comment and test text changed since).patch::redirect::upstreamwhile the reviewer's builds ran beside it, so 8,946 passed with those three modules skipped, and their 52 passed on their own afterwards.e2e_vex_lockfile(360),vex,e2e_vex,e2e_golang,e2e_golang_build,e2e_golang_hosted_build,e2e_golang_hosted_state,e2e_golang_workspace_build,e2e_vendor_golang_build,hosted_memory_engine,hosted_memory_parity,scan,in_process_scanandcli. The Go build suites ran with the real toolchain.Windows and macOS were not run. No
cfg(windows)orcfg(unix)code changed.CI on 014ef71 at 19:20Z: 55 checks pass, 71 are skipped (by a run the push started while the PR was a draft, and by path), none failed. Five jobs failed on the first attempt without reaching a test result (
go / bazel (9.3.2, e9),pypi / bazel (8.8.2, e9),pypi / bazel (9.3.2, e9),coverage (1)ande2e-build (ubuntu-latest)): each ended ten minutes to the second after it started with "The self-hosted runner lost communication with the server" and no failed step. I re-ran the failed jobs of the three workflow runs once, and all five passed.Cursor Bugbot reviewed 014ef71 and found no issues.
git diff --stat: 5 files, +204 −19. Production +16 −10 (vendor/go_workspace.rs,crawlers/go_crawler.rs,hosted/engine.rs), of which the helper and its doc are 10 lines; docs invex/discover/golang.rs+11 −8. Tests +177 −1.Generated by Claude Code