2 months ago
e724434The audit's single CRITICAL finding. read strips \r via readline, so any multi-line oldString the model copies carries bare \n and could never match a CRLF file's raw bytes: every multi-line edit failed with 'oldString not found' on Windows checkouts (core.autocrlf=true) while the identical call succeeded on macOS/Linux. And when a single-line-anchored edit DID succeed, Bun.write spliced LF lines into the CRLF file. edit now matches on LF-normalized haystack+needle and re-emits the file's dominant EOL via platform/text.replaceRespectingEol — CRLF files stay CRLF byte-exact. read gains BOM handling (UTF-8 BOM no longer leaks into line 1) and UTF-16 decoding (the PowerShell-redirection artifact) with a size guard; its LF-normalized view is now the documented canonical contract. UTF-8 streaming path unchanged for large files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Parentd38940a