Skip to content

fix(builtins): list ls -R and tree through bounded bulk walk batches - #2819

Merged
chaliy merged 2 commits into
mainfrom
claude/project-thread-w2g6tc
Nov 3, 2026
Merged

chaliy merged 2 commits into
mainfrom
claude/project-thread-w2g6tc

Conversation

@chaliy

@chaliy chaliy commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What changed

ls -R and tree now list directories through the same bounded FileSystem::walk batches as find and du. On a backend with a bulk walk (one path-prefix query), they take one call per batch instead of one read_dir per directory. On other backends they still list each directory once.

  • New WalkOptions::skip_hidden hint. Without -a, the default walk never enters dot directories that ls -R/tree do not print (e.g. .git).
  • tree caps each batch at its remaining entry budget, so prefetch never reads far past where tree stops. With -I it keeps plain read_dir, because the walk cannot prune by pattern.

Why

Follow-up to #2816. On remote filesystems (~10 ms per call) ls -R/tree were the last tree walkers paying one round trip per directory.

Before / After

cargo bench --bench remote_fs -- --counts, bashkit checkout (3.7k files), index+walk backend:

command before after
ls -R crates 1,983 calls (19.8 s at 10 ms) 2 calls
tree crates 1,983 calls (19.8 s at 10 ms) 2 calls

Plain backend: unchanged at one read_dir per directory, and hidden directories are still not entered (ls_recursive_and_tree_skip_hidden_directories). The output is identical with and without bulk walk, using a 100-entry backend page (ls_recursive_and_tree_output_is_the_same_with_bulk_walk, covering -a, -l, -L, -d, -I, symlinks and hidden dirs).

Risk

  • Low
  • Output ordering or contents of ls -R/tree could change. This is covered by differential tests against the plain path.

Checklist

  • Tests added or updated
  • Backward compatibility considered (WalkOptions gains a field; backends may ignore the hint)

Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 48537c2 Commit Preview URL

Branch Preview URL
Nov 03 2026, 06:12 AM

@chaliy
chaliy merged commit c106af1 into main Nov 3, 2026
68 of 70 checks passed
@chaliy
chaliy deleted the claude/project-thread-w2g6tc branch November 3, 2026 06:48
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.

1 participant