fix: re-read files after formatting in apply_patch#15893
Open
JDNdeveloper wants to merge 2 commits intoanomalyco:devfrom
Open
fix: re-read files after formatting in apply_patch#15893JDNdeveloper wants to merge 2 commits intoanomalyco:devfrom
JDNdeveloper wants to merge 2 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
006609a to
c6d5f6c
Compare
The edit tool re-reads files and recomputes diffs after the formatting pipeline runs, so that metadata reflects the actual on-disk state. apply_patch was missing this step, causing unintended stylistic changes (quote normalization, extra newlines, etc.) to appear in the diff without being accounted for. Closes anomalyco#15864
c6d5f6c to
6b28206
Compare
6 tasks
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.
Issue for this PR
Closes #15897
Type of change
What does this PR do?
The
edittool re-reads files and recomputes diffs after the formatting pipeline runs, so that metadata reflects the actual on-disk state.apply_patchwas missing this step, causing formatter changes (quote normalization, extra newlines, etc.) to NOT appear in the diff despite being applied to the file.This PR updates the behavior of the
apply_patchtool to match theedittool.NOTE: Motivating issue was #15864, though it turned out to be somewhat unrelated (I didn't realize there's a formatter that runs after edits).
How did you verify your code works?
Ran local dev and confirmed
apply_patchbehavior (using ChatGPT) now matchesedittool (using local model) (see screenshots below).Screenshots / recordings
edittool:apply_patchtool before the fix (despite the actual file having the second line edited as well!):apply_patchtool after the fix:Checklist
If you do not follow this template your PR will be automatically rejected.