Repository navigation
Commit b69fc03
Read the governing go.work in Go discovery (#2011)
* Read the governing go.work in Go discovery
Go discovery read only a go.work at the project root and only members
inside the root. With GOWORK unset it ignored an ancestor go.work and read
the root go.mod in module mode, so in a member of a parent workspace it
could attest a go.mod replace that the workspace overrides, doesn't `use`,
or makes inert by version selection. Hosted and vendored modes resolve the
workspace go itself would use and refuse to write such a replace.
On disk, discovery now loads the governing workspace with the same
go_workspace::load_with loader hosted mode uses: GOWORK (environment, then
the go env -w file), else the nearest go.work at or above the root, with
`use` members anywhere. Out-of-root members' requires and replaces now
count toward selection and conflicts. In-root members are still re-read
through the view, so recognition and parse diagnostics stay the same.
A wired Socket replace that this workspace keeps from the build, at
exactly the points where hosted mode's host_conflict check refuses, stays a
ref (list, rollback and remove still find it) but is marked unattested
with the new UnattestedKind::GoWorkspaceOverride. The same applies to a
replace in the root go.work while GOWORK makes go build another one.
vex_sources reports these under the existing `go_workspace_override`
reason, the one vex's own go.mod gate already uses. A replace that
workspace selection makes inert is still diagnosed, as in module mode.
A GOWORK that go rejects still withholds every ref as patched_ref_invalid.
In memory there is no directory to search from and no environment the
project builds under. The root go.work and its in-root members are the
workspace there, as the in-memory hosted engine reads them, and the same
conflict gate applies. GOWORK keeps its old effect in memory and GOFLAGS
is not read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Keep Go replaces the workspace ignores even when they look inert
Version-selection inertness in replaced_purl, and the hosted selection
checks, ran before Workspace::bypass. A Socket replace that the
governing go.work also refuses (not used, overridden by a go.work
replace, member conflict) was dropped as inert with a diagnostic
instead of being kept as a GoWorkspaceOverride ref, so list, rollback
and remove could not find wiring that re-running scan or vendor would
never clear. Compute the bypass first and skip the inertness checks for
a bypassed replace; it stays a ref and is reported unattested.
Found by Cursor Bugbot on #2011.
Co-Authored-By: Claude <noreply@anthropic.com>
* Address code review findings on Go workspace discovery
This fixes the confirmed /code-review high findings on #2011. Each fix
has a test that fails on the previous commit.
- A Go workspace mark now applies to one file only. The new
UnattestedKind::file_scoped is true only for GoWorkspaceOverride.
vex_sources drops the bypassed ref from the candidate's basis and
vetoes the patch only when no live ref of it remains. wiring_conflicts
ignores bypassed refs. So a root go.work replace that go never reads no
longer withholds the root go.mod's mirror of it. A leftover member pin
that Socket's own go.work replace overrides no longer turns into a
wiring conflict that also withholds the go.work patch, which is what
vex.rs's WorkHosted exemption intends.
- A replace of a module that is itself a `use` member is diagnosed as
inert again, both on disk and in memory, hosted and vendored. This
check now runs before the workspace bypass.
- SumPins now also reads the sum files the loader already read: the
governing go.work.sum and each out-of-root member's go.sum. They are
used only when they lie inside the git repository.
- In memory, workspace conflicts are evaluated in
go_workspace::PathSpace::Memory. Paths are compared lexically against
the view's files and never against the filesystem or the working
directory. conflict/work_conflict delegate to the new *_in variants,
so disk behavior is unchanged.
- The snapshot probe list is now built by one shared helper
(workspace_probes), spelled the way resolve_with spells it.
- A root go.work that go doesn't read is no longer judged unparseable,
and its wiring stays an unattested ref.
- The go_workspace_override omission phrase now covers every case.
- read_loaded_workspace uses members_within. The view re-reads only the
in-root members' go.mod, which recognition and parse diagnostics need.
The duplicate go.sum and go.work.sum reads are gone.
- Tests that use a nested project now create a .git, so they keep
working once reads are bounded to the repository root (#2025).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Keep a root go.mod pin of another patch a Go wiring conflict
2984629 dropped every workspace-bypassed ref from wiring_conflicts, so a
leftover member pin that Socket's go.work replace overrides would not
withhold the go.work patch. That also caught the root go.mod. A
GOWORK=off build from the root reads the root go.mod, so a different
patch there still disagrees with go.work about what the build links.
The behavior is the same reasoning ReplaceHost::mirrors_root_go_mod
uses. e2e_vex_lockfile golang_go_mod_and_go_work_disagreeing_attest_neither
went red in coverage (2): it got go_workspace_override plus
go_version_not_selected skips, not one wiring_conflict skip.
Count bypassed refs in the root go.mod as wiring again. Member go.mod
pins are still exempt, as a_bypassed_leftover_pin_is_no_wiring_conflict
requires.
Co-Authored-By: Claude <noreply@anthropic.com>
* Keep inert Go member replaces as refs; recognize stale sums
Second review round on Go workspace discovery.
- A Socket replace of a module that is itself a `use` member (every
replace of it is inert, and the writers refuse it with
`WorkspaceConflict::MainModule`, which a re-run never clears) was
dropped with a diagnostic, so rollback, remove and list lost wiring
still in the file. It stays a ref, marked `GoWorkspaceOverride`
with the same "is inert" detail (owner decision 4).
- go.sum / member sums / go.work.sum were read only when a hosted ref
existed, so a sum left by a reverted patch was no longer recognized
and a dead ledger claim could be re-derived from its raw text
(rule 11). They are recognized either way.
- The plan both attested a purl (the live go.work patch) and reported
it skipped for a lockfile-only candidate whose only ref is a stale,
bypassed leftover pin of another patch. That candidate is now dropped
with a note when another candidate attests the purl.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 6d5fe02 commit b69fc03
7 files changed
Lines changed: 1175 additions & 160 deletions
File tree
- crates
- socket-patch-cli
- src/commands
- socket-patch-core/src
- vendor
- vex/discover
- docs
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
1953 | 1953 | | |
1954 | 1954 | | |
1955 | 1955 | | |
1956 | | - | |
1957 | | - | |
1958 | | - | |
1959 | | - | |
1960 | 1956 | | |
1961 | 1957 | | |
1962 | 1958 | | |
| |||
2125 | 2121 | | |
2126 | 2122 | | |
2127 | 2123 | | |
2128 | | - | |
2129 | | - | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
2130 | 2127 | | |
2131 | 2128 | | |
2132 | 2129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
235 | 241 | | |
236 | 242 | | |
237 | 243 | | |
| |||
268 | 274 | | |
269 | 275 | | |
270 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
271 | 282 | | |
272 | 283 | | |
273 | 284 | | |
| |||
421 | 432 | | |
422 | 433 | | |
423 | 434 | | |
424 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
425 | 448 | | |
426 | | - | |
| 449 | + | |
427 | 450 | | |
428 | 451 | | |
429 | | - | |
430 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
431 | 455 | | |
432 | 456 | | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
433 | 478 | | |
434 | 479 | | |
435 | 480 | | |
| |||
717 | 762 | | |
718 | 763 | | |
719 | 764 | | |
720 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
721 | 774 | | |
722 | 775 | | |
723 | 776 | | |
| |||
743 | 796 | | |
744 | 797 | | |
745 | 798 | | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
746 | 810 | | |
747 | 811 | | |
748 | 812 | | |
| |||
1762 | 1826 | | |
1763 | 1827 | | |
1764 | 1828 | | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
1765 | 1929 | | |
1766 | 1930 | | |
1767 | 1931 | | |
| |||
0 commit comments