Repository navigation
fix(editor): never save back a project's own file from the open dialog - #1097
Conversation
Opening a project's own file through the dialog (or a drop) read it, then saved that content as the project. An MCP edit landing between the read and the save was overwritten. The dialog now says when the file is a stored project's own file, and the editor loads that project by id instead of saving it back; any other file is imported as before. The parse, migrate and save step the editor's two open paths duplicated now lives in importProjectFile. beforeProjectFileRead goes: with nothing saved back, the dialog's read no longer needs to count against MCP writes.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Opening a project's own file from the dialog or a drop now loads the stored project instead of saving the earlier read back over it. This prevents the overwrite of an intervening MCP edit. No merge-blocking risk was found. Pre-merge checks |
|
Summary
Opening a project's own file through the open dialog (or a drop) read it, then saved that content back as the project, so an MCP edit landing in between was overwritten. That was the gap left documented by #1040.
storedProjectIdwhen the file is a project's own file in the projects folder.importProjectFile.beforeProjectFileReadis removed: with no save-back, the dialog's read needs no counting.mcp-server.mdis gone.Related issue
Follow-up to #1040 (CodeRabbit thread on
document-service.ts).Type of change
Release impact
Desktop impact
Testing
importProjectFile.test.ts: realDocumentServiceon a temp folder. The dialog reads a project's own file, an MCP edit is saved withsaveProjectIfUnchanged, then the file is opened. The MCP edit survives; with the save-back restored the test fails (expected 'As read' to be 'Edited over MCP').document-service.test.ts:storedProjectIdnames only files directly in the projects folder.tscconfigs, Biome, and the editor/MCP/document-service suites pass locally.🤖 Generated with Claude Code
Summary by CodeRabbit