Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A race with pending file reads can install stale content after acknowledging disk changes, while skipped raw-data cache refreshes can make Reopen with Encoding restore older text.
2 open issues
What changed in this PR
This PR avoids unnecessary editor reloads when external file-change notifications report bytes identical to the current document, while preserving reloads for changed content and text bundles.
Changes:
- Add coordinated content comparison and modification-date tracking to the shared document helper.
- Run external-change handling on the main queue.
- Add tests for matching content, subsequent saves, changed bytes, unsynchronized text, and text bundles.
| File | Description |
|---|---|
| MarkEditMac/Tests/EditorDocumentTests.swift | Verify external text-bundle edits still reload and preserve assets. |
| MarkEditMac/Tests/EditorDocumentSaveTests.swift | Cover skipped reverts, save behavior, and required reloads. |
| MarkEditMac/Sources/Editor/Models/EditorDocument.swift | Delegate external-change handling to the helper on the main queue. |
| MarkEditMac/Modules/Sources/AppKitExtensions/Foundation/NSDocument+Extension.swift | Add coordinated timestamp and content checks before reverting. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Synchronous file coordination on the main queue can deadlock with a writer waiting for autosave, so the disk read must move off-main with state revalidation before applying the result.
1 open issue
2 resolved since last review
Review effort: Balanced
742b815 to
84348e7
Compare
There was a problem hiding this comment.
🟡 Changes recommended
An external write matching unsaved edits leaves the editor’s saved undo checkpoint stale, so undoing can incorrectly mark the document clean and allow changes to be discarded on close without prompting.
1 open issue
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Regression tests are missing for the new skip-revert path and pending-read retry, leaving identical-content handling, changed-content reloads, and pending-decode behavior unprotected.
1 open issue
1 resolved since last review
Review effort: Balanced



Skip unnecessary reverts when file-change notifications report content identical to the current document.