Repository navigation
Pick JVM line terminators through utils::line_endings (#815) - #1264
Merged
Mikola Lysenko (mikolalysenko) merged 2 commits intoOct 9, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
4 tasks
Vendored Gradle, hosted Gradle and the Maven reactor chose the line break for the lines they insert with their own rules: Gradle took the first line's break (gradle::eol::newline_of / sniff_crlf), the Maven reactor treated any CRLF as CRLF. Every other line-inserting writer uses line_endings::terminator (the majority on a mixed file), so the same mixed file got different inserted lines depending on the ecosystem. The Gradle module's line-ending helpers now live in utils::line_endings (eol_eq moves, apply_eol becomes respell keyed by the terminator), and gradle/eol.rs is deleted. Gradle's forward append and its revert lookups switch to terminator together, so a mixed settings file still reverts byte for byte. Behavior: unchanged for LF-only and CRLF-only files. On a mixed file the lines vendored Gradle, hosted Gradle and .mvn/maven.config insert take the file's majority terminator instead of the first line's (or CRLF whenever any line has it). Refs #815 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 9, 2026 12:24
Collaborator
Author
|
BugBot review Generated by Claude Code |
Mikola Lysenko (mikolalysenko)
pushed a commit
that referenced
this pull request
Oct 9, 2026
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 117c5e3. Configure here.
Collaborator
Author
|
Ready for review at Generated by Claude Code |
Tanmay Singla (Tanmay182003)
approved these changes
Oct 9, 2026
Mikola Lysenko (mikolalysenko)
deleted the
arch-refactor/815-jvm-line-terminator
branch
October 9, 2026 14:58
Mikola Lysenko (mikolalysenko)
pushed a commit
that referenced
this pull request
Oct 9, 2026
Mikola Lysenko (mikolalysenko)
pushed a commit
that referenced
this pull request
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLM Description written by Claude Code:claude-opus-5-5
Refs #815 (slice 3; the issue stays open for the last site, the hosted Gemfile edit in
redirect/mod.rs, which several open PRs change). Tracker #814, register E16, living document Part 4 line-ending paragraph.Summary
Vendored Gradle, hosted Gradle and the Maven reactor no longer pick line terminators with their own rules. They use
utils::line_endings::terminator, the rule every other line-inserting writer has used since #1108/#1227. The Gradle-only line-ending modulegradle/eol.rsis deleted: its comparison helper moves intoutils::line_endings, and its first-line rule goes.Why (leverage)
newline_of+sniff_crlf), thevendor/jvm/gradle.rsnewline_ofwrapper, two inline any-CRLF copies inmaven_reactor.rs, and the byteto_lf/apply_eolcopies ofline_endingscode. · S 0 · R L.What changed
utils::line_endingsgainseol_eq, moved fromgradle::eolwith a private byteto_lf_bytes, andrespell(text, nl), which replacesapply_eol(text, crlf).vendor/jvm/gradle.rs: the 5 insert sites useterminator. The 4 revert and "is it still ours" lookups (holds_to, the settingsapplyrecord, the.gitattributesline,undo_replace_eol) respell withterminatorof the current text. Forward and revert now use the same rule, so a mixed file reverts byte-exact.patch/redirect/gradle.rs: hosted settings append viaterminator.parse_index/index_digestuse thestrto_lf.maven_reactor.rs:.mvn/maven.configmerge and the pomDocnewline useterminator.eol_eqimporters (vendor/jvm/mod.rs,redownload.rs,upstream/gradle.rs,vex/discover/gradle.rs) import it fromline_endings.Deleted
crates/socket-patch-core/src/gradle/eol.rs(97 lines),vendor::jvm::gradle::newline_of, and the twomaven_reactor.rsinline copies.git diff --stat: production +67/−97, tests +67/−37 (net −30 production).Behavior
applyline) and.mvn/maven.configtake the file's majority terminator (a tie is LF). Before, Gradle used the first line's terminator and the Maven reactor used CRLF whenever any line had it. This is the change Pick the line terminator for spliced lines through one line_endings::terminator #815 specifies.undo_replace,holds_to,is_oursviaeol_eq), so most of these cases still match.Test evidence
vendor::jvm::gradle::tests::mixed_settings_take_the_majority_terminator_and_revert_byte_exactcovers both mixed shapes (first line LF with a CRLF majority, and the reverse). It checks forward, re-plan to nothing, revert with no drift, and a byte-exact restore. Red onmain(an LF terminator inserted into a CRLF-majority file); green here.maven_reactor::tests::maven_config_mergesgains a mixed case. Red onmain(CRLF added to an LF-majority file); green here.gradle::eoltests run asline_endings::tests::{eol_eq_ignores_only_crlf, respell_round_trips}. They also check thatto_lf_bytesagrees withto_lfand handles non-UTF-8 input.cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --lib: 5981 passed. 4 failed: the known root-only sandbox failures (copy_tree::relax_loop_must_not_traverse_symlinked_root,vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry,pypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouched,pypi_requirements::wire_failure_rolls_back_already_written_files), which fail onmaintoo.vendor_jvm_cli31,gradle_agent_cli52,maven_sidecar_cli27,e2e_maven21,contract_gradle_codes1,e2e_vex38: all passed.Risk
Low. The change is mechanical for uniform files, and the only behavior change is on mixed files, as above. The
gradlemodule's purity test dropseol.rs.utils/line_endings.rsuses no filesystem, environment or network access.🤖 Generated with Claude Code
Note
Medium Risk
Mechanical for uniform files, but mixed line-ending files get different inserted terminators and revert matching, which could affect edge-case restores of builds wired before this change.
Overview
Removes Gradle-only line-ending helpers and routes vendored/hosted Gradle, Maven reactor, and shared JVM patch code through
utils::line_endings(terminator,respell,eol_eq).gradle/eol.rsis deleted. Its comparison logic lives inline_endings::eol_eq;apply_eol/newline_of/sniff_crlfcallers switch toterminatorandrespell. Hosted Gradle index parsing/digests use the stringto_lfhelper.Behavior change (#815): on mixed CRLF/LF files, inserted lines and revert matching use the majority line terminator (tie → LF), not Gradle’s old first-line rule or Maven’s “any
\r\n→ CRLF” heuristic. Uniform LF-only and CRLF-only files are unchanged.Tests cover mixed
settings.gradleforward/revert byte-exactness and mixed.mvn/maven.configmerges.Reviewed by Cursor Bugbot for commit 117c5e3. Configure here.
Generated by Claude Code