Treat missing device data dir as success when forgetting a device#12895
Open
mvanhorn wants to merge 1 commit into
Open
Treat missing device data dir as success when forgetting a device#12895mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
Contributor
|
Hello, thanks for the pull-request. |
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.
Summary
parsec-cli device forget-localno longer errors withFailed to remove device data: Failed to remove data: No such file or directory (os error 2)when the device has no data directory.remove_device_datanow treatsErrorKind::NotFoundfromremove_dir_allas success, making the cleanup idempotent; any other io error still propagates as before.Why this matters
#12807 reports the confusing hard error on what is actually a successful forget operation - the device key file is removed correctly, but the follow-up data-dir removal fails. AureliaDolo noted in-thread this affects devices created on old organizations, which never got a per-device data directory. The fix is localized to the storage cleanup helper (
libparsec/crates/platform_storage/src/native/cleanup.rs); the CLI command andclientwrapper are unchanged.How to test:
parsec-cli device forget-localon a device whose<data_base_dir>/<device_id_hex>/directory does not exist completes without the error; with the directory present, it is removed exactly as before.Testing
cleanup_device_data_missing_dirtest: forgetting a device whose data dir was never created returnsOk(this fails on master withNotFound)cleanup_device_datastill passes (directory present and removed)cargo test -p libparsec_platform_storage --lib --features test-with-testbed cleanup: 3 passednewsfragments/12807.bugfix.rstFixes #12807