Repository navigation
[ai] trash: Cache directory content size before deletion - #4745
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
Store the recursive content size when creating a directory trash entry, rather than its filesystem entry length. Reuse the existing folder-size helper and retain the regular-file metadata behavior. Add headless regressions for nested and empty directories and a regular-file control. The original code fails the directory cases; all 39 HybridFileTest cases pass with the fix. Debug assembly and Spotless checks also pass. Codex assisted this contribution. Fixes TeamAmaze#4326.
carrerasdarren-cell
force-pushed
the
fix/trash-directory-metadata-size
branch
from
October 20, 2026 00:49
1fc212e to
4d9b576
Compare
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: #4326
Description
A directory's filesystem entry length does not represent the bytes in its contents. Cache the existing recursive
folderSize(context)result when creating trash metadata, before the source is moved. Regular files keep the existing length calculation, and the trash listing can continue reading the cached value without rescanning.Issue tracker
Matches the maintainer's requested metadata fix.
Automatic tests
The three new regressions cover nested contents totaling 4,156 bytes, an empty directory, and unchanged regular-file size/name/path/type. Against the original production code, the regular-file controls passed, while directory cases reported 128 instead of 4,156 bytes and 64 instead of zero. The original run had five assertion failures, three passes and one case skipped by the existing fail-fast policy.
./gradlew :app:testFdroidDebugUnitTest --tests com.amaze.filemanager.filesystem.HybridFileTest— 39 passed, zero failed or skipped, across the class's three configured SDK variants (21/28/30).These were actual project/Robolectric runs with synthetic local files. An external Gradle init script limited the run to one worker/test fork and directed reports/temp files to the SSD; it did not remove owner tasks, dependencies or the fail-fast policy.
Manual tests
Build tasks success
./gradlew assembleDebug— F-Droid and Play debug APKs produced, including the configured native targets../gradlew spotlessCheckBoth commands exited successfully. Existing upstream resource/deprecation and formatter warnings remain in the logs; this change leaves the build configuration and unrelated sources untouched.
Generative code
Codex assisted implementation, actual test execution and review. AI review is not represented as human validation.