Repository navigation
Autosave unexported annotations and offer to restore them - #226
Merged
Merged
Conversation
Unexported annotations of the open folder are saved a few seconds after each edit as one JSON file per folder in the app data folder. The file is deleted once the annotations are exported or discarded on quit. Opening a folder with an autosave offers to restore it, and at startup the app offers to reopen the last folder that has one. The JSON format now supports masks (COCO RLE), so autosaves keep them.
A restored autosave is often imported before the image has loaded. Its shapes were then placed against the wrong image size and added a second time when the image finished loading. Now the image's load listener shows them once its size is known.
The status bar's saved-status indicator now has a tooltip that says whether the annotations are exported and, if not, when they were last saved automatically.
AutosaveWriter writes the autosaves on the background thread. A save that is requested while an earlier one still waits replaces it, so slow disks never make saves pile up.
On Windows CI the previous UI test's autosave timer fired during the next test and wrote an autosave for the shared test folder, which then asked to be restored. Autosaving now stops (after a running save) when the window is hidden. Also: tests for invalid JSON masks, the startup offer to reopen the last folder, a failing autosave and the tooltip's date format, and Sonar fixes (unnamed catch variables, AutosaveStore as a record).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #226 +/- ##
============================================
- Coverage 90.20% 90.05% -0.15%
- Complexity 2317 2374 +57
============================================
Files 132 135 +3
Lines 8618 8901 +283
Branches 833 865 +32
============================================
+ Hits 7774 8016 +242
- Misses 437 462 +25
- Partials 407 423 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Annotations that were not exported yet are now saved automatically, so a crash, a forced quit or a power loss no longer loses the work since the last export.
How it works
~/Library/Application Support/BoundingBoxEditor/autosave, Windows:%APPDATA%\BoundingBoxEditor\autosave, Linux:$XDG_DATA_HOMEor~/.local/share/boundingboxeditor/autosave). Files are written on a background thread into a temporary file and then moved into place.AutosaveWriter), so saves never pile up on slow disks. Measured: about 12 ms on the UI thread for 200k boxes, and the writing happens in the background.Also
"mask": {"size", "counts"}, COCO RLE), so autosaves keep them and JSON exports no longer drop them.Tests
AutosaveStoreTest,AutosaveWriterTest(unit) andAutosaveTests(UI: autosave and deletion after export, restore, declining, restore while the image is still loading).testtask points the autosave folder atbuild/tmp/test-autosave, andBoundingBoxEditorTestBaseempties it before each UI test, so tests never touch the user's autosaves.