fix(cleanup): log WalkDir entry errors instead of silently skipping (#200)#244
Closed
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
Closed
fix(cleanup): log WalkDir entry errors instead of silently skipping (#200)#244SAY-5 wants to merge 2 commits intoTrueNine:devfrom
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
Conversation
Fix two CI failures from previous merge
Closes TrueNine#200. `BatchedGlobPlanner::execute()` walked the cleanup roots with `WalkDir` and used `let Ok(entry) = entry else { continue; }` to discard any iteration errors. Permission-denied entries, broken symlinks, and races where a tree got partially deleted mid-walk were skipped without a single trace, so a cleanup running under insufficient privileges (or against a half-removed shadow tree) would quietly miss files and the operator had no way to correlate the missed delete with the underlying syscall failure. Replace the silent continue with a `match`: on `Err` emit a `debug` log via the existing structured logger with the offending path (when `WalkDir` records it) and the `io::Error` message, then fall through to `continue` so behaviour is unchanged for the happy path. Operators tailing the cleanup logs now see exactly which entries were skipped and why; tests' `walked_entries` accounting is unaffected since the increment still only fires on `Ok(entry)`. `cargo test --lib policy::cleanup` is green (31/31).
Owner
|
Merged into dev via cherry-pick. The PR base was changed from main to dev, which caused conflicts because dev had diverged significantly. All commits have been cherry-picked onto dev and pushed. Thanks for the contributions! |
Owner
|
Thank you for the contribution! All commits have been cherry-picked and merged into the dev branch. 🙏 |
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.
Closes #200.
BatchedGlobPlanner::execute()walked cleanup roots withWalkDirand usedlet Ok(entry) = entry else { continue; }to discard iteration errors. Permission-denied entries, broken symlinks, and races where a tree got partially deleted mid-walk were skipped without a trace — a cleanup running under insufficient privileges (or against a half-removed shadow tree) would quietly miss files and the operator had no way to correlate the missed delete with the syscall failure.Fix
Replace the silent
let Ok(entry) = entry else { continue }with amatch: onErremit adebuglog via the existing structured logger with the offending path (whenWalkDirrecords it) and theio::Errormessage, thencontinue. The happy path is unchanged;walked_entriesaccounting still only increments onOk.Test plan
cargo build --manifest-path sdk/Cargo.toml— cleancargo test --manifest-path sdk/Cargo.toml --lib policy::cleanup— 31/31 pass