Repository navigation
fix(server): file editor saves keep a UTF-8 BOM - #36552
Conversation
The workspace file read stripped a leading BOM, so editing and saving such a file in the editor wrote it back without one. The read now keeps the BOM, and the lenient JSON parser accepts it so a BOM-prefixed t3.json stays valid. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: GPT 6.1 Sol <codex@openai.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Editor saves now preserve an existing UTF-8 BOM without adding duplicate markers. The change is confined to file-format preservation during requested saves, with existing workspace write protections unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Keeping U+FEFF in readFile contents leaked it into every client consumer: Markdown task-list offsets land one character early, the source editor can type in front of it, and .t3.json parsing needed a lenient-JSON change. The BOM is file encoding, so the server keeps decoding it away on read and puts it back in writeFile when the file it replaces starts with one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dismissing prior approval to re-evaluate f3a74a8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EvidenceReal Linux web app, Chromium 156, 1280×800, light theme; fresh isolated data on each commit. Seed a UTF-8 BOM source file, open it in Files, change
Scenario source · Neutral terminal shell
|
Co-authored-by: Julius Marminge <julius0216@outlook.com> (cherry picked from commit 9e180e5)




Editing a UTF-8 BOM file silently removed its marker on the first save. Keep the marker in workspace file reads so the editor writes it back. Let the shared lenient JSON parser accept a leading BOM so BOM-prefixed
t3.jsoncontinues to parse.Small fast-lane fix: localized decoding changes, no new state, interface or UI flow.
Proof
Found by the T3 Code bughunt; independently confirmed by Claude Opus 5.5 on main
d899bddfa2a6f824411eaae10fb7a8fa0a37bbb7.pnpm exec vp test run apps/server/src/workspace/WorkspaceFileSystem.test.ts -t 'reads UTF-8 files relative'fails on base because saving the edit removes EF BB BF.WorkspaceFileSystem.test.tsandschemaJson.test.ts, pass. The JSON BOM case also fails against base source and passes with the fix.pnpm exec vp run scenarios:provewith the temporaryfile-editor-keeps-utf8-bom.e2e.tsscenario fails on based899bddfa2and passes on reviewed head509abbd290. It opens the file, edits it in the real editor and checks the saved bytes. The scenario is proof-only and is not committed.pnpm exec vp run check:changedpasses.git range-diffconfirms the reviewed patch is unchanged.Desktop and mobile were not independently exercised. This change is at their shared server read boundary. General encoding support is outside scope. The independent non-UTF-8 validation fix touches the same decoder and must retain both
fatal: trueandignoreBOM: truewhen combined.Local cubic found no issues; repository-specific context was unavailable. Trim found no changes needed. Opus's line-one review-context BOM nit is outside this save fix and remains a follow-up. Settings writers' existing normalization is also outside scope.
Council review
Small-PR council per Wout: two seats, no guest. No blocker or should findings remain.
Closes #36551
Created with GPT 6.1 Sol (lead, bughunt and review) in the Codex harness and Claude Opus 5.5 (independent verification, build, trim and review) in the Claude harness, through T3 Code.