[Bug]: Windows onefile cache prune still leaves every old extract dir (issue #167 fix insufficient) #171
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ai-collab/bulk-image-organizer#171
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?
App version
Multiple packaged Windows builds spanning 0.4.0 through 0.6.1+adhoc.v0.7.0 (both before and after issue #167's fix landed).
Platform
Windows
Report (from user, in chat)
0.6.1+adhoc.v0.7.0 Beta didn't remove old extracts > dirAnalysis
This is a stronger signal than issue #167 originally had: every one of these folder names already contains
+— including the ones from before #167's fix, which only required"+" in path.nameto qualify for deletion. So #167's actual change (dropping the+-only naming restriction) could not have been the operative bug; pruning has evidently never deleted anything on a real Windows run, for any build, before or after that fix. Two consecutive builds on the same0.6.1/v0.7.0branch (a123ed1thena434c9b, ~3 hours apart) both persisted — the newer run did not even clean up the immediately preceding one.prune_stale_onefile_caches()(core/onefile_cache.py) has several early-return guards before it ever reaches the deletion loop (sys.platform != "win32",is_frozen_runtime(), theexe_parent != bundle_root()onefile-detection check, and the_is_managed_cache_parent()layout check) — and, critically, packaged builds log at INFO level (seecore/logging_config.py::setup_logging) while most of these guards previously only logged at DEBUG (_is_managed_cache_parent's failure branch) or not at all (_is_onefile_windows_runtime()had zero logging). So even with the existing log file, there was no way to tell which guard was short-circuiting this — or whether it was running at all and simply failing to delete for some other reason.A secondary, code-level (not yet confirmed) suspicion worth investigating if the new diagnostics point away from the guard clauses:
resource_paths.py::_windows_onefile_unpack_roots()scans every sibling under the product dir that still has an intactresources/help/USER_GUIDE.md— i.e. every never-pruned stale extract, not just the current one — andbundle_root()picks among all candidates viamax(found, key=lambda p: len(p.parts)). Since siblings are all at the same directory depth, this is a tie thatmax()resolves by iteration order, not necessarily by which one the current process is actually running from. Not chasing this without evidence per current direction — flagging it here in case the added diagnostics point atbundle_root()returning the wrong directory rather than a guard short-circuiting.Fix landed so far
prune_stale_onefile_caches()and its two internal checks now log every branch at INFO (not DEBUG, not silent), including the exactsys.argv[0]/bundle_root()values used for onefile detection, which specific_is_managed_cache_parent()check failed and why, and — on a successful run — the resolved current dir, cache parent, and full sibling list before attempting deletion. This does not change behavior; it makes the next real run's log file (%APPDATA%\bulk-image-organizer\logs\bulk-image-organizer.log) diagnostic instead of silent, so the actual cause can be confirmed instead of guessed at again.Acceptance criteria
Status
Diagnostic logging landed; root cause not yet confirmed. Needs the user to run a build with this change and share the relevant
bulk-image-organizer.logsection (search forOnefile cache prune).Diagnostic logging landed (commit
eb14446on0.6.1/v0.7.0, documented as DR-038): every branch of_is_onefile_windows_runtime(),_is_managed_cache_parent(), andprune_stale_onefile_caches()now logs at INFO instead of DEBUG/silent — no behavior change.caplog-based tests confirm the messages appear.I'm deliberately not guessing at a code fix this round — issue #167 already shipped a plausible-looking fix that turned out not to be the actual cause (every one of your listed folders already had
+in the name, which the old check should have matched), so patching another guard clause without evidence risks the same outcome again.Next step (needs a Windows run): launch a build with this change, then open
%APPDATA%\bulk-image-organizer\logs\bulk-image-organizer.logand find theOnefile cache prunelines from that session. That will show one of:exe_parent == bundle_root(), or the cache-parent layout check) — and exactly why.shutil.rmtreefailed (would show asFailed to remove stale onefile cache: ... <reason>at WARNING).Once we can see which of those it is, the actual fix should be small and confident rather than another guess. Could you share that log section next time you run a build?
Closing as a duplicate — this is the same still-open issue as #167 (the fix for that issue hadn't actually been verified working; this report is that verification, not a new bug). All content moved to a comment on #167: #167 (comment)