Skip to content

Conversation

@xyOz-dev
Copy link
Contributor

@xyOz-dev xyOz-dev commented May 10, 2025

Related GitHub Issue

Closes: #2657

Description

fixes the incorrect behavior of appending content using apply_diff with the wrong start_line

Test Procedure

  • Unit Tests have been implemented.
  • I also followed the manual test mentioned in the issue that this pr closes.

Type of Change

  • 🐛 Bug Fix: Non-breaking change that fixes an issue.

Important

Fixes applyDiff line number handling and proximity prioritization in multi-search-replace.ts, adding tests for CSS insertion and line precision.

  • Behavior:
    • Fixes incorrect behavior in applyDiff in multi-search-replace.ts by adjusting line number handling and proximity prioritization.
    • Adds a proximity boost for matches close to the preferred line in fuzzySearch.
  • Tests:
    • Adds tests in multi-search-replace.test.ts to verify CSS insertion handling and line number precision.
    • Tests prioritize matches near specified start lines and handle various edge cases.
  • Misc:
    • Removes duplicate test description in multi-search-replace.test.ts.

This description was created by Ellipsis for a50c6d7. You can customize this summary. It will automatically update as commits are pushed.

xyOz-dev added 3 commits May 10, 2025 17:58
Fix Pre realworld testing.
…ng proximity boost for matches near preferred lines. Clean up code for better readability and performance.
@changeset-bot
Copy link

changeset-bot bot commented May 10, 2025

⚠️ No Changeset found

Latest commit: a50c6d7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels May 10, 2025
@xyOz-dev xyOz-dev changed the title Possible fix for diffs fixes the incorrect behavior of appending content using apply_diff with the wrong start_line May 10, 2025
}
})

it("should prioritize matches close to specified start_line over higher similarity matches further away", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually think we want it to do this. The intended behavior is to pick the highest similarity match within the buffer range, starting in the center and searching outward from there. Unclear to me if that behavior is not working as expected - do you know?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to successfully recreate #2657 consistently, ive personally run into the issue a couple times and this does fix the issue, there may be some edge cases that i havent run into but it does seem to work better for me this way

@hannesrudolph hannesrudolph moved this from New to Issue [In Progress] in Roo Code Roadmap May 13, 2025
@hannesrudolph hannesrudolph moved this from Issue [In Progress] to PR [Pre Approval Review] in Roo Code Roadmap May 13, 2025
@xyOz-dev xyOz-dev closed this by deleting the head repository May 15, 2025
@hannesrudolph hannesrudolph moved this from New to Done in Roo Code Roadmap May 20, 2025
@hannesrudolph
Copy link
Collaborator

@xyOz-dev Did you mean to close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Strange behavior of appending to a file using apply_diff with slighlty wrong start_line

3 participants