Repository navigation
Pin a Maven patch only where Maven selects its base version - #2100
Conversation
A hosted or vendored scan could change which version of a dependency a Maven build resolves and exit 0 without saying so. The candidates were a superset of the build (every version any pom of the graph declares, and every cached version behind a range or an undefined property), and a <dependencyManagement> pin makes every occurrence of the artifact one version. A patch for a version that lost mediation, was excluded, or was only cached by another project therefore replaced the version that won: a downgrade when the winner was newer, an upgrade when it was older. A pin is now written only where Maven selects the patch's base version already. - crawlers/maven_selection reads what Maven selects in each module from the project's poms and the poms the local repository holds, without running Maven: own and inherited dependencies, compile/runtime non-optional transitives, exclusions, declared or managed versions (the module's management over every transitive one), ranges through the cached maven-metadata files, and mediation with parents settled first (nearest wins, first declared on a tie, what a losing version depends on leaves the graph). formats/maven/version holds Maven's version order and range grammar. - Every answer is certain or not. A missing pom, a property that is undefined or that a profile redefines, a profile with dependencies or management, a relocation, a cycle, an unread module and a Maven 4 build are not certain, and nothing is pinned on them. - Hosted: redirect_maven_version_not_selected when the build selects another version (or none), redirect_maven_selection_undetermined when it cannot be told and no declaration names the base version. - Vendored: vendor_maven_version_not_selected, a skip decided before any download; the planner pins a local root only when every module under it selects the base version or does not resolve the artifact, and leaves a pin alone when it cannot tell. vendor --check accepts either answer. - A declaration that already names the base version is rewritten under any answer: that replaces a version where it stands. - Agent mode patches cached jars in place and is unchanged, except that a version directory holding a pom and no artifact is left out of an agent scan instead of failing it as a targeted patch not found on disk. - The nothing_wired refusal no longer says Maven keeps resolving the base version. Outcomes that change: the six shapes above exit 0 with nothing written and one line naming the version Maven selects; vendored used to exit 1 on a project that declares another version itself; agent mode used to exit 1 on a pom-only version; a transitive-only dependency of a project whose poms are not in the local repository is reported as undetermined instead of pinned. Refs #595, #882. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The version_not_selected and selection_undetermined warnings lost the line continuation in their format strings and carried a run of spaces in the middle of the sentence. The planner test now compares the whole warning. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Maven builds a pom that declares one dependency twice from its last declaration, in the place of the first (and warns). The selection model kept the first, which could call a version selected that Maven does not select. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A vendored pin was only ever written in a local root pom, which every module of the reactor inherits. Where the modules select different versions of one artifact, a root pin moved the ones that select another version (5.1.0), or no pin was written at all and a module that selects the base version only through other artifacts stayed unpatched (the previous commit). The pin now goes in the highest pom whose modules all select the patch's base version or do not resolve the artifact: the local root when every module that inherits it agrees, else the poms below it that do, down to one module's own pom.xml. A module that resolves another version is never reached by a pin, and patches for two versions of one artifact are each pinned in the modules that select them. A pin an earlier run wrote in a pom that would move a module is taken out and written where it belongs. A pom that manages the artifact itself takes no pin, and a module whose selection is not certain gets no new pin and keeps the one it has. The fallback repository stays in each local root. A literal <base>-socket.<hex8> of another patch of the same artifact is no longer reported as conflicting_literal_version when a second patch is planned, and the version_not_selected degraded reason is gone: a sibling that selects another version is not a degradation. Reactors whose modules agree and single-module projects are planned byte for byte as before. Refs #595, #882. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Review fixes for the Maven selection work.
Determinism. Where the pins go is decided when a patch is first wired,
and the committed poms are the record. A later plan over poms that
already wire the patch keeps every pin and adds none, whatever the local
repository of that machine can tell, so one checkout plans the same
everywhere and a re-run is a no-op. `vendor --check` no longer judges
where a pin belongs: it takes every pin, and every absence of one, as
committed. Before, a project vendored where nothing could be told (the
declaration rewritten, no pin) drifted in `--check` and was rewritten by
a re-scan on a machine with a full local repository.
- A held pom still moves an older patch's pin to the new suffix: the
tree the old suffix names is replaced by the same run.
- A plan left unwired because one module's answer holds the root back is
the vendor_maven_selection_undetermined skip, whatever the other
modules select. It used to be the nothing_wired refusal.
- A pin for a version the build no longer selects is taken out of the
poms when the patch is skipped as not selected, and the skip says so.
It used to stay and keep forcing that version.
- A range is resolved only on the version lists cached for the
repositories the module's poms declare (and central and local). A list
cached for any other repository id leaves it undetermined.
- The undetermined line names the remedy that fits its cause: resolving
the project only when something is missing from the local repository.
- Property lookup goes through the shared lookup_property, so a bare
${version} reads a property of that name before the project's own.
- One artifact check for Coursier and Maven directories; the agent scan
filters pom-only versions through the crawler, off the async runtime.
- The selection is read off the async runtime, kept between the stages
and patches of one run while every file it read is unchanged, and not
read at all for a hosted reactor root, which is refused whole.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Brings in the determinism rule (pins stay where they were committed, on every machine), the suffix update of a held pin, the undetermined skip, the removal of a pin the build no longer selects, and the model fixes. With per-module placement the rule reads: a patch the poms already wire keeps every pin in every pom and gets no new one, unless a pin is certain to move a module, in which case the pins are placed afresh. The test for a plan one undetermined module holds back now uses a parent that resolves the artifact itself, since a sibling that selects the base version gets a pin of its own here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR SummaryMedium Risk Overview Hosted scan loads selection once on a blocking task and passes it into CLI contract documents the selection rules and codes; e2e mediation suites ( Reviewed by Cursor Bugbot for commit 82d9239. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 82d9239. Configure here.
Review fixes for the per-module placement of vendored Maven pins. - A pom was held (its pin kept) whenever any module under it could not be told, even when another module under it was certain to resolve another version. A pin that moves a module now goes whatever its siblings are; only a pom with doubt and no dissent is held, and a root a declaration rules out is never held. - vex attested a patch as soon as any pom wired it. A pin can sit in one module's pom, so the patch is now attested only when every module that resolves the base version (or may: its selection cannot be told) is reached by a pin, by the project's own management at the patched version, or by a declaration at it. `vendor --check` does not ask this. - A pin moved out of a pom carries the record of the section the first run created for it, so the revert takes the empty shell out again and restores the pom byte for byte. - A parent pom that resolves the base version itself above a module that resolves another cannot be pinned without moving that module, and Maven has no management that reaches a parent and not its children. It takes no pin and the plan says so (pin_would_move_module); when it is the only pom that selects the base version the patch is the vendor_maven_pin_would_move_module skip instead of nothing_wired. - A sibling that declares another version itself is no conflicting_literal_version once the selection says it resolves that version. - Undetermined modules are reported in one line, naming the first and counting the rest. - A root a declaration rules out no longer keeps the modules below it from their pins: it is descended like a root with a dissenting module. - A plan made without a selection keeps the pins the poms already hold, in whichever pom they are, instead of pulling them up into the roots. - Each module is asked for its selection once per plan and the answer marked up its chain. - Tests: one manifest staging helper, one table for the reactor fixture. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…olds The selection of a project is kept between the calls of one process and was given again while each file it was read from had the same length and modification time. That is not the same as the same content: - a pom rewritten to the same length within one tick of the file system's clock (a few milliseconds on Linux) has both unchanged, so the old selection was returned for the new pom. This is what failed on CI: `a_version_the_build_does_not_select_is_skipped_before_any_download` rewrites the project pom from 1.11.0 to 1.10.0 and asks again at once; - a version list was checked by its directory's length and time, which rewriting a `maven-metadata-*.xml` in place never changes; - a vendored run holds its writes to the project in memory until it commits them, and its readers answer from them: the selection read such a pom, the check looked at the file on disk; - the subprojects Maven 4 finds by listing a directory were not part of the check at all, so one that appeared was not seen. The walk now notes every read it makes of the file system (`Reads`): the path, whether it was a file or a directory listing, and the SHA-256 of the very bytes or entries it went on to use, through the readers the check repeats. A kept selection is given again only when repeating each read returns the same digest, so it cannot be older than the files: a missing file, a listing, and an uncommitted write of the run are reads like any other, and there is no gap between a read and its record. The selection touches the file system only through the walk (a test holds `maven_selection.rs` to that), and the one listing the walk does not note, the scope queue's, asserts it is never made on a noting walk. Reading the noted files again and hashing them costs a fraction of parsing them and walking the graph. Tests, each failing on the old check when run alone: a project pom, a repository pom and a version list rewritten to the same length with no delay and with the modification time put back; a pom, a version list and a discovered subproject that appear; a pom written inside an open group commit and read before it is committed. The selection fixture keeps its own answer, so another test's selection no longer replaces it and hides a stale one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…-module Brings in the selection kept by the content of every read it was made from (a pom rewritten to the same length within one tick of the file system's clock was taken for the old one), which fixes the Linux failure of `a_version_the_build_does_not_select_is_skipped_before_any_download` on this branch. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A range is a hard requirement at any depth: Maven's resolver backtracks to a version inside it even when a plain version sits nearer the root. A range the model could not resolve (its only version list is cached for a repository the build does not declare, such as a settings.xml mirror; it cannot be parsed; or no listed version is in it) became an unread version that only cast doubt when it was no deeper than the winner. A nearer plain version outside the range was then reported as certainly selected, and hosted or vendored mode pinned it through <dependencyManagement>, downgrading what Maven resolves. Mark such edges as hard and make any of them leave the pick undetermined. Also restore the spaces lost in the three unpin messages. Assisted-by: Claude Code:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeRJTv8HGEveVfgkPgS
|
[agent] PR shepherd: review found one silent-downgrade path, fixed in 7795510; one question for the owner before a final brief Fixed (7795510). A range is a hard requirement at any depth: Maven backtracks into it even past a nearer plain version ( Ran: Question ( Please answer and remove Generated by Claude Code |
A version range is a hard requirement at any depth: Maven selects a version inside it even past a nearer plain version. A pom the local repository does not hold may declare such a range, so the nearest version the model reads may not be the one Maven selects. The model counted a missing pom as doubt only for artifacts declared at its depth or deeper and called a nearer version certainly selected, and hosted and vendored mode pinned it. With app -> lib-a -> victim 1.0 and app -> lib-y -> lib-r (not cached) -> victim [2.0,3.0), Maven resolves 2.5 and the pin moved the build to 1.0. A module that resolves through a file the local repository lacks (the pom of an artifact it resolves, a parent pom, an imported BOM, the version list of a range) now never answers "selects the base version", so nothing new is pinned there until the project is resolved. The reason given names the missing file, whatever else is in doubt, so the remedy offered is the one that works. The owner chose this over keeping the narrower rule (the PR shepherd's question on #2100). What stays as it was: - "Selects another version" is still answered. It writes no new pin: the patch is skipped before any download, and a pin of that version already there is taken out. A stale pin that moves the build is worse than a patch not applied, which is the most a hidden range can cost here. - A declaration that names the base version is rewritten where it stands. - The pom of a version that loses mediation casts no doubt. - Causes resolving does not change (a relocation, an undefined property, a profile, a version list cached for a repository the build does not declare) cast doubt only from their depth down. The same range could hide there; closing that costs pins no command can win back, so it is left for a decision of its own. - A range on a module of the reactor with no version list is that module's own doubt only: Maven lists it from the build. A build pinned to a `<base>-socket.<hex8>` copy fetches the copy's pom and never the base version's, so on a fresh machine an earlier vendored pin would have held every later patch of its module back. The base version now reads the copy's pom when its own is not cached. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
[agent] Owner's answer to the missing-pom question: (b). Implemented in 30a07a3. The answer. The owner chose (b) on 2026-11-17: while a pom is missing from the local repository among what a module resolves, nothing new is pinned in that module. What changed. A module that resolves through a file the local repository lacks (an artifact's pom, a parent pom, an imported BOM, the version list of a range) never answers "selects the base version". The scenario from the question is now a test: app → lib-a → victim 1.0, app → lib-y → lib-r with no cached pom is undetermined for victim 1.0, names lib-r, and offers Narrower than the question's wording, on purpose.
Left for the owner (decisions 6 to 8 in the description): the other unread causes (relocation, profile dependencies, undefined property, foreign version lists) still cast doubt only from their depth down; "selects another version" can take out a correct pin if a missing pom hides a range; an artifact published without any pom holds its module back for good. Ran. Core lib 7,818 passed; the 17 Maven-related CLI suites 1,194 passed; the two real-Maven suites 2 and 5 passed (Maven 3.9.16); fmt and clippy clean. The four tests of the new rule fail on the model at 7795510. I removed Generated by Claude Code |
…nside the repository - hosted scan: a failed selection task (panic or cancel) turned into `None`, which the pom rewriter reads as "no selection" and pins unchecked. Map it to `MavenSelection::unavailable`, so the rewriter treats it as undetermined like any other unreadable selection. - `repo_pom` and `listed_versions`: a coordinate with a leading or trailing `.` became a leading `/` (or a trailing one) after the `.` -> `/` mapping, and `PathBuf::join` with an absolute path drops the repository root, so a pom in the local repository could point the read-only walk at any directory. Reject leading/trailing `.` and `:` (a Windows drive) too. Test added. - CLI_CONTRACT: taking out an existing pin of a version Maven does not select is vendored-only; a hosted pin a scan wrote earlier carries no marker and is not re-checked. Assisted-by: Claude Code:claude-opus-5-5
|
[agent] PR shepherd: final review of
Open question for the owner, not blocking: should a later hosted scan find and drop its own earlier pin once the build moves to another version? That would need a marker on hosted pins. It's a follow-up and doesn't block this PR. Verified: Generated by Claude Code |
|
[agent] PR shepherd: review brief for What it does: Risk: Medium. The new model is large (about 1.6k lines) and has to match Maven exactly. Every vendored path fails closed. In hosted mode, an undetermined selection only rewrites a declaration that already names the base version. Look here:
Verified:
Changes I made (
Open questions (follow-ups, not blocking):
Update: the head is now Generated by Claude Code |
Resolve the CLI_CONTRACT.md conflict in the hosted rewriter paragraph: keep main's bun lockfileVersion 3 wording and this branch's Maven version-selection sentence. Assisted-by: Claude Code:claude-opus-5-5
#2100 was squash-merged to main, with two commits this branch never had (the selection failing closed when it is unreadable, and a pom the local repository lacks holding a module's pins back) and the rest of main since. This branch still carried #2100's individual commits as of the point it forked from it (7795510). The tree is main plus this branch's own changes: the three-way merge was taken with that fork point as its base, so what #2100 became on main wins over the copy carried here. The diff against main is the same 66 files and the same line counts as this branch's diff against the fork point. One conflict: a single long line of CLI_CONTRACT.md, where main changed the Bun lock versions and this branch the Maven clauses; both are kept. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Scope of this PR
This PR also carries the per-module pin placement that was #2101. On 2026-11-16 this branch was fast-forwarded to that branch's head (a8d8045), so the selection model, the placement, both rounds of code-review fixes and the selection-cache fix land together and were run through full CI as one change. #2101's description has the placement details: the reactor case (module a patched, module b left on the version it resolves), the
vendor_maven_pin_would_move_moduleskip, VEX withholding unless every module that resolves the base version is wired, and that round's review notes. Please review this PR as the whole change.What was wrong
scan --mode hostedandscan --mode vendoredcould change which version of a dependency a Maven build resolves, exit 0, and say nothing about it. Reproduced with the released 5.1.0 and Maven 3.9.16 on the one live Maven patch (jackson-databind2.7.9.2):.pomin the local repository<exclusions>-excluded[2.9.0,2.9.10]; 2.7.9.2 cached by another projectTwo defects combined. The candidates are a superset of the build (every version any pom of the graph declares, and every cached version behind a range or an undefined property). And a
<dependencyManagement>pin is a force: it makes every occurrence of the artifact that version, so pinning a version that lost mediation replaces the one that won.What changed
The rule now: a patch of
g:a:vis pinned only where Maven selectsvalready. A version no module selects is not part of the build: nothing is written, the run exits 0, and one line names the version Maven selects instead. A patch for the version that is selected is still looked up and applied.crawlers/maven_selection.rs), read per module from the project's poms and the poms the local repository holds; Maven is never run. It follows Maven 3's resolver: own and inherited<dependencies>,compile/runtimenon-optional transitives,<exclusions>, a declared version else the managed one (parent chain, then imported BOMs), the module's management over every transitive version, ranges through the cachedmaven-metadata-*.xml, and mediation with parents settled first (nearest wins, first declared on a tie, what a losing version depends on leaves the graph; ranges are hard requirements). Maven's version order and range grammar are informats/maven/version.rs.redirect_maven_version_not_selected) and writes no new pin when the selection is not certain (redirect_maven_selection_undetermined).vendor_maven_version_not_selected, askippedevent, exit 0). The planner pins a local root only when every module that inherits it selects the base version or does not resolve the artifact;vendor --checkaccepts the pins either answer writes.nothing_wiredrefusal no longer claims that Maven "keeps resolving" the base version (V4).Outcomes that change
nothing_wired) becomes exit 0 with avendor_maven_version_not_selectedskip.mvn -q dependency:resolve, or declare the dep) and exit 0.<dependencyManagement>; now skipped.property_unresolved,conflicting_literal_version, ...) still refuses withnothing_wired.nothing_wiredrefusal, exit 1 (5.1.0 exited 0 with the pin that downgraded B). Pin a vendored Maven patch in the modules that select its version #2101 places the pin in A's pom and exits 0; the two are meant to land together.vendor_maven_selection_undeterminedskip, exit 0, whatever the other modules select.vendor --revertorscan --mode vendored --prune.vendor --revertand a new run.Missing poms: the owner's answer to the PR shepherd's question
The PR shepherd asked whether a pom missing from the local repository below the winning declaration should hold a pin back: it may declare a version range, and a range binds at any depth. The owner answered yes on 2026-11-17 (option b). Commit 30a07a3.
selection_undeterminedskip, exits 0, and names the missing file, so the remedy shown ismvn -q dependency:resolve.a_pom_missing_below_the_winner_leaves_it_undetermined: app → lib-a → victim 1.0, app → lib-y → lib-r with no cached pom. Before: selected, and pinned. Now: undetermined, naming lib-r.<base>-socket.<hex8>copy fetches the copy's pom and never the base version's. The model reads the project without its pins, so on a fresh machine it found no pom for the base version, and with the new rule that would have blocked every later patch in the module. The base version now reads the copy's pom when its own is not cached.Tests
crawlers::maven_selection, 30 tests: each rule above and each source of doubt), the version order and ranges, the reactor planner and the hosted rewriter under a selection, the pre-download refusal.e2eleg (the two Maven suites already run there with Maven 3.9.16):maven_hosted_pins_follow_the_version_maven_selectsine2e_redirect_maven_buildandmaven_vendored_pins_follow_the_version_maven_selectsine2e_vendor_maven_build. Each resolves V1, V2, V4, V6 and V7 with Maven before and after the scan and asserts the resolved jars are identical and the project is byte for byte unchanged; the vendored one also runs the V5 agent scan. Both include the control where the base version is the one selected two levels down: the scan pins it, Maven resolves the patched jar, and the resolved set is the same once the-socket.<hex8>suffix is stripped. The fixture artifacts are generated in the test and served by its own wiremock server; nothing new is fetched from Maven Central or the patch service.What I ran
Locally on macOS (arm64), Maven 3.9.16, JDK 26; every cargo command through the machine-wide lock with
CARGO_INCREMENTAL=0 CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 -j4. After the review fixes, on this branch (82d923985):cargo fmt --all;cargo clippy --locked --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --lib: 7799 passed, 1 failed (production_code_classifies_purls_through_from_purl, a lint on one line of the new crawler helper); fixed, then-- crawlers::: 844 passed. The same suite on the head of Pin a vendored Maven patch in the modules that select its version #2101, which contains this branch: 7802 passed, 0 failed.cargo test -p socket-patch-cli --no-fail-fast --test vendor_jvm_cli --test contract_gradle_codes --test maven_sidecar_cli --test in_process_scan --test in_process_get_hosted_ecosystems --test in_process_remote_ecosystems_apply --test in_process_rollback_all_ecosystems --test e2e_maven --test scan --test rollback --test vendor --test in_process_vendor --test e2e_vex_vendor --test e2e_vex_redirect --test e2e_vex_lockfile --test cli_scan_silent --test ecosystem_dispatch_e2e: all passed.cargo test -p socket-patch-cli --no-fail-fast --test e2e_redirect_maven_build --test e2e_vendor_maven_build -- --ignored(real Maven): 2 and 5 passed.Not run: the whole workspace test suite, the docker suites, Windows and Linux, and Maven lines other than 3.9.16 (the nightly tier runs these suites on 3.6.3, 3.8.9 and 4.0.0-rc-7).
For 30a07a3, same machine and settings:
cargo fmt --all --check;cargo clippy --locked --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --lib: 7,818 passed, 0 failed.--ignored(Maven 3.9.16): 2 and 5 passed.a_missing_pom_leaves_no_base_version_selected,a_pom_missing_below_the_winner_leaves_it_undetermined,each_file_the_local_repository_lacks_holds_the_base_version_back,a_base_version_only_its_patched_copy_is_cached_for_reads_the_copy.a_parent_on_no_registry_is_read_from_the_local_repositorypins a transitivecommons-text, and its local repository had no pom forcommons-lang3, whichcommons-textdepends on.Review findings (
/code-review high) and what was donenothing_wired: confirmed, fixed. A plan left unwired only because a module's answer holds the root back is the undetermined skip; the line names the module. Test:a_plan_held_back_by_one_undetermined_module_is_a_skip.a_held_pin_moves_to_the_suffix_of_a_superseding_patch.vendor --checkand a re-scan depended on the checking machine's~/.m2: confirmed, fixed. Rule: pin placement is decided when a patch is first wired and the committed poms are its record. A later plan over poms that already wire the patch keeps every pin and adds none;vendor --checktakes every pin, and every absence of one, as committed and never reads the local repository to judge placement. Only two things change a wired pom: a suffix update for a superseding patch (read from the poms alone) and the removal of a pin that is certain to move a module, which no correct run leaves. Tests:a_wired_patch_keeps_its_pins_on_every_machineand the real-Mavenmaven_vendored_wiring_checks_clean_and_stays_put_on_any_machine(vendored against a cold local repository, then checked, re-run and built against a warm one).unpin_plan_takes_the_pins_of_a_version_outand the real-Mavenmaven_vendored_pin_is_removed_when_the_build_selects_another_version(Maven resolves the forced version before, the selected one after, and the revert restores the user's pom byte for byte).maven-metadata-*.xml: confirmed, fixed. Only the lists of repositories the module's poms declare (pluscentralandlocal) count; a list cached for any other id leaves the range undetermined. Test:a_version_list_of_a_repository_the_build_does_not_declare_resolves_no_range.the_remedy_fits_the_cause.${version}read from the model first: confirmed, fixed. The model usesformats::maven::lookup_property; only the profile-doubt check is local. Test:a_bare_model_reference_reads_a_property_of_that_name_first.pom_only_version_dirduplicatedholds_artifact, applied in the CLI on the runtime: confirmed, fixed. Oneholds_artifactwith one list; the agent scan filters throughMavenCrawler::with_an_artifacton the walk pool. Left as is, on purpose:applyandgetwith an explicit target keep their documented "matched no installed package" answer for a version with no jar, since the user named it.MavenSelection::ofkeeps its last answer while every file it read (project poms and config, each repository pom looked up, each version list) is unchanged; the vendored gate and the hosted scan read it throughspawn_blocking;vendor --checkno longer reads it; hosted does not read it for a reactor root it refuses anyway.After CI (Linux
coverage (1), a real failure): the kept selection was checked by each file's length and modification time, so a pom rewritten to the same length within one tick of the file system clock was taken for the old one (and a version list rewritten in place, an uncommitted write of a vendored run, and a subproject Maven 4 discovers were not checked at all). Fixed in cf3353c: the walk notes every read it makes (the SHA-256 of the bytes or directory entries it went on to use, through the run's own readers), and a kept selection is given again only when repeating each read returns the same digest. Tests, each failing on the old check:a_file_rewritten_to_the_same_length_is_read_again,a_file_that_appears_is_read,a_write_the_run_has_not_committed_is_read.Reviews of 30a07a3 (
/code-review high, two rounds, nine findings each)Fixed:
each_file_the_local_repository_lacks_holds_the_base_version_back.vexwithhold a wired patch because of a sibling that declares another version. Only "selects the base version" is withheld now.a_base_version_only_its_patched_copy_is_cached_for_reads_the_copy.mvn dependency:resolvefills. It is that module's own doubt, as before. Test:a_range_on_a_module_of_the_reactor_is_no_gap_in_the_local_repository.CLI_CONTRACT.md,docs/ecosystems.md,docs/design/maven-vendoring.mdand the module doc.Tried and taken out:
<artifact>-<version>.pom.lastUpdated, and modelled that. Round 2 pointed out the note is specific to the machine: a private repository that answers 404 without credentials leaves the same note, and a pin made on it would be wrong where the pom is visible. The note is not read; see "Known gaps".Not fixed:
Decisions for the owner
Declarations that name the base version are rewritten even when the selection is not certain, whether they sit in
<dependencies>or in the project's own<dependencyManagement>. Replacing a version where it stands cannot change what resolves, so I did not limit it to direct declarations. Only new pins need a certain answer. Say so if a managed declaration should wait for a certain answer too.A version selected as the highest of a range is not pinned (reported as undetermined): a pin would freeze the range at that version.
Maven 4: with a wrapper that pins Maven 4, or a model 4.1.0 pom, nothing is pinned on the model (its transitive dependency management differs). Without a wrapper the model assumes Maven 3.
Vendored pins that 5.1.0 wrote in a build that does not select their version are now removed by the next vendored run (finding 5). Hosted pins carry no mark that tells them from the project's own management, so the model reads them as management and cannot find its own bad ones.
Pins are never added to an already wired patch (finding 3). That is what makes a re-run a no-op on every machine, at the price that a module left unpinned by a first run on an unresolved project stays unpinned until
vendor --revertand a new run.Causes that resolving the project does not change still cast doubt only from their depth down: a relocation, a profile that declares dependencies, an undefined property, a version list cached for a repository the build does not declare. The argument you accepted for missing poms applies to them as well. I left them because no command the user can run lifts the hold, and profiles that declare dependencies are common in published poms, so the cost in pins could be large. Say so if they should hold a module back too; it is a few lines.
A module with a missing file still answers "selects another version", and that answer takes out a pin of the base version. If the missing pom hides a range that selects the base version after all, a correct pin is removed and the patch is not applied until the next run on a resolved machine. The other choice is to keep such pins until the project is resolved, which also keeps a stale pin that is moving the build. I ranked a build moved by a stale pin above a patch not applied.
An artifact published without any pom holds its module back for good (see "Known gaps"). The alternative needs a way to tell "no repository has a pom" from "this machine could not see it".
Known gaps
vendor --checkreports the entry as no longer wired) untilvendor --revertorscan --mode vendored --prune.pom.xmland a Gradle build is not skipped as a whole (the Gradle half may still resolve the base version); only the planner's Maven pins follow the selection there.${property}versions.mvn dependency:resolvedoes not change that. Declaring the patched artifact at the base version in the module's pom is the way through, and the line says so. Rare with artifacts from Maven Central, which requires a pom.Refs #595, #882.
Generated by Claude Code