Tolerate concurrent removal during temporary folder cleanup - #1852
Open
betacatsling wants to merge 1 commit into
Open
Tolerate concurrent removal during temporary folder cleanup#1852betacatsling wants to merge 1 commit into
betacatsling wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1852 +/- ##
==========================================
- Coverage 94.08% 94.08% -0.01%
==========================================
Files 46 46
Lines 8087 8118 +31
==========================================
+ Hits 7609 7638 +29
- Misses 478 480 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
delete_folder checks that a directory exists, then calls os.listdir outside its retry handler. Another cleaner can remove that directory before listdir or rmtree, causing an otherwise successful cleanup to raise FileNotFoundError.
Handle directory listing inside the retry block and finish when the target has already disappeared. Existing permission errors continue to retry and raise. Tests simulate both races at filesystem-operation boundaries using actual temporary directories.
Validation: 2 regressions failed before, 10 existing/control cases passed; all 12 disk tests pass afterward. Ruff checks pass for changed files. Validation ran locally on CPU.
Implementation and validation were performed with AI assistance.
Fixes #1851.