GeezerVison is showing github.com — Pick JVM line terminators through utils::line_endings (#815) by mikolalysenko · Pull Request #1264 · SocketDev/socket-patch
Conversation
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 module gradle/eol.rs is deleted: its comparison helper moves into utils::line_endings, and its first-line rule goes.
Why (leverage)
- B 0 · U 1: after this, Pick the line terminator for spliced lines through one line_endings::terminator #815 has one site left. · D ≈4: the Gradle first-line rule (
newline_of + sniff_crlf), the vendor/jvm/gradle.rs newline_of wrapper, two inline any-CRLF copies in maven_reactor.rs, and the byte to_lf/apply_eol copies of line_endings code. · S 0 · R L.
- Every higher-ranked candidate (Validate patch UUIDs through one utils::uuid grammar instead of five #705, Chunk patch batch searches through one core helper with one set of batch limits #675, Mirror global flags into the environment once before dispatch, and read the lock timeout through one accessor #794, the manifest-load cluster, Locate hosted Maven pom edits and their upstream restore through the formats::maven element scanner #717, Upstream restore sends every public-registry lookup at once; the registry_concurrency cap has no caller #1220) changes files that open PRs also change. All of this PR's files are free.
What changed
utils::line_endings gains eol_eq, moved from gradle::eol with a private byte to_lf_bytes, and respell(text, nl), which replaces apply_eol(text, crlf).
vendor/jvm/gradle.rs: the 5 insert sites use terminator. The 4 revert and "is it still ours" lookups (holds_to, the settings apply record, the .gitattributes line, undo_replace_eol) respell with terminator of 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 via terminator. parse_index/index_digest use the str to_lf.
maven_reactor.rs: .mvn/maven.config merge and the pom Doc newline use terminator.
eol_eq importers (vendor/jvm/mod.rs, redownload.rs, upstream/gradle.rs, vex/discover/gradle.rs) import it from line_endings.
Deleted
crates/socket-patch-core/src/gradle/eol.rs (97 lines), vendor::jvm::gradle::newline_of, and the two maven_reactor.rs inline copies.
git diff --stat: production +67/−97, tests +67/−37 (net −30 production).
Behavior
- LF-only and CRLF-only files: none.
- Mixed CRLF/LF files: lines inserted by vendored Gradle, hosted Gradle (settings
apply line) and .mvn/maven.config take 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.
- Mixed files vendored before this change: revert looks for a block written with the old rule in the new rule's terminator. This differs only when the first line's terminator and the majority disagree. Revert already tries the raw text first (
undo_replace, holds_to, is_ours via eol_eq), so most of these cases still match.
Test evidence
- New
vendor::jvm::gradle::tests::mixed_settings_take_the_majority_terminator_and_revert_byte_exact covers 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 on main (an LF terminator inserted into a CRLF-majority file); green here.
maven_reactor::tests::maven_config_merges gains a mixed case. Red on main (CRLF added to an LF-majority file); green here.
- The moved
gradle::eol tests run as line_endings::tests::{eol_eq_ignores_only_crlf, respell_round_trips}. They also check that to_lf_bytes agrees with to_lf and 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 on main too.
- CLI:
vendor_jvm_cli 31, gradle_agent_cli 52, maven_sidecar_cli 27, e2e_maven 21, contract_gradle_codes 1, e2e_vex 38: all passed.
- No equivalence golden covers Gradle or Maven.
Risk
Low. The change is mechanical for uniform files, and the only behavior change is on mixed files, as above. The gradle module's purity test drops eol.rs. utils/line_endings.rs uses 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.rs is deleted. Its comparison logic lives in line_endings::eol_eq; apply_eol / newline_of / sniff_crlf callers switch to terminator and respell. Hosted Gradle index parsing/digests use the string to_lf helper.
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.gradle forward/revert byte-exactness and mixed .mvn/maven.config merges.
Reviewed by Cursor Bugbot for commit 117c5e3. Configure here.
Generated by Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
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
cursor[bot] reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 117c5e3. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Ready for review at 117c5e3a: CI 451/451 green (416 success, 35 skipped), mergeable. Bugbot reviewed this head: no findings. Reviewer note: mechanical refactor across 10 JVM vendor/VEX files routing line terminators through utils::line_endings (134+/134-).
Generated by Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
arch-refactor
PR opened by the scheduled architecture refactor routine
Ready for review
Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review
refactor
Structural change: duplicated code or logic, missing abstraction, layering, dead code
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|