#2372: Add --retention-delay option to ide cleanup - #2378
Open
krystynaShatkovska wants to merge 3 commits into
Open
#2372: Add --retention-delay option to ide cleanup#2378krystynaShatkovska wants to merge 3 commits into
krystynaShatkovska wants to merge 3 commits into
Conversation
Adds a --retention-delay option to the cleanup commandlet to delete stale files that have not been modified within a configurable period. Files are scanned recursively under $IDE_HOME/updates, $IDE_ROOT/_ide/tmp and ~/Downloads/ide. The option accepts a time-based ISO-8601 duration (e.g. P30D) and defaults to 1 year (365 days) if not provided. Empty folders left behind after deleting stale files are removed, while the scanned roots themselves are kept.
Collaborator
Coverage Report for CI Build 33621501883Coverage increased (+0.09%) to 73.704%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions9 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
samuelkos17
suggested changes
Aug 28, 2026
samuelkos17
left a comment
Contributor
There was a problem hiding this comment.
Thanks for adding the --retention-dely to the cleanup commandlet. I tried to follow your testing steps, however the commands you provided didn't work out for me. I've manually moved the files to /_ide/tmp though and then ran the cleanup command and it worked!
While reviewing I found some problems that could lead to issues and that really need to get addressed before moving this to In Review. You can find them in the Comments here.
Besides that I still have on recommendation:
documentation/tmp.adoc line 18 needs to be updated according to the new functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #2372
Implemented changes:
Adds a --retention-delay option to ide cleanup. It takes an ISO-8601 duration (e.g. P30D, PT2H30M; default 1 year) and deletes stale files (not modified within that period) in $IDE_HOME/updates, $IDE_ROOT/_ide/tmp and ~/Downloads/ide. After deletion it deletes empty folders (but keeps the scanned roots). Invalid durations are rejected with a clear error.
Testing instructions
Automated tests
Run the test class, it covers all the core cases:
mvn -pl cli test -Dtest=CleanupCommandletTest
Manual test (run against a local build of this branch, in a clean/throwaway IDE workspace)
The command scans three roots for stale files: $IDE_HOME/updates (only inside a project), $IDE_ROOT/_ide/tmp (always exists), and ~/Downloads/ide (the download cache).
a. Create a stale and a recent file in the temp folder:
New-Item -Path "$env:IDE_ROOT_ide\tmp\stale.bin" -Value "x" -Force
(Get-Item "$env:IDE_ROOT_ide\tmp\stale.bin").LastWriteTime = (Get-Date).AddDays(-31)
New-Item -Path "$env:IDE_ROOT_ide\tmp\fresh.bin" -Value "x" -Force
b. Run cleanup and answer Yes (this also uninstalls unused software — use a clean workspace):
ide cleanup --retention-delay=P30D
c. Confirm:
Test-Path "$env:IDE_ROOT_ide\tmp\stale.bin" # expected: False
Test-Path "$env:IDE_ROOT_ide\tmp\fresh.bin" # expected: True
d. Verify invalid input is rejected:
ide cleanup --retention-delay=PT6M10D # months not allowed in a time-based duration
ide cleanup --retention-delay=P0D # must be positive
ide cleanup --retention-delay=-P30D # must be positive
ide cleanup --retention-delay=abc # not ISO-8601
Checklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.batand notfeature/921 fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internalpom.xmlfiles or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc