Skip to content

#3838 notes: defer autosave during external-change review - #3842

Merged
pbek merged 1 commit into
pbek:mainfrom
myukitty:fix/accept-external-note-changes
Nov 6, 2026
Merged

pbek merged 1 commit into
pbek:mainfrom
myukitty:fix/accept-external-note-changes

Conversation

@myukitty

@myukitty myukitty commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Summary

With checksum checks disabled, the external-change dialog's nested event loop lets autosave overwrite the external file before the user chooses Reload or Keep. Reload then reads back the overwritten text.

Defer only the current note's dirty row while the dialog is executing and visible. Other dirty notes still save. A scoped flag releases the deferral when the dialog event loop returns, including Qt5 quit paths that leave the widget visible. Initialize the dialog result to Unset so exiting without clicking a button cannot read an indeterminate action.

Validation:

  • just nix-build (Qt6/KDE), just nix-build-qt5 (qmake), and just src-test passed. QtTest reported 606 passed, zero failed/skipped across 20 suites. New unit rows cover the static dirty-note filter under both checksum settings, background saves, retained pending text, and saving after loading the external file.
  • 16 real-application cases passed on Linux: 11 Qt6 and 5 native Qt5 cases. Coverage includes Reload/Keep, in-place and atomic replacement, resumed autosave, checksum controls and quitting with pending edits. The four original scenarios fail on the unmodified Qt6 base. Additional Reload/Keep cases set the notification/filename options to false and wait 25 seconds with a 10-second autosave interval.
  • The Qt5 executable was verified to link libQt5Core.so.5; its quit test used no compatibility shim. A separate Qt6 run with Qt5's quit-to-exit behavior interposed also passed.

The unit tests exercise the dirty-note filter; real-application probes exercise the dialog wiring. Validation supplied an empty .shared/common.just import absent from a clean clone; selected recipes were unchanged. Native Windows and macOS were not run.

Scope and remaining behavior:

  • Checksum-enabled conflict handling is unchanged. Its pre-existing two-tick overwrite remains outside this patch, which fixes the checksum-disabled path.
  • Directory re-indexing can still overwrite pending edits before the dialog opens. Closing without a choice resumes ordinary autosave. Shutdown retains the existing final-save policy: pending local text replaces the external version.

Checklist

  • I read the code contribution guidelines.
  • This work references an existing issue, as permitted by those guidelines.
  • The proposed PR targets main from a separate feature branch.
  • I followed the repository's commit message style.
  • No translation files are edited directly.

Related issue

Related to #3838.

@pbek

pbek commented Nov 6, 2026

Copy link
Copy Markdown
Owner

I think it's not a complete fix for the issue #3838, but at least a start. Thank you very much.

@pbek
pbek merged commit df3b5f7 into pbek:main Nov 6, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants