Skip to content

Fix vendored Maven reactor tests on Maven 4 (#2158) - #2225

Open
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
mainfrom
agent/fix-maven4-vendored-reactor
Open

Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
mainfrom
agent/fix-maven4-vendored-reactor

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-fable-5-2

Fixes #2158

Summary

Three nightly tests fail on the two Maven 4.0.0-rc-7 legs. Each asserts
something that stopped holding when vendored pins became selection-based
(#2100). None of them shows a defect in the CLI, so this PR changes two test
files and no product code.

Test What it asserted What happens on Maven 4 Now asserts
e2e_vendor_jvm_build: maven_reactor_implicit_subprojects_warm_and_offline_build_and_revert the root pom of a model 4.1.0 project is pinned, and vex attests not_affected a Maven 4 selection is not modelled, so no pin is written; vex withholds its statement no pin in the root, the fallback repository is there, the run reports selection_undetermined, both modules still build the patched jar, vex exits 1 and names the cause
e2e_vendor_maven_build: mediation::maven_vendored_reactor_pins_each_module_at_the_version_it_selects and mediation::maven_vendored_parent_pin_goes_when_a_module_moves_on_and_reverts_clean .mvn is gone after vendor --revert Maven 4 keeps its project-local repository in .mvn/target/, which the revert rightly leaves on Maven 4, nothing but target is left under .mvn; on Maven 3, .mvn is gone as before

Root cause

  • No root pin. CLI_CONTRACT.md says a selection is not certain on a
    Maven 4 build (a wrapper that pins Maven 4, or a model 4.1.0 pom) and that
    no pin is written where it is not certain. The fixture's root is a model
    4.1.0 pom, so the planner writes the fallback repository there and reports
    vendor_jvm_degraded / selection_undetermined. Module a declares
    the base version itself and is rewritten where it stands, and b follows
    a. The test still proves the point of the fixture: the warm build and
    the fresh offline checkout both put the patched jar on the classpath of
    a and b.
  • vex withholds. The contract also says vex attests a vendored
    Maven patch only when every module that resolves the base version, or
    whose selection cannot be told, is wired. The root and b carry neither a
    pin nor a declaration, so the statement is withheld
    (vendor_jvm_shape_unsupported, exit 1). That is a missed attestation,
    never a false one.
  • .mvn/target. The other reactor tests of e2e_vendor_jvm_build
    already clear this directory before they assert; the two mediation tests
    added with the selection work did not.

Evidence

Reproduced on origin/main with Maven 4.0.0-rc-7 (installed by
scripts/install-maven.sh): the same three tests fail with the same
messages as the nightly run.

With this PR:

Command Maven 4.0.0-rc-7 Maven 3.9.16
cargo test -p socket-patch-cli --test e2e_vendor_jvm_build -- --ignored maven_reactor 3 passed 3 passed (the implicit test skips itself below Maven 4)
cargo test -p socket-patch-cli --test e2e_vendor_maven_build -- --ignored 6 passed 6 passed

Push CI does not run these legs (they are nightly), so the checks on this PR
do not exercise the change. The next scheduled run does.

rustfmt --check is clean on both files. cargo clippy --all-targets
fails on origin/main in the shared test helpers; the two files report the
same single finding before and after this change. CI's clippy job does not
lint test targets.

Review

/code-review high found no bug and two nits:

  • Fixed in the second commit: the withheld warning was read as
    warnings[0]; it is now found by its code.
  • Not fixed: with the not_affected assertion gone, no real-Maven-4 test
    shows vex attesting on a model 4.1.0 reactor. The only shape that
    attests there today is one where every module, the aggregator root
    included, declares the patched artifact itself, which is not the shape
    this fixture is about. See the question below.

For a maintainer to decide

Since the selection work, a vendored model 4.1.0 reactor gets a pin only
where a module declares the base version itself, and vex cannot attest it
unless every module does. A module that reaches the artifact only through
another library stays unpatched (reported as selection_undetermined).
That follows the contract as written and errs on the safe side. If Maven 4
reactors should be pinned and attested again, the selection reader has to
model Maven 4's dependency management; that is a product change and is not
part of this PR.

https://claude.ai/code/session_011f9aeNu6BLYqF4rU1ZmoTb


Generated by Claude Code

Refs #2158.

Assisted-by: Claude Code:claude-fable-5-2
Three nightly tests failed on the Maven 4.0.0-rc-7 legs. Each asserted
something that stopped holding when pins became selection-based, and
none of them shows a defect in the CLI.

The implicit-subprojects test expected a pin in the root pom of a
model 4.1.0 project. A Maven 4 selection is not modelled, so no pin
is written there: the root takes the fallback repository only, the
run reports selection_undetermined, and the module that declares the
base version is rewritten where it stands. Both modules still build
the patched jar, warm and from a fresh offline checkout. vex
withholds its statement for the same reason, as the contract says,
so the test now asserts that outcome instead of not_affected.

Two mediation tests asserted that .mvn is gone after a revert. Maven
4 keeps its project-local repository in .mvn/target, which is the
build's and which the revert leaves. They now assert that nothing
else is left under .mvn, and still that .mvn is gone on Maven 3.

Fixes #2158.

Assisted-by: Claude Code:claude-fable-5-2
The implicit-subprojects test read warnings[0], which would fail on
any unrelated advisory that sorts ahead of the JVM one.

Refs #2158.

Assisted-by: Claude Code:claude-fable-5-2
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 24, 2026 21:48
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

bugbot run


Generated by Claude Code

@cursor

cursor Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Test-only assertion updates for documented Maven 4 vendoring/vex behavior; no runtime or CLI changes.

Overview
Nightlies were failing because two e2e suites still assumed pre-selection vendoring on Maven 4. This PR only updates tests—no product code.

In maven_reactor_implicit_subprojects_warm_and_offline_build_and_revert, expectations now match the contract: the root gets a fallback repository but no version pin (selection not modelled), the vendor run reports selection_undetermined, and vex withholds attestation—exit 1, no_applicable_patches, vendor_jvm_shape_unsupported, and no VEX file—while warm/offline builds still resolve the patched jar in discovered modules.

In e2e_vendor_maven_build, a shared assert_no_vendor_residue_in_mvn replaces a blanket “.mvn must be gone” after vendor --revert: Maven 3 still requires no .mvn; Maven 4 may keep .mvn/target/ as the project-local repo.

Reviewed by Cursor Bugbot for commit e086671. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 e086671. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nightly: maven_reactor_implicit_subprojects fails on Maven 4.0.0-rc-7 ("the root is pinned") since 4fe0859

2 participants