Skip to content

Commit 73b0bb1

Browse files
committed
fix(issue-457-edit-unsuccessfull): Default diffFuzzyThreshold to 1.0 for safety
1 parent 779f057 commit 73b0bb1

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

packages/types/src/global-settings.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ export const DEFAULT_WRITE_DELAY_MS = 1000
2424

2525
/**
2626
* Default fuzzy matching threshold for the multi-search-replace diff strategy.
27-
* A value of 0.90 means the search content must be at least 90% similar to the
28-
* file content for a match to succeed. Lowered from the previous strict 1.0 (exact
29-
* match) to reduce "Edit Unsuccessful" errors caused by minor whitespace or
30-
* formatting differences.
27+
* A value of 1.0 (exact match) is used by default for safety, especially when
28+
* auto-approval for writes is enabled. This prevents unintended changes from
29+
* being applied due to minor mismatches. Users can lower this threshold manually
30+
* in settings to reduce "Edit Unsuccessful" errors caused by minor whitespace
31+
* or formatting differences, accepting a higher risk of unintended edits.
3132
*/
32-
export const DEFAULT_DIFF_FUZZY_THRESHOLD = 0.9
33+
export const DEFAULT_DIFF_FUZZY_THRESHOLD = 1.0
3334

3435
/**
3536
* Terminal output preview size options for persisted command output.

webview-ui/src/context/__tests__/ExtensionStateContext.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ describe("mergeExtensionState", () => {
341341
taskSyncEnabled: false,
342342
checkpointTimeout: DEFAULT_CHECKPOINT_TIMEOUT_SECONDS,
343343
maxReadFileLine: -1,
344-
diffFuzzyThreshold: 0.9,
344+
diffFuzzyThreshold: DEFAULT_DIFF_FUZZY_THRESHOLD,
345345
}
346346

347347
const makeMessage = (ts: number, text: string): ClineMessage =>

0 commit comments

Comments
 (0)