fs: support pruning hidden directories during walks (#31570)

Why

Filtering hidden directories after a walk is too late: their descendants
consume traversal limits, and canonical directory deduplication can let
a hidden path claim a target before a visible symlink reaches it.

What this changes

- Add an optional pruneHiddenDirectories walk option. It defaults to
false and is omitted from the wire when disabled.
- Return hidden directory entries, but do not traverse them or add their
canonical identities to the visited set.
- Cover the visible-symlink-to-hidden-directory case through both local
and remote filesystem implementations.

This is the small filesystem prerequisite for #31566. Skill-specific
behavior remains in that PR.
This commit is contained in:
jif
2026-07-08 13:49:05 +01:00
committed by GitHub
parent f1affbac5e
commit a52b35fcf6
4 changed files with 76 additions and 0 deletions
@@ -402,6 +402,7 @@ async fn file_system_walk_returns_a_bounded_tree(
max_directories: 10,
max_entries: 10,
follow_directory_symlinks: false,
prune_hidden_directories: false,
},
/*sandbox*/ None,
)
@@ -447,6 +448,7 @@ async fn file_system_walk_returns_a_bounded_tree(
max_directories: 10,
max_entries: 10,
follow_directory_symlinks: false,
prune_hidden_directories: false,
},
/*sandbox*/ None,
)
@@ -469,6 +471,7 @@ async fn file_system_walk_returns_a_bounded_tree(
max_directories: 1,
max_entries: 10,
follow_directory_symlinks: false,
prune_hidden_directories: false,
},
/*sandbox*/ None,
)
@@ -491,6 +494,7 @@ async fn file_system_walk_returns_a_bounded_tree(
max_directories: 10,
max_entries: 1,
follow_directory_symlinks: false,
prune_hidden_directories: false,
},
/*sandbox*/ None,
)
@@ -535,6 +539,7 @@ async fn file_system_walk_honors_read_sandbox(
max_directories: 2,
max_entries: 2,
follow_directory_symlinks: false,
prune_hidden_directories: false,
},
Some(&sandbox),
)