Rudy Celekli

PUBLIC ENGINEERING CASE STUDY · VERIFIED MERGED CONTRIBUTION · NOVEMBER 4, 2026

Keep Unicode source content inside the right Git line

Preserving physical diff boundaries in PR-Agent’s reverse patching and supplied-diff parsing.

Upstream: The-PR-Agent/pr-agent · Pull request #4668 · Author: rudycelekli

The problem

Python’s splitlines() recognizes more separators than Git’s LF-based physical line model. A source line containing a Unicode line separator, NEL or form feed could be split into several logical lines, causing reverse patching to reject matching content or shift later hunk positions. A sibling supplied-diff parser could also lose continued source content.

Before

One Git source line containing U+2028 could become two Python splitlines() entries. A later hunk’s physical line number then referred to the wrong position.

After

Reverse patching uses the existing LF-aware splitter. Supplied-diff parsing uses LF-only StringIO iteration, and patch values remove only one line-ending CR rather than stripping all trailing carriage returns.

The contribution

The merged change adjusted both parsing paths and added regressions with non-LF separators inside source/context lines, a separator before a later hunk, and repeated trailing carriage returns. The existing EOF-newline policy and hunk-header contract were deliberately preserved.

Validation and provenance

The PR records 43 focused tests passing on its exact candidate head. A separately reported full suite covered a combined 20-change campaign and must not be read as a standalone full-suite run of this fix. This case study independently verified GitHub authorship, merged state and the diff on November 4, 2026; it did not rerun the historical provider suite.

Run the before-and-after check

A new local replay checks the actual upstream reconstruction function extracted from immutable source. It uses the pinned unidiff wheel and a logging adapter, without importing the full PR-Agent application. The parent baseline fails nine regression scenarios and passes two controls; the merged candidate matches the expected result in all eleven. Reintroducing either old operation makes the relevant failures return.

Known regression inputs · 11 scenarios per variant
VariantExpected-output matchesMismatches
Parent baseline2/119
Merged candidate11/110
Candidate with old splitlines operation2/119
Candidate with old CR stripping10/111

Five integrity and evaluator guards pass, including rejection of corrupted source/dependency bytes and a deliberately wrong oracle under optimized Python. These are development regressions selected for the disclosed fix, not a protected holdout or a benchmark of general engineering ability.

Download the small runnable evidence pack · Read the method and commands · Inspect the recorded outputs

Requires Python 3.10 or later; the recorded run used Python 3.12.12. Extract the ZIP, run python3 run_reconstruction.py, then python3 -m unittest -v test_evidence_guards.py. Sources, notices and the hash-verified dependency are included, so the normal replay needs no API key, installation or network.

ZIP SHA256: 9d0f22dc06722d095462b689de0d2d12afd6675429a21ae8f8e12b29d7e653d3

This isolates reconstruct_base_file_checked and its LF splitter. The sibling MOSAICO parser, full application startup, provider accounts, hosted upstream suite and production behavior are not exercised. The recorded results are first-party local evidence and do not establish independent endorsement or AI recommendation visibility.

What this does not establish

At publication time the PR’s original validation narrative still described hosted workflows as action_required, while the live GitHub state confirms a later merge. No hosted CI success, release publication or live provider acceptance is inferred from that merge.

Engineering lesson

Agentic code review depends on exact source reconstruction. Choosing a text splitter is a format decision: use the line model defined by the patch format, not a broader language convenience.

Inspect the evidence

Merged pull request and original validation narrative · Immutable merge commit · Source at that commit

Merge commit: d8fcf7772cd531a36bdabebf145b819949d111ce