fix(cleanup): invalidate sandbox_dirs_cache after purge (#7527)

Closes #7527.

ISSUES CLOSED: #7527
This commit is contained in:
2026-05-08 11:42:32 +00:00
committed by drew
parent bab706c257
commit 82af29bb4f
2 changed files with 95 additions and 0 deletions
@@ -0,0 +1,17 @@
@unit @cleanup
Feature: Sandbox dirs cache invalidation after purge
This test verifies the fix for issue #7527: _purge_sandboxes() must
invalidate the sandbox_dirs_cache so subsequent scan() calls re-read
the filesystem. Without this fix, a stale cached list of directories
persisted even after those directories were deleted by shutil.rmtree().
Scenario: Cache is invalidated after purge completes removals
Given cleanup coverage has a CleanupService with default settings
When cleanup coverage purges sandboxes and cache is cleared for tracking
Then cleanup coverage _sandbox_dirs_cache should be None after purge
Scenario: Purge with no stale dirs still invalidates cache
Given cleanup coverage has a CleanupService with default settings
When cleanup coverage purges sandboxes with an empty cache
Then cleanup coverage _sandbox_dirs_cache should be None after purge