@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