Repository navigation
fix(rust): reject overlapping exact Edit matches - #6859
Merged
Merged
Conversation
Fixes apache#6858 Generated-by: OpenAI Codex
Member
|
Clean fix, thanks for the contribution! |
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.
Summary
Rust Edit accepted overlapping exact matches as unique and modified the first span. For example, replacing two consecutive
itemlines in a three-line repetition succeeded despite two possible starting positions.Compare the first and last exact-match positions so overlapping matches are rejected before writing. The existing fuzzy path uses the same uniqueness approach. Regression coverage invokes the real file executor for repeated lines,
banana/ana, repeated ASCII, and multibyte text, verifies unchanged bytes on rejection, and preserves a unique self-overlapping-pattern control.Fixes #6858
Refs #5589 (the earlier TypeScript report)
Verification
cargo test --offline -p maka-fs-tools: 28 passed (7 unit tests, 21 integration tests), no failures. Existing exact, fuzzy, file-read/write, patch, and workspace behavior tests remain passing.cargo fmt --all -- --check: passed; stable rustfmt reports warnings for repository nightly-only formatting options.cargo clippy --offline -p maka-fs-tools --all-targets --no-deps -- -D warnings: passed, including compilation/type checking of all targets.git diff --check: passed.Full dependency linting without
--no-depsis blocked by an existingclippy::needless_updateatplugins/agent/provider-protocol/src/chat_completions/response.rs:87, outside this change. Installed nextest 0.9.143 is below the repository's required 0.9.145, so the crate suite was run with Cargo's test runner instead; the version guard was not bypassed. Full workspace and Desktop UI suites were not run for this focused file-tool change.Test output:
AI use
Tool(s) and scope: OpenAI Codex prepared the fix, regression tests, and PR description at kesonm's request, and ran the listed checks. kesonm is the human contributor of record.
Checklist
Does this PR entail a change in behavior?