Skip to content

[business-logic] edit_match.go lenientRecountRaw double-TrimSpaces all transforms - unique trailing-whitespace edits falsely rejected as ambiguous #821

Description

@topcheer

File: internal/tool/edit_match.go L635-672 vs L536-565.

lenientRecountRaw counts candidate blocks with BOTH-side TrimSpace for every transform, but trailing-whitespace-tolerant matching semantics preserve leading indentation (only trailing ws ignored). End-to-end repro: a file where old_text byte-exact count is 1 under trailing-tolerant matching, but a second block differing in leading indent gets counted -> edit_file rejects with 'matched 2 times ... line(s): 1, 6' - a correct unique edit fails as false ambiguity.

Impact: Medium - recurring friction on whitespace-tolerant edits.
Fix: recount per-transform semantics (rstrip-only for trailing-tolerant).
Verified by independent re-review with end-to-end EditFile.Execute repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions