roc-lang / roc-lang/basic-cli

Propagate per-entry errors from Path.list!

Open
#440 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
121
Forks
45
Avg merge
18h 43m
Merged PRs (30d)
10

Description

Context

hosted_dir_list currently discards errors produced while iterating an otherwise successfully opened directory:

let entries = read_dir
    .filter_map(|entry| entry.ok().map(|entry| entry.path()))
    .collect();

See src/lib.rs:1173-1177.

This can return an incomplete list as Ok when an entry disappears during iteration or the filesystem reports an I/O error. Because Path.list! already returns a Try, silently returning partial data is surprising and can lead applications to make incorrect decisions.

Suggested direction

Collect the iterator as a Result<Vec<_>, io::Error> and map the first entry error through the existing directory error conversion. If partial results are considered useful, expose them through a deliberately different API and result type.

Acceptance criteria

  • An error from any ReadDir entry is not silently dropped.
  • Path.list! returns either a complete snapshot-like result or a typed error.
  • Tests exercise the error branch through a controllable abstraction or filesystem race harness.
  • Existing success and non-directory cases continue to pass on Unix and Windows.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/lib.rs:1173-1177 and inspect hosted_dir_list, the existing directory error conversion, and the Path.list! entry point. Add coverage for an error from a ReadDir entry using a controllable abstraction or filesystem race harness, while preserving success and non-directory behavior on Unix and Windows.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.