Repository navigation
fix(work): preserve line framing throughout attempt diffs - #283
Merged
Lucas1479 merged 4 commits intoNov 3, 2026
Merged
Conversation
parse_unified_diff iterated over source.splitlines(). str.splitlines() also breaks at form feed, vertical tab, \x1c-\x1e, \x85, U+2028 and U+2029, none of which end a line in Git's patch output. Such a character inside a source line split the line in two: the remainder was either dropped, truncating the shown text, or, when it began with "-", "+" or a space, rendered as a phantom removed/added/context line. That changed the additions/deletions counts and shifted every later line number in the hunk. Form feeds are common page separators in Python, C and Lisp sources and U+2028 appears in JavaScript and JSON strings. Split on "\n" and remove a trailing "\r", which keeps the previous handling of CRLF content lines and CRLF-framed patches. Fixes Code-Amadeus#281
…raming # Conflicts: # tests/test_work_artifact_registry.py
Member
|
Thank you for the focused parser fix and regression coverage. I have completed the same line-framing invariant in the Host-generated new-file patch path and added eight generator-to-parser cases plus three full attempt cases. Those tests also exposed final Git-delta |
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.
What and why
Fixes #281. Git patch lines are delimited by LF. Python's
splitlines()also splits form feeds, vertical tabs and Unicode separators that belong inside a source line, producing truncated text, phantom changes and incorrect line numbers in the Work diff canvas.The parser now splits only on LF and retains its existing CRLF display handling. The Host's new-file patch generator uses the same LF framing, preserves empty/trailing blank lines and emits the missing-final-newline marker based on LF. Final Git-delta assembly no longer strips source whitespace from the last patch line.
Owning layers:
server/unified_diff.pyandserver/work_artifact_registry.py. Existing output schemas, permissions and attribution rules are unchanged. The generator is shared by Git-untracked files and new files in non-Git workspaces.Change class
Evidence
python -X utf8 -m pytest tests/test_local_git_provider_diff.py tests/test_work_artifact_registry.py tests/test_unified_diff_canvas.py tests/test_work_export_integration.py -q: 61 passed on head9b8bbe869901b53ca707eb1486a721b0218d1ade, including merged fix(work): pin the format of patches the Host parses #284 and fix(work): keep spaced paths from diff headers in the attempt diff canvas #282.git diff --check: passed.Final check