Repository navigation
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughDiff content now records read failures. The editor surface disables editing for failed diff content unless an edit buffer exists. Saved content clears the failure marker. DiffViewer now installs and cleans up save, find, and content-change callbacks through an effect. Added tests cover callback lifecycle, failure handling, and recovery after a successful reload or save. Priority: ⬆️ High Merge Risk: ⚪ Minimal · up to Failed diffs remain read-only until valid content is restored, and the inspected save paths show no reachable overwrite route. The change appears ready for normal merge checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change reduces accidental file overwrites without adding new access or execution capabilities. Remaining uncertainty concerns unusual recovery states across separate save paths, not an identified new security defect. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
8498bc0 to
4b69a06
Compare
Adapted from #14509 to the current split editor surface. Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Added a
loadErrormarker to failed diff reads —DiffContentgainsloadError?: boolean, anduseEditorPanelDiffContentLoadersets it on the catch-path text result so consumers can tell an error pane from real content. - Made a failed diff read-only unless a draft exists —
EditorDiffFileSurfacenow derivesisEditablefromdiffSource === 'unstaged' && (loadError !== true || editBuffer !== undefined), so an error message with no retained draft cannot be edited or saved, while a retained (even empty) draft stays saveable. - Recovered editing after a genuine save —
useEditorPanelExternalContentEventsstripsloadErrorand rebasesmodifiedContentonORCA_EDITOR_FILE_SAVED_EVENT, so the pane stays editable once the draft is cleared. - Reworked
DiffViewersubscription lifecycle — the save shortcut, both Monaco find shortcuts, and the content-change subscription moved from theonMountcallback into auseEffect([editable, modifiedEditor]), allowingeditableto flip without remounting or moving focus. - Added focused regressions — unit suites for subscription lifecycle, surface editability, loader marker set/clear, and save-marker clearing, plus a hidden-app e2e that asserts on-disk bytes are preserved when Save is pressed over a failed diff.
I audited every save/write path: all editor writes funnel through writeRuntimeFile, and each path (autosave, save-all, save-and-close, global Cmd+S) requires a draft or dirty state. The error string cannot become a draft or fallbackContent, so it cannot reach disk. Changes mode hardcodes editable={true} but renders the modifiedContent prop rather than the failed dc.modifiedContent, so it is not a leak; combined-diff sections use a separate loader and blank the body on error.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
4b69a06 to
f0cfa16
Compare

ELI5
A failed diff load could put its error message into the editable pane. Pressing Save then replaced the real file with that message. The error pane now stays read-only until real content loads.
What Changed
Keep a local load-failure flag, use it to disable editing and Save, and clear it after a successful reload or genuine file save. An existing draft remains editable, including an empty draft. Editing callbacks now follow the mounted editor's editable state, so recovery works without remounting or moving focus.
Why
This reuses the existing diff load and editor lifecycle instead of adding another error screen or save path. Production code grows by five lines. Adapted from @nwparker's #14509, retaining the original author and co-author credit.
Linked Issue
Supersedes #14509.
Visual Proof
The before/after panes display the same load error. The hidden-app test also checks actual disk bytes: before, Save writes the error message; after, Save makes no write and preserves
PROTECTED_FILE_CONTENT. Recovery then allows a normal edit and Save.Before: error text was editable and saved over the file.
After: the error stays visible, and Save leaves the real file untouched.
After a successful reload, editing and Save work again.
Testing
Review
Independent production review found no blocker. Integration with the separate stable diff-model identity fix will be checked before ready.
Agent skill upstream boundary
Notes
A failed load without a retained draft intentionally disables editing until reload succeeds. Saved drafts remain usable. No dependency or library changes.
Checklist
Shared CI repair
This branch includes the three-identifier repair from #25494, which removes two unchanged localization-scanner false positives. The editor patches and contributor authors are preserved; every editor commit patch was compared across the rebase. Fresh affected regression suites, changed-code quality and localization coverage pass on this head. The original rendered proof still applies to the unchanged editor patches. Current-head full CI remains the final gate.