Repository navigation
Fix Maven 4 implicit subprojects in vendor (#622) - #1807
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Maven 4 builds every child directory holding a pom.xml of a 4.1.0 pom-packaged root that lists no <subprojects>. vendor planned such a root as a reactor of one, so the modules that use the patched library kept the base version and a warm ~/.m2 build used Central's unpatched jar, while vendor, vendor --check and vex all reported success. The reactor walk now discovers those subprojects the way Maven 4 does (model version, pom packaging, the maven.project.discoverSubprojects opt-out), and every reactor entry point (plan, check, vex, revert, the not-build-root guard) gets the directory listing it needs. Fixes #622 Assisted-by: Claude Code:claude-opus-5-5
Discovery read each subdirectory's pom.xml to test that it exists. In a git checkout that read went through .git/, which the project reader refuses and records as a read error, so vex and vendor --check would fail on every Maven 4 project that relies on discovery. Test for the pom through the directory listing instead, which lists a refused directory as empty, and share the in-memory listing helper between the gradle and maven test modules. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Discovery lists every child directory to see whether it holds a pom.xml. A directory symlinked outside the checkout, such as a target/ on another disk, was recorded as an escape on that listing alone, so vendor refused an otherwise valid Maven 4 project. The project reader now only peeks at such a directory (files, no subdirectories) without recording the escape. A pom found there still becomes a module, and reading it still refuses the build as one that leaves the checkout. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
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 0889de0. Configure here.
|
Labeled Ready for review by the burn-down agent.
Generated by Claude Code |
Final review briefWhat it does. Fixes #622. Maven 4 (model 4.1.0) builds every direct subdirectory that has a Risk: low–medium. I checked the discovery gate line by line against Maven 4.0.0-rc-7 Look here
Verified
Changes I made: none. Open questions (non-blocking)
Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
main now discovers Maven 4 implicit subprojects by listing directories (#1807), so wired_checked takes a lister. The nothing_wired check passes the same lister the plan used, so it sees the same reactor. Assisted-by: Claude Code:claude-opus-5-5
LLM Description written by Claude Code:claude-opus-5-5
Fixes #622
Summary
socket-patch vendornow plans a Maven 4 implicit-subproject reactor as a reactor. Before, a 4.1.0pom-packaged root with no<subprojects>was planned as a reactor of one. The child module that declares the patched library kept the base version, so a warm~/.m2build used Central's unpatched jar, whilevendor,vendor --checkandvexall reported success.Root cause
Reactor::discover(vendor/jvm/maven_reactor.rs) built the reactor only from declared<modules>/<subprojects>. Maven 4 also discovers subprojects. Checked against the Maven 4.0.0-rc-7 source (DefaultModelBuilder, "subprojects discovery") and realmvn validateruns, the rule is:<modelVersion>, else the POM namespace)pom<subprojects>/<modules>(an empty<subprojects/>and profile-only modules still discover)maven.project.discoverSubprojectsis unset ortrue(JavaBoolean.parseBoolean:noor empty turns it off)When all four hold, every direct subdirectory holding a
pom.xmlis a subproject, hidden directories included, recursively.Change
discovers_subprojectsandimplicit_subprojectsmirror that rule.Reactor::discoveradds the discovered names to the declared module refs, so nested-.mvnrefusals, parent resolution, pins and rewrites all apply unchanged.ProjectReader::list):plan*,unplan,wired*,attestable_checked,contains_module(the not-build-root guard) andexternal_poms_needed. So vendor,--check, vex and revert all see the same reactor.Test evidence
maven_reactor.rs:maven_4_implicit_subprojects_are_planned_as_the_reactor(Vendored Maven 4 reactor with implicit subprojects (model 4.1.0, no <subprojects>) is wired as a single POM, so a warm ~/.m2 builds the unpatched jar while vex attests not_affected #622 tree:asuffixed, root pinned, wired, attestable,ais a module)maven_4_subproject_discovery_follows_maven(hidden dirs, recursion, deeper poms ignored)maven_4_subproject_discovery_is_gated_like_maven(4.0.0, jar or absent packaging, listed, empty list, namespace-only version, the opt-out values)maven_4_subproject_discovery_in_a_git_checkout_stays_readablecargo test -p socket-patch-core --lib vendor::jvm: 246 passed.e2e_vendor_jvm_build::maven_reactor_implicit_subprojects_warm_and_offline_build_and_revert. It runs under the existing--ignored maven_reactorfilter and skips below Maven 4. Locally on real Maven 4.0.0-rc-7 it passes: warm build, modules a and b resolvecommons-text-1.10.0-socket.1d3c1fd2.jar; vexnot_affected;--checkok; fresh offline build patched; revert byte-exact. With discovery forced off it fails:a/pom.xmlkeeps1.10.0. The existingmaven_reactor_vendor_fresh_checkout_offline_build_and_byte_exact_revertalso passes on Maven 4.cargo fmt --all -- --checkandcargo clippy --workspace --all-features -- -D warningsare clean.cargo test -p socket-patch-core -p socket-patch-cli --all-features --lib: cli 936 passed; core 6927 passed, 4 failed. All 4 are untouched permission tests that can't fail as root, which this container runs as:copy_tree::relax_loop_must_not_traverse_symlinked_root,vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry,pypi_poetry::wire_write_failure_...andpypi_requirements::wire_failure_rolls_back_.... The full workspace run (all integration binaries) filled this container's disk, so the integration suites are left to CI.Per-issue checklist:
maven_4_implicit_subprojects_are_planned_as_the_reactorplus the Maven 4 e2e above/code-review high
.git/pom.xmlprobe recorded a reader error (it would break vex and--checkin any git checkout). The probe now goes through the listing, with a regression test.list_ofmoved tojvm::testing.MavenShapeandmaven_scopestill usedeclares_modules. This behavior predates this PR (hosted mode never knew about implicit subprojects), and fixing it needs child directories in the hosted file view.MAVEN_ARGSisn't visible to vendor, which only reads.mvn/maven.config(the same limit as every other property this planner reads).target/) was refused on the probe alone.ProjectReader::listnow peeks at it (files only, no escape recorded). A pom found there is still refused when read. Covered bymaven_4_subproject_discovery_through_an_outbound_symlink, which fails on the previous head.https://claude.ai/code/session_011f9aeRPZFozQNtGWwCm2ks
Generated by Claude Code