@@ -226,8 +226,7 @@ describe("tool.edit", () => {
226226 } )
227227 } )
228228
229- // altimate_change start — edit now auto-refreshes stale files instead of throwing (#450)
230- test ( "succeeds when file has been modified since read by auto-refreshing" , async ( ) => {
229+ test ( "throws error when file has been modified since read" , async ( ) => {
231230 await using tmp = await tmpdir ( )
232231 const filepath = path . join ( tmp . path , "file.txt" )
233232 await fs . writeFile ( filepath , "original content" , "utf-8" )
@@ -244,23 +243,21 @@ describe("tool.edit", () => {
244243 // Simulate external modification
245244 await fs . writeFile ( filepath , "modified externally" , "utf-8" )
246245
247- // Edit should succeed — auto-refreshes the stale read timestamp
246+ // Try to edit with the new content
248247 const edit = await EditTool . init ( )
249- const result = await edit . execute (
250- {
251- filePath : filepath ,
252- oldString : "modified externally" ,
253- newString : "edited" ,
254- } ,
255- ctx ,
256- )
257- expect ( result . output ) . toContain ( "Edit applied successfully" )
258- const content = await fs . readFile ( filepath , "utf-8" )
259- expect ( content ) . toBe ( "edited" )
248+ await expect (
249+ edit . execute (
250+ {
251+ filePath : filepath ,
252+ oldString : "modified externally" ,
253+ newString : "edited" ,
254+ } ,
255+ ctx ,
256+ ) ,
257+ ) . rejects . toThrow ( "modified since it was last read" )
260258 } ,
261259 } )
262260 } )
263- // altimate_change end
264261
265262 test ( "replaces all occurrences with replaceAll option" , async ( ) => {
266263 await using tmp = await tmpdir ( )
0 commit comments