[Bug]: Close Directory and Delete Cache on a network share still syncs the cache back onto the share #185
Labels
No labels
Kind/Bug
Kind/Feature
Priority/High
Priority/Medium
Reviewed/Confirmed
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ai-collab/bulk-image-organizer#185
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Affected area
Workspace close / network share cache (DR-015).
MainWindow._on_close_directory_and_cache)PREF_ALWAYS_DELETE_CACHE_ON_CLOSE)closeEvent)Report
Closing a network workspace while deleting cache still runs Sync Workspace Cache to Network. That copies the local cache (including thumbnails) back to the share as
.bulk_image_organizer.dbin the image directory.The user asked to throw the cache away. Instead the share is repopulated, so the next open hydrates the same database again. The confirm dialog says workspace tags will be removed and flags cleared; the share copy undoes that.
Local-disk close-and-delete is fine (there is no separate share copy). Switching directories or exiting without delete-cache should still sync (DR-015).
Steps to reproduce
.bulk_image_organizer.db.Expected
.bulk_image_organizer.dbon the share is removed as well (or at least not rewritten), so a later open does not hydrate the discarded workspace back.Actual
_finalize_workspace_close()always calls_sync_workspace_cache_to_share_if_needed(show_ui=True, modal=True)before_delete_workspace_cache_file().closeEventdoes the same: sync first, then optionally delete only the local cache.tests/test_pr13_config.py::test_close_directory_shows_network_sync_dialogcurrently asserts this: withPREF_ALWAYS_DELETE_CACHE_ON_CLOSEon, close-and-delete is expected to show the sync dialog and leaveshare_path.is_file().Suggested fix direction
Skip share sync on any path that is discarding the cache:
_on_close_directory_and_cachecloseEventwhen_always_delete_cache_on_close()is trueAlso delete the share copy (
share_metadata_pathand SQLite companions) after releasing locks, not only the local cache. Keep sync for directory switch and for exit/close that does not delete cache.Update
test_close_directory_shows_network_sync_dialogso delete-cache does not sync, and add coverage that the share file is gone. Keep a test that a normal network close/switch still showsNetworkSyncDialog.Acceptance criteria
.bulk_image_organizer.dbonto the share.Implemented on branch
0.9.2/issue-185-186-network-cache-tag-filter(commitb25b847).Close Directory and Delete Cacheand app-exit-with-always-delete now skip_sync_workspace_cache_to_share_if_needed()entirely (_finalize_workspace_close(sync_to_share=False)/closeEvent's always-delete branch)..bulk_image_organizer.db+-wal/-shm) via a new_delete_share_cache_files()helper, so a later open of the same share doesn't hydrate the discarded workspace back in.tests/test_pr13_config.py: renamed/updated the old test to assert no sync + share removal on delete-cache, and added coverage for both closeEvent branches (sync-without-delete vs skip-with-delete).Full suite green (792 passed). Not yet in a PR — will be included when a PR to
mainis requested.