Repository navigation
[ai] trash: Preserve encrypted-file metadata through restore. - #4752
Open
carrerasdarren-cell wants to merge 1 commit into
Open
carrerasdarren-cell wants to merge 1 commit into
carrerasdarren-cell wants to merge 1 commit into
Conversation
Recoverable deletion removes the stored entry needed to reopen an Amaze-encrypted file. Track its actual bin path and restore the same entry identity on a successful restore, so a new file at the original path keeps its own password record. Finish path updates in the worker before reporting rename success. Roll back a failed metadata move when possible, and only clear the physical path after permanent deletion succeeds. Keep failed moves, restore collisions and unrelated plain-file operations intact. Verify real synthetic-file lifecycle and Room row state across Android API 21, 28 and 30, including replacement password selection. Fixes TeamAmaze#4730.
Member
|
@carrerasdarren-cell please be aware that we have a shortage of review time, so these PRs will sit until we have time to review them. You can better spend your time reviewing and testing already made PRs. |
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.
Fixes: #4730
Description
Deleting a
.azefile to Trash currently removes its stored entry, so restoring the intact ciphertext cannot reopen the password prompt. Move the entry's path with the file into and out of Trash, retaining its ID and password. Keeping the entry at the bin path also lets a newly encrypted file use its original path without selecting the old file's password.Only successful permanent deletion clears metadata. Trash purges clear the physical bin path, including the direct cleanup entry point; failed restores retain both files and their separate entries. If a metadata move fails after a rename, attempt to roll back the rename and report failure; propagate the error if rollback also fails. No encryption algorithm, database schema, permission, or new UI is changed.
Issue tracker
Fixes #4730.
Automatic tests
The Robolectric tests use actual synthetic files, Room rows, Trash callbacks, the restore view model, production password-entry selection, and encryption/decryption byte round-trips. They cover row ID preservation, replacement-file password selection before/after purge, occupied restore, failed rename, metadata-error rollback, lightweight moves and plain-file isolation. Android key/password support and remote filesystem controls use the repository's existing test shadows; the injected metadata-write error is explicitly synthetic.
./gradlew :app:testFdroidDebugUnitTest --tests '*DeleteTaskEncryptedMetadataTest' --tests '*SmbDeleteTaskTest' --tests '*SshDeleteTaskTest'— 45 passed, 0 failed/skipped (33 new lifecycle cases + 12 existing remote-delete cases across API 21/28/30)The commands used one Gradle worker, no parallel execution, an external JVM/module/report/temp-directory guard and existing SSD caches. No owner build/test/dependency settings or assertions were disabled.
The initial regression on unmodified
94afab32b0a1bd0ddbc582978aca9ffced1301b8failed at the missing metadata assertion after real Trash/restore while restored ciphertext bytes matched. Scope is individual.azefiles; this does not introduce a recursive directory-metadata migration or claim a filesystem/database transaction.Manual tests
Done
Device: No physical-device or emulator testing performed
OS: Headless Android API 21, 28 and 30 under Robolectric; host macOS arm64/JDK 17
Build tasks success
./gradlew assembleDebug— F-Droid and Play debug APKs built./gradlew spotlessCheckGenerative code
This PR used generative code tools (GenAI, LLMs, etc.)
Model: OpenAI Codex (coding assistant)
Version: Exact model/build identifier is not exposed to this task
Provider: OpenAI
Implementation, test preparation and static review used Codex assistance. Validation above records actual local commands/results; AI review is not represented as human review.