(feat) add Discord cache category to junk cleaner#24
Conversation
|
Thanks for your first pull request to Sifty! A couple of things that help it land quickly: Sifty deletes files, so all deletion must go through |
Vortrix5
left a comment
There was a problem hiding this comment.
Nice addition, and the safety side is right. It only builds cache roots, deletion still goes through trash(), and session data (Local Storage etc.) is left untouched. Confirmed the test passes locally.
One thing before this can merge: it doesn't pass lint, so CI is red. ruff check (what CI runs) flags 8 trailing-whitespace and missing-newline issues across both files. ruff check --fix clears all but one. The blank line inside the docstring at junk.py:77 needs its whitespace removed by hand. Run that, re-push, and I'm happy to merge.
Minor, take it or leave it: the other cache-root helpers read env vars through the _env_path() helper rather than os.environ directly, worth matching for consistency.
65b8d0d to
e26f31c
Compare
Thanks for the review! I've updated the unit test with a robust mock for I also switched to |
What does this PR do?
This PR addresses the issue regarding Discord's large Chromium-style cache accumulation. It adds a new dedicated junk category
discord-cachethat identifies and targets safe-to-clear cache directories for Discord and its alternative release channels (PTB and Canary), while strictly preserving user session and login data.Closes #3
Safety checklist
Sifty deletes files, so every PR keeps these promises:
pytestis green, includingtests/test_safety.pyos.remove,shutil.rmtree,Path.unlink); everything goes throughsafety.trash()Notes for the reviewer
discord-cachecategory safely covers standard Discord, Discord PTB, and Discord Canary by looking at their respective directories in%APPDATA%.Cache,Code Cache, andGPUCachesubdirectories.Local Storage) is strictly left untouched to ensure users are never logged out of their accounts after a cleanup.tests/test_junk.pyto validate flavor discovery and ensure session folders are never included in the roots.