|
| 1 | +[agent] 2026-12-01: architecture refactor |
| 2 | + |
| 3 | +**`main`:** 1b3f422. The run started at 02:55Z. |
| 4 | + |
| 5 | +### Chosen |
| 6 | +**#2378 (lead L104): a Maven module that declares the patched dependency with a version range of its own keeps the unpatched jar, and `vex` attests `not_affected`.** It was first in the register's queue (a false VEX statement), it was unclaimed, and one PR of this routine was open (#2390), so the limit of three did not apply. No maintainer has commented on the discussion. #2390 is `ready`, its one Bugbot thread answered and resolved; no person has reviewed it. |
| 7 | + |
| 8 | +The fix sits in core `vendor/jvm/maven_reactor.rs`, which no open `arch-refactor/` or `agent/` PR changes. |
| 9 | + |
| 10 | +### Evidence on `main` |
| 11 | +The built binary over the reactor fixture of `tests/vendor_jvm_cli.rs` (ten pom shapes), then a real Maven 3.9.11 over the same directories: |
| 12 | + |
| 13 | +| Project | `vendor` | `vendor --check` | `vex` | Maven builds | |
| 14 | +|---|---|---|---|---| |
| 15 | +| aggregator, `a` declares `[1.0]` | applied, `range` note | verified | `not_affected` | `a`: `foo-1.0.jar` | |
| 16 | +| `a` `[1.0]`, `b` `1.0` | applied, `range` note | verified | `not_affected` | `a`: `foo-1.0.jar`, `b`: patched | |
| 17 | +| one pom, `[1.0]` | applied, `range` note | verified | `not_affected` | `foo-1.0.jar` | |
| 18 | +| vendored with `a` `1.0`; `b` `[1.0]` added after | | verified | `not_affected` | `b`: `foo-1.0.jar` | |
| 19 | +| the same, `b` `[1.0,2.0)` | | verified | `not_affected` | `b`: `foo-1.0.jar` | |
| 20 | + |
| 21 | +The last two rows are new: the issue ran the hard range at first vendoring only. A range of any kind added under a pinned root is attested, because `covers` took the pin on a module's chain as wiring whatever the module declares itself. |
| 22 | + |
| 23 | +Two more things `main` shows: |
| 24 | +- **It already refuses the same requirement in `<dependencyManagement>`.** One pom that manages `foo` at `[1.0]` with a version-less dependency: `vendor` exits 1, `nothing_wired … (reason: range: pom.xml:4: …)`. So the refusal the issue planned for `<dependencies>` is the existing rule reached by the other spelling. |
| 25 | +- **Hosted mode shares the check.** `HostedReactor::unattestable` calls the same two functions; with `main`'s behavior the new test in core `vex/discover/maven.rs` reads 0 unattested notes for a hosted root pin beside a module that requires `[1.7.36]`. Unit level only: no hosted `scan` was run (L115). |
| 26 | + |
| 27 | +### PR |
| 28 | +**#2393, ready.** One helper, `own_versions` (the versions a module declares itself, from the nearest pom on its chain that declares the artifact), asked in three places: |
| 29 | + |
| 30 | +1. `covers`, which `vex` asks in both modes: a declared range, the base version or an unreadable version may be the base whatever the management says, so the selection decides. A declared suffixed version wires the module; another plain version is wired as the management says, as on `main`. |
| 31 | +2. `rewrite_declarations`: a `<dependencies>` entry that requires exactly the base is recorded as uncertain, as an unresolved property is. `vendor --check` warns `vendor_jvm_unattested`; `vex` withholds without a local repository. |
| 32 | +3. `under`, which places the pins in both modes: a module that requires the base itself has no say. With nothing else to wire, the #513 refusal applies. |
| 33 | + |
| 34 | +5 files, +561 −32: production +90 −31, tests +461, docs +10 −1. Five unit tests and one CLI test, each red on `main`'s behavior. A project `main` vendored with a pin nothing reads keeps it: a re-run exits 0 and writes nothing, the check warns, `vex` withholds, `--revert` restores (run with both binaries). |
| 35 | + |
| 36 | +Verified here on the last commit: CI's clippy; core lib 8669 passed; the suites `vendor_jvm_cli`, `cli`, `in_process_vendor`, `hosted_memory_engine` (and, one commit earlier, `maven_sidecar_cli`, `in_process_scan`, `in_process_get_hosted_ecosystems`). Not run here: the real-Maven suites CI runs. |
| 37 | + |
| 38 | +CI passed on 24df7b5 (126 checks, among them `e2e_redirect_maven_build` and `e2e_vendor_maven_build` on Maven 3.9.16), and Cursor Bugbot found no issues. |
| 39 | + |
| 40 | +Three passes of `/code-review high`: |
| 41 | +1. **A version-less entry replaces the one a module would inherit, and reads the pin.** My helper walked past it to the parent's versioned entry (I had picked that as the cautious reading). A real Maven settled it: parent `[1.0]`, child version-less, root pin: the child builds the patched jar. The same pass found a pin nothing reads one step further, a module whose own `<dependencyManagement>` requires `[1.0]`; it has no say now either. |
| 42 | +2. **A plain other version under a pin must stay wired.** With the first reading, `vex` asked the selection about a module that declares `1.11.0` beside a patch of `1.10.0`, and withheld wherever the selection cannot be read (no local repository, Maven 4). Restored to `main`'s answer. |
| 43 | +3. No defect. Two loose ends taken: a hand-written `[1.0-socket.<hex8>]` is wired by its own declaration, and the design note names what `vendor --check` names. |
| 44 | + |
| 45 | +Left as they are, each with its reason in the PR: an open-range module still has a say in where pins go (L116); `[1.0,1.0]` is not read as `[1.0]` (L117); `vendor --check` does not name a `[1.0]` that only an inheritor's property or a module's own management produces (L118); a hard-range module beside one whose selection cannot be told is refused, not skipped (as an unresolved property is on `main`); the hosted note's advice. |
| 46 | + |
| 47 | +`CLI_CONTRACT.md` is not changed. It lists the causes of `vendor_jvm_unattested` in two places, and #2390 and #2392 both change the file. The phrase to add in both once they merge: "a hard requirement on the base version (`[1.0]`)". |
| 48 | + |
| 49 | +### Leads and issues |
| 50 | +- **L104 / #2378:** confirmed on 1b3f422 (the issue's unit test, the binary, a real Maven) and in PR #2393. |
| 51 | +- **L115, new, to verify:** a hosted `scan` and `vex` over a reactor with a `[v]` module, through the CLI. #2393 covers it with unit tests of the planner and of VEX discovery only. |
| 52 | +- **L116, new, to verify (read, not run):** a module with an open range of its own reads as undetermined and holds the poms above it, although no pin reaches it. The reviewer's shape: the root is itself a module that reaches the artifact transitively, child `a` declares `[1.9,2.0)`; the root is never pinned and `vendor` refuses. |
| 53 | +- **L117, new, to verify (read, not run):** Maven's resolver takes equal inclusive bounds as one version without listing the repositories; core `formats/maven/version.rs` sets `exact()` for the single-version form only, so the selection calls `[1.0,1.0]` a range. `vex` withholds, so the outcome is safe. |
| 54 | +- **L118, new, out of charter:** `vendor --check` prints no `vendor_jvm_unattested` for a `[1.0]` that only an inheriting module's property produces, or one in a module's own `<dependencyManagement>`. `vex` withholds both through the selection, which the check does not read by design. |
| 55 | + |
| 56 | +### Areas examined |
| 57 | +- **A Maven module's own version against a pin**, vendored: ten pom shapes through `vendor`, `vendor --check` and `vex` with `main`'s binary and this branch's, each then built by Maven 3.9.11; four more with both binaries in turn (the upgrade path, and the managed spelling); three inheritance shapes with Maven alone. Hosted: four reactor shapes through the planner and VEX discovery, unit level. |
| 58 | + |
| 59 | +### Lessons |
| 60 | +- **Ask the tool before modelling it, even for the "cautious" reading.** I chose how an inherited entry is read by which answer could not attest falsely. It was wrong the other way: it withheld a patched module and refused a pin that module reads. Three projects and one Maven run settled it in a minute. |
| 61 | +- **A stricter check has a second direction.** Both review defects were over-withholding, in a change made to stop over-attesting. After narrowing "wired", list who was wired before and no longer is, and run each with the selection unavailable. |
| 62 | +- **The same requirement can be spelled in two sections.** `[1.0]` in `<dependencyManagement>` was already refused; in `<dependencies>` it was applied. Run a lead's input in each place a pom can say it. |
| 63 | +- **Hosted and vendored Maven share the planner's checks.** A fix to `covers`, `under` or `rewrite_declarations` lands in both; test both. |
| 64 | + |
| 65 | +<details><summary>How the rows were run</summary> |
| 66 | + |
| 67 | +A throwaway `#[ignore]` test appended to `crates/socket-patch-cli/tests/vendor_jvm_cli.rs` (never committed) builds each row from `fixture(root, Shape::Reactor, &[("foo", FOO_UUID)])` under `$PROBE_DIR/<row>`, writes `m2/org/example/foo/maven-metadata-local.xml` listing `1.0` (what Maven lists for a range), runs `vendor`, `vendor --check` and `vex --product pkg:maven/com.x/agg@1` through the suite's `socket()`, and prints each exit code, event and warning. `PROBE_DIR` must be outside the repository: under `target/` the run fails `vendor_artifact_gitignored`. For another binary, build the command with `hermetic::command(<path>)` and the suite's `prebuilt_common::prepare_command`. |
| 68 | + |
| 69 | +To run a test binary against `main`'s CLI without a rebuild: copy `main`'s `target/debug/socket-patch` aside, later copy it back over `target/debug/socket-patch`, and run `target/debug/deps/vendor_jvm_cli-<hash> <test>` directly. |
| 70 | + |
| 71 | +`mvncp.sh <rows dir>`: what a real Maven puts on each module's classpath. Warm one repository first (`mvn -q -B -Dmaven.repo.local=<warm> dependency:build-classpath` over an empty pom; Central answered on the first try this run). |
| 72 | + |
| 73 | +```bash |
| 74 | +#!/bin/bash |
| 75 | +for row in "$1"/*/; do |
| 76 | + rm -rf "$row/repo"; cp -r <warm> "$row/repo"; cp -r "$row/m2/." "$row/repo/" |
| 77 | + ( cd "$row/proj" && find . -name cp.txt -delete |
| 78 | + mvn -q -B -o -Dmaven.repo.local="$row/repo" dependency:build-classpath -Dmdep.outputFile=cp.txt > "$row/mvn.log" 2>&1 |
| 79 | + rc=$?; out="" |
| 80 | + for f in $(find . -name cp.txt | sort); do |
| 81 | + out="$out $(dirname $f | sed 's|^\./||; s|^\.$|root|'):$(tr ':' '\n' < $f | grep -o 'foo-[^/]*\.jar' | tr '\n' ',' | sed 's/,$//')" |
| 82 | + done |
| 83 | + printf '%-14s mvn exit %s %s\n' "$(basename $row)" "$rc" "$out" ) |
| 84 | +done |
| 85 | +``` |
| 86 | + |
| 87 | +The inheritance shapes: take a vendored control (root pinned, `a` rewritten), add `<dependencies>` with `foo` at `[1.0]` (or `1.0`) to the root, and give `a` a version-less entry, or none. Maven 3.9.11: with none, `a` builds `foo-1.0.jar`; with a version-less entry, `foo-1.0-socket.1d3c1fd2.jar`. |
| 88 | + |
| 89 | +Main's behavior for the unit tests, in one build: guard each of the three call sites with `std::env::var_os("MUT_MAIN")` and run the test binary with and without it. |
| 90 | + |
| 91 | +</details> |
| 92 | + |
| 93 | +### Needs a person |
| 94 | +- **Review #2393 and #2390.** #2393 changes what `vex` says for Maven reactors in vendored and hosted mode, and makes `vendor` refuse (exit 1) where it wrote a pin nothing reads. |
| 95 | +- **One answer #2393 does not need but asks:** `[1.0]` names one version, so it could be rewritten to `[1.0-socket.<hex8>]`, which would patch the module instead of declining it. |
| 96 | +- **#2381 and #2382 attest a false `not_affected`**, **#2380 breaks a Gradle build** and **#2387 stops a PHP application**; they are next in the queue. |
| 97 | +- #2366, #2347, #2340, #2309, #2277 and #2297 still need an answer. |
0 commit comments