Skip to content

Touch no file for a Maven dependency that is not wired, and say what the run did - #2165

Open
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
mainfrom
fix/maven-mirror-gate-wording
Open

Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
mainfrom
fix/maven-mirror-gate-wording

Conversation

@mikolalysenko

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

Copy link
Copy Markdown
Collaborator

Follow-up to #2135 (the Maven mirror guard), which merged while these items were still local. Draft.

What was wrong

  1. Two warnings claimed more than is true. redirect_maven_mirror_captures_repository (Do not wire a hosted Maven pin behind a mirror that would take its repository #2135) said pom.xml and .mvn/ were left as they are. The reactor planner's refusal (Patch Maven reactors and ${property} versions in hosted mode #2114: redirect_maven_multimodule_unsupported and the other codes a refused plan is reported under) said the poms and .mvn/ were left as they are. CLI_CONTRACT.md said of both, and of other Maven reason codes, that .mvn/ stays byte-identical or that nothing is written. Two things made that false:
    • Since Stop the Maven Trusted Checksums line breaking -f builds on Maven 3.9.2 to 3.9.8 #2145, every hosted scan that reads a .mvn/maven.config an earlier release wrote respells its Trusted Checksums directory line, whatever the run redirects.
    • A grant whose hash is malformed drops the checksum lines an earlier release wrote for its suffixed version, and those drops were queued before the rewriter decided anything about the dependency. A dep the reactor planner refused, or one skipped because the build selects another version or the selection cannot be read, could still have .mvn/checksums/checksums.sha256 rewritten.
  2. The mirror gate's warning read as a statement about the files and is also shown when the poms already hold the wiring an earlier run wrote.
  3. The mirror gate and the config heal had no test together. They landed side by side (Do not wire a hosted Maven pin behind a mirror that would take its repository #2135, Stop the Maven Trusted Checksums line breaking -f builds on Maven 3.9.2 to 3.9.8 #2145).
  4. cargo fmt --all -- --check fails on main. formats/maven/mod.rs declares mirror above declared_maven, the order a merge left them in. CI does not run fmt, so nothing was red.

What changes

  • A dep that is refused or skipped touches no file. The malformed-hash drops wait for the decision: they are queued when the pin lands this run, or when an earlier run's pin is in place, and not otherwise. That is what the mirror gate already did for the deps it holds back.
  • The warnings say what this run did. One clause, one constant (MAVEN_WROTE_NOTHING), used by the mirror gate and the reactor planner's refusal: this run wrote nothing for it (no pin in a pom, no line or file under .mvn/).
  • Earlier wiring is named. When the poms already hold the wiring an earlier run wrote, the mirror warning says that it was left in place, that a build behind the mirror fails to resolve the patched version, and how to take it out (socket-patch rollback <purl>), beside the ways to make it resolve.
  • Docs. CLI_CONTRACT.md and docs/ecosystems.md use one phrase under every hosted Maven reason code, "the run writes nothing for the dep", and the contract says once what it covers and what it does not (wiring an earlier run left, the one respelled config line). The row for redirect_maven_selection_undetermined no longer opens with a claim its own reactor case contradicts.
  • Tests. See below.
  • fmt. The two mod lines are sorted.

Outcome changes

  • A hosted scan no longer rewrites .mvn/checksums/checksums.sha256 for a dependency it refuses or skips. The stale line of a malformed grant still goes when the pin lands or is in place.
  • The wording of two warning details.

No reason code is added or removed and no exit status changes.

Tests

  • maven_dep_that_is_refused_or_skipped_touches_no_file: a grant with a malformed hash and a stale checksum line, through each way out of the rewriter: the reactor planner's refusal, a version the build does not select (a single pom, and a reactor), a pom that names another version, and a selection that cannot be read. In each, no file and no edit. It fails with the drops queued before the decision (checked: refused: [".mvn/checksums/checksums.sha256"]).
  • maven_mirror_gate_touches_no_file_of_a_gated_dep asserts the wording with no earlier wiring; maven_mirror_gate_does_not_hold_back_the_heal_of_an_earlier_config asserts it with the earlier wiring in place (left in place, the build fails on it, the rollback command), and that the gate and the heal compose: the mirror's warning for the dep, the heal for the config, nothing else written, the dep decided and not confirmed.
  • maven_checksums_block_is_healed_whatever_the_run_redirects asserts the refusal's clause in the run where the old wording was false (a reactor root refused whole, its config healed).
  • The two tests that build "a project an earlier release wired" share one helper.

Golden fixtures

None changed: the fixtures pin warning codes, not their prose, and no case has a malformed grant hash beside a refused dep.

What I ran

On macOS, head 0e2956254 (four commits on main at 40ac5a7c8):

  • cargo fmt --all -- --check: clean (it fails on main).
  • cargo clippy --locked --workspace --all-features -- -D warnings: clean.
  • cargo test -p socket-patch-core --tests --no-fail-fast: 8752 passed, 0 failed, 1 ignored (the discovery golden regenerated first, with no change).
  • The 18 Maven-related CLI suites: 1303 passed, 0 failed.
  • The harness's own suites (common_selftests, spawn_env_hygiene, and the tests of e2e_bazel_build that need no Bazel): all pass.
  • e2e_redirect_maven_build with real Maven, required and not skipped: 8 passed on each of 3.6.3, 3.9.4, 3.9.16 and 4.0.0-rc-7.

Not run: Linux and Windows (CI), the rest of the CLI suites, the Maven production legs (no code they drive changed beyond the two texts and the drop order).

Review findings

/code-review high on 4d6f4da92 returned eight. Each was confirmed against the code first.

# Finding Outcome Test
1 The new wording still over-claimed: the malformed-hash checksum drops were queued before the decision, so a refused or skipped dep could have the checksums file rewritten Fixed: the drops wait for the decision, for the reactor refusal and the single-pom exits maven_dep_that_is_refused_or_skipped_touches_no_file
2 The mirror warning read as a statement about the files, and is shown when an earlier run's pin is already there Fixed: it says what this run did, and names earlier wiring that was left in place, with the remedy the two mirror gate tests, one per wording
3 Unscoped "nothing written" claims remained in both docs Fixed: one scoped phrase under every hosted Maven reason code, in both files docs
4 The redirect_maven_selection_undetermined row opened with an absolute its reactor case contradicts Fixed: the sentence is scoped to a single pom docs
5 A sentence in docs/ecosystems.md still had the reactor as its subject, on a line of 103 columns Fixed: reworded and rewrapped; no line this PR touches there is over the paragraph's width docs
6 "no pin in pom.xml" in one warning, "no pin in a pom" in the other and in the contract Fixed: one wording the constant
7 The new test copied the "earlier release's wiring" setup from the heal test Fixed: wired_by_an_earlier_release, used by both refactor
8 The clause was spelled in two format strings and pinned by substring in two tests Fixed: one constant, used by both warnings and every assertion refactor

Review findings not fixed

None.

🤖 Generated with Claude Code

`formats/maven/mod.rs` declared `mirror` above `declared_maven`, the
order a merge left them in. `cargo fmt --all -- --check` fails on it.
CI does not run fmt, so nothing was red; the tree is formatted again.

No behaviour changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two things that landed side by side meet in one scan: the mirror gate
holds a dependency back when a mirror of the machine's settings would
take its Socket repository, and the heal respells a `.mvn/maven.config`
line an earlier release wrote. The heal is tied to no dependency,
because that line stops Maven 3.9.2 to 3.9.8 from starting with `-f`
from outside the project whatever the run redirects.

The new test pins how they compose: a project an earlier release wired,
scanned behind a mirror that captures its repository, gets the mirror's
warning for the dependency and the heal for the config. Nothing else is
written, and the dependency is recorded as decided and not confirmed,
as the gate records every dependency it holds back.

No behaviour changes: the test passes on main as it stands.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Two warnings spoke for more than the dependency they are about. The
mirror gate said `pom.xml and .mvn/ were left as they are`; the reactor
planner's refusal said `the poms and .mvn/ were left as they are`; and
the contract said under both, and under two more reason codes, that
`.mvn/` stays byte-identical.

That stopped being always true when the heal of a `.mvn/maven.config`
an earlier release wrote landed: every hosted scan that reads such a
file respells its Trusted Checksums directory line, whatever the run
redirects, and so also a run whose only Maven patch is gated or refused.

Both texts now say what was meant: nothing was written for the
dependency (no pin in a pom, no line in `.mvn/`). `CLI_CONTRACT.md` and
`docs/ecosystems.md` say the same under the four reason codes, and the
section on mirrors names the respelling as the one thing such a run may
still write, with the edit it is reported under.

The test of the heal asserts the refusal's wording in the run where the
old wording was false (a reactor root refused whole, its config healed),
and the test of the mirror gate does the same for the gate's.

Outcome change: the wording of two warning details. No file a scan
writes changes, no reason code, no exit status.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The warnings for a dependency that is not wired say that nothing was
written for it. Three things made that less than true.

A grant whose hash is malformed drops the checksum lines an earlier
release wrote for its suffixed version, and those drops were queued
before the rewriter decided anything about the dependency. So a
dependency the reactor planner refused, or one skipped because the build
selects another version or because the selection cannot be read, could
still have `.mvn/checksums/checksums.sha256` rewritten. The drops now
wait for the decision: they are queued when the pin lands this run, or
when an earlier run's pin is in place, and not otherwise. A dependency
that is refused or skipped has no file touched for it, which is what
the mirror gate already did for the dependencies it holds back.

The mirror gate's warning read as a statement about the files, "no pin
in pom.xml", and it is also shown when the poms already hold the wiring
an earlier run wrote. It now says what this run did. Where the earlier
wiring is in place it says so, says that a build behind the mirror
fails on it, and names the command that takes it out beside the ways to
make it resolve.

The clause was spelled twice, with "pom.xml" in one warning and "a pom"
in the other and in the contract. It is one constant now, used by the
mirror gate and by the reactor planner's refusal.

The contract and the ecosystem notes use one phrase for every Maven
reason code, "the run writes nothing for the dep", and say once what it
covers. The row for a selection that cannot be read no longer opens
with a claim that its own reactor case contradicts.

Outcome changes: a hosted scan no longer rewrites the checksums file
for a dependency it refuses or skips; the wording of two warning
details. No reason code and no exit status changes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@mikolalysenko Mikola Lysenko (mikolalysenko) changed the title Say exactly what a Maven dependency that is not wired leaves unwritten Touch no file for a Maven dependency that is not wired, and say what the run did Nov 19, 2026
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review November 19, 2026 18:09
@cursor

cursor Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes hosted Maven rewrite side effects and user-visible warning text; behavior is narrowly scoped to refused/skipped/gated deps but affects .mvn/ checksum handling and mirror scenarios.

Overview
Hosted Maven redirect no longer mutates project files for dependencies that are refused, skipped, or mirror-gated. Stale Trusted Checksums lines for malformed grant hashes are dropped only when a pin actually lands or an earlier pin is already in place—not before the rewriter decides wiring.

Warning text is unified via MAVEN_WROTE_NOTHING (this run wrote nothing for it…), replacing claims that pom.xml / .mvn/ were left unchanged. The mirror gate warning now distinguishes this run from earlier wiring still in the poms (rollback remedy). The mirror gate explicitly does not block .mvn/maven.config Trusted Checksums directory respelling (heal_mvn_config).

CLI_CONTRACT.md and docs/ecosystems.md align hosted Maven reason codes with that scoped wording. Tests cover refused/skipped deps, mirror + heal composition, and a shared wired_by_an_earlier_release helper; formats/maven/mod.rs module order is fmt-fixed.

Reviewed by Cursor Bugbot for commit 0e29562. Configure here.

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant