Repository navigation
Commit 17393a7
Never let the Maven repository filter refuse a run or fail a build
The filter keeps Maven from asking a Socket repository for anything but
the patched version. It is an extra, and the review found eight ways it
could cost more than that. Each is fixed here; two questions about the
filter's default stay with the owner and change no behaviour.
A run is never refused for the filter:
- A `.mvn/maven.config` that is a symbolic link, or sits in a directory
that does not take the write, could not take the filter's two lines,
and the scan refused every ecosystem where it used to land the pin.
The engine now tells the rewriter that the config cannot be written;
the filter is skipped, the pin lands, and the run says so. A config
that already holds the lines needs no write and gets its files.
- A link or a directory under the name of a pin's filter file is not
read and not written through; that pin lands without a file.
- On a rollback or remove the stripped config was staged with an
unconditional write, so a linked or since-edited config restored
nothing. It is staged only where the flush could write it; otherwise
the lines stay and the restore says which.
- A filter directory that cannot be listed to its end is no empty
directory: nothing in it is deleted, the lines that name it stay, and
the restore says so.
A build is never failed by it:
- A scan emptied the filter file of a repository it took out of the
poms. If the wiring came back by a pom-only revert or a merge before
the next scan, Maven refused the pin. A retired file is now left
exactly as it is: no pom names its repository, so Maven does not read
it, and it is the right file if the wiring returns. With nothing
emptied, the path that repaired an emptied file is gone.
- A filter file is read for what it lists, not compared byte for byte:
a CRLF checkout or an added comment no longer makes every scan report
a rewrite.
Nobody's own filter is switched off without a word:
- A scan that took out the last Socket repository stripped the two
lines even when the user keeps prefix files of their own in the
directory, which are read through those lines. It now leaves them, as
a rollback does, and wherever the config cannot take the write.
- A prefix filter named in the environment of the machine that scans
(`MAVEN_OPTS`, `MAVEN_ARGS`, `JAVA_TOOL_OPTIONS`, `JDK_JAVA_OPTIONS`;
Maven 3.9.9 and 4.0.0-rc-7 honour the property in each) is a conflict
like one in `.mvn/jvm.config`: nothing is written for the filter.
- The run that adds the two lines says what they change for the whole
build: Maven reads prefix files from `.mvn/socket-patch/` only.
One reader lists the filter directory for the engine, the restore and
the vendored eject (hosted mode's own regular files, what else is there,
whether it could be listed), and one test tells a hosted file by its
path. `retire` no longer marks a run for a file the run itself planned
and took back.
Outcome changes: three new warning codes
(`redirect_maven_repository_filter_enabled`,
`redirect_maven_repository_filter_skipped`,
`maven_repository_filter_left`); a scan no longer reports a filter file
as `removed`, and no longer writes one it retires; a hosted scan or a
rollback of a project whose `.mvn/maven.config` is a link now succeeds
where the filter alone made it fail. No exit status is added.
Golden fixtures: the seventeen Maven pom cases that wire a pin and pin
a warning list, and the sbt case whose pom is wired, gain
`redirect_maven_repository_filter_enabled`. No expected file or edit
changes.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>1 parent c14138f commit 17393a7
28 files changed
Lines changed: 1431 additions & 374 deletions
File tree
- crates
- socket-patch-cli
- src/commands
- tests
- socket-patch-core
- src
- formats/maven
- hosted
- patch/redirect
- upstream
- tests/fixtures
- redirect/maven/pom
- classifier-only-transitive-main
- classifier-sources-sibling
- comment-dependency
- commented-repositories
- depmgmt-comment
- maven4-launcher-line-conflict
- maven4-model
- parent-in-checkout
- plugin-dependency
- profile-depmgmt
- profile-repositories
- property-version
- reactor-module-literal
- reactor-root-property
- self-closed-depmgmt
- self-closed-repositories
- sbt/redirect/pom-also-present
- docs
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1801 | 1801 | | |
1802 | 1802 | | |
1803 | 1803 | | |
| 1804 | + | |
1804 | 1805 | | |
1805 | | - | |
| 1806 | + | |
1806 | 1807 | | |
1807 | 1808 | | |
1808 | 1809 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1960 | 1960 | | |
1961 | 1961 | | |
1962 | 1962 | | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
1963 | 2047 | | |
1964 | 2048 | | |
1965 | 2049 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| |||
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
156 | 173 | | |
157 | 174 | | |
158 | 175 | | |
| |||
342 | 359 | | |
343 | 360 | | |
344 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
345 | 371 | | |
346 | 372 | | |
347 | 373 | | |
| |||
351 | 377 | | |
352 | 378 | | |
353 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
354 | 411 | | |
355 | 412 | | |
356 | 413 | | |
| |||
0 commit comments