Repository navigation
Conversation
Track approved ADD placeholders during edit preparation so the patch coder can write their contents while preserving existing files. Avoid creating ADD directories during dry-run and cover the full run flow and lifecycle boundaries. Fixes Aider-AI#5875.
|
Hou KangLe seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This branch has not been deployed
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.
With
--edit-format patch, an approved*** Add Filecurrently leaves an empty file and fails withADD Error: File already exists: the shared preparation step creates the file before PatchCoder checks for an existing target.Track the approved ADD placeholders for each batch and allow the patch to fill them while they remain empty. Existing files, including empty files, are still rejected before preparation; permission is consumed on application and reset for the next batch. ADD dry-runs also avoid creating parent directories.
Add 15 regression tests covering the complete
Coder.run()flow with a mocked response, Git staging, declined and ignored targets, existing-file protection, intervening writes, batch cleanup, direct application, normalized paths, and nested dry-runs.Fixes #5875.
Validation on Windows with Python 3.12:
python -m pytest tests/basic/test_patch.py tests/basic/test_coder.py tests/basic/test_editblock.py -q— 82 passed, 35 subtests passed.litellmmock_responsereproduction creates the expected file content without a real model request or API key.python -m pre_commit run --files aider/coders/patch_coder.py tests/basic/test_patch.py— isort, black, flake8, and codespell passed.git diff --checkpassed.