Skip to content

[ai] hidden files: Rewrite hidden paths after rename - #4802

Open
sanketpatel32 wants to merge 1 commit into
TeamAmaze:release/4.0from
sanketpatel32:devin/1796226133-hidden-files-rename
Open

sanketpatel32 wants to merge 1 commit into
TeamAmaze:release/4.0from
sanketpatel32:devin/1796226133-hidden-files-rename

Conversation

@sanketpatel32

Copy link
Copy Markdown

Fixes: #4794

Fixes #4794

Description

Hidden-file entries are keyed by exact paths. After a successful rename, both the in-memory radix tree and the utilities database still referenced the old path, so a file hidden inside a renamed directory became visible and the Hidden Files dialog kept showing a path that no longer existed.

This change rewrites exact hidden paths and descendant paths after a successful rename. Descendant matching requires a path boundary, so sibling paths such as Reports-old are not rewritten. Moves through MoveFiles are intentionally unchanged; this PR is scoped to the rename flow described in the issue.

Issue tracker

Fixes #4794

Automatic tests

  • Added unit tests for specific individual functions
  • Added headless tests for new app functionality
  • Added emulator tests for new UI elements

Test plan:

  • ./gradlew testPlayDebugUnitTest -x :testShared:testPlayDebugUnitTest --tests 'com.amaze.filemanager.database.UtilsHandlerTest' --tests 'com.amaze.filemanager.utils.DataUtilsTest'
  • ./gradlew :app:testPlayDebugUnitTest --tests 'com.amaze.filemanager.database.UtilsHandlerTest' --tests 'com.amaze.filemanager.utils.DataUtilsTest'

Manual tests

  • Done

  • Device: Not run

  • OS: Not run

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembleDebug
  • ./gradlew spotlessCheck

Generative code

  • This PR used generative code tools (GenAI, LLMs, etc.)

  • Model: Devin

  • Version: Not disclosed to the agent

  • Provider: Cognition AI

Self-review

  • The PR addresses all points described in the issue
  • All relevant tests pass locally
  • Code follows existing patterns in the codebase
  • Names (functions, variables, tests) are clear and greppable
  • Commit messages, comments, and PR description are well done
  • Each commit is a minimal coherent idea
  • No debugging code or unnecessary comments remain
  • Type annotations are complete and correct
  • User-facing strings are in strings.xml (no user-facing strings added)
  • User-facing error messages are clear and actionable (no user-facing error messages added)
  • No secrets or credentials are hardcoded
  • Documentation is updated if behavior changes (no documentation update needed)
  • Refactoring is complete (git grep for remaining occurrences)
  • Security audit of changes

Renaming a file or directory left hidden entries pointing at the old
path. Exact hidden entries then became visible after parent directory
renames, while the Hidden Files dialog continued showing paths that no
longer existed.

Rewrite exact and descendant hidden paths in both the in-memory radix
tree and utilities database after a successful rename. Descendant
matching requires a trailing slash so sibling paths sharing the same
name prefix are left unchanged.

Fixes TeamAmaze#4794.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a parent folder makes a hidden file visible and leaves the old path in Hidden Files

1 participant