Repository navigation
fix: find with multiple paths no longer discards results on missing path - #781
Conversation
5451246 to
2c159de
Compare
There was a problem hiding this comment.
Good fix. The behavior now matches real Unix find — results from valid paths are preserved when other paths fail, errors go to stderr, and exit code reflects whether any path had issues.
A few notes:
CI failures are pre-existing — the cargo-vet audit failure is about unvetted jni-sys deps, unrelated to this PR.
Code review:
-
collect_find_paths: Thelet _ = find_recursive(...)change silently swallows errors (not just missing-path errors but also e.g. permission errors). This is acceptable sincecollect_find_pathsfeedsexecution_plan()which is just an optimization hint, and the real error handling lives inexecute(). Worth a brief comment though — the current comment says "Ignore errors from individual paths" but doesn't clarify why it's safe to do so here vsexecute(). -
execution_plan(): Removing the redundant path-existence check is correct sincecollect_find_pathsalready skips missing paths. -
execute(): The restructured loop that collects stdout/stderr/exit_code separately is clean and correct.ControlFlow::None+..Default::default()is fine. -
Tests are thorough — covers both path orderings (first missing, second missing), all valid, all missing, stderr output, and exit codes. The spec test cases with
### bash_diffannotations are a nice touch.
LGTM.
2c159de to
acd8117
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates Bashkit’s find builtin to better match Unix find behavior when multiple search paths are provided, ensuring results from valid paths are still emitted even if other paths are missing, while reporting missing-path errors and returning a non-zero exit status when any path fails.
Changes:
- Update
findexecution to continue across multiple paths, accumulating stdout while collecting per-path errors and setting exit code to 1 if any path fails. - Add spec coverage for multi-path
findscenarios (valid+missing, missing-first, all-valid, missing-path error message). - Add Rust integration tests covering mixed/missing path scenarios and stderr behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
crates/bashkit/src/builtins/ls.rs |
Adjusts find to aggregate output/errors across paths and updates execution-plan behavior for -exec. |
crates/bashkit/tests/spec_cases/bash/find.test.sh |
Adds spec cases for multi-path and missing-path find behavior. |
crates/bashkit/tests/find_multi_path_tests.rs |
Adds Rust tests validating multi-path find behavior (stdout preservation, stderr, exit codes). |
Comments suppressed due to low confidence (1)
crates/bashkit/src/builtins/ls.rs:595
- Because
collect_find_paths()skips missing paths,execution_plan()may now returnSome(plan)forfind -execeven when some input paths are missing. The interpreter skipsexecute()when a plan exists (seebuiltins/mod.rs:485-486), so missing-path errors and exit status=1 won’t be produced in those cases. Either forceexecution_plan()to returnNonewhen any input path is missing/errors, or extend the plan mechanism to emit errors and enforce exit code 1.
// Collect matched paths (collect_find_paths skips missing paths)
let matched_paths = collect_find_paths(ctx, &search_paths, &opts).await?;
if matched_paths.is_empty() {
return Ok(None);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
sorry for the (force-pushed) seems claude decided it to go that way :) |
…macros 0.4.1 (everruns#783) ## Summary - Adds `safe-to-deploy` exemptions for `jni-sys:0.3.1`, `jni-sys:0.4.1`, and `jni-sys-macros:0.4.1` - Fixes the `cargo vet --locked` audit failure in CI ## Context These unvetted dependencies were causing the Audit and Check CI jobs to fail on all PRs (including everruns#781).
acd8117 to
d315cce
Compare
|
@achicu hey! Thank you for contribution! Can you pls check if Copilot comments make sense, address them if needed, and then ping me when you feel PR is ready for merge? |
d315cce to
83c5bb2
Compare
When `find` was given multiple paths and one didn't exist, it would early-return with an error, discarding all stdout accumulated from previously valid paths. Now it continues processing all paths, collecting errors separately in stderr, and sets exit code 1 only if any path failed — matching real Unix find behavior. Co-Authored-By: Claude Opus 4.6 <[email protected]>
83c5bb2 to
2696ba9
Compare
|
All good, added some asserts. thank you! |
## Summary Release v0.1.13 — patch release with 5 PRs since v0.1.12. ### Highlights - **First contribution from @achicu!** Fixed `find` with multiple paths silently discarding results when one path is missing (everruns#781) - **Python/Node binding parity** — both bindings now expose the same API surface (everruns#785) - **Live mount/unmount** on running `Bash` instances for dynamic filesystem composition (everruns#784) ### What's Changed * fix(examples): exit langchain example to prevent NAPI event loop hang (everruns#786) by @chaliy * feat(bindings): add Python/Node binding parity (everruns#785) by @chaliy * feat(fs): expose live mount/unmount on running Bash instance (everruns#784) by @chaliy * chore: add cargo-vet exemptions for jni-sys 0.3.1, 0.4.1 and jni-sys-macros 0.4.1 (everruns#783) by @chaliy * fix: find with multiple paths no longer discards results on missing path (everruns#781) by @achicu
…macros 0.4.1 (#783) ## Summary - Adds `safe-to-deploy` exemptions for `jni-sys:0.3.1`, `jni-sys:0.4.1`, and `jni-sys-macros:0.4.1` - Fixes the `cargo vet --locked` audit failure in CI ## Context These unvetted dependencies were causing the Audit and Check CI jobs to fail on all PRs (including #781).
…ath (#781) When `find` was given multiple paths and one didn't exist, it would early-return with an error, discarding all stdout accumulated from previously valid paths. Now it continues processing all paths, collecting errors separately in stderr, and sets exit code 1 only if any path failed — matching real Unix find behavior.
## Summary Release v0.1.13 — patch release with 5 PRs since v0.1.12. ### Highlights - **First contribution from @achicu!** Fixed `find` with multiple paths silently discarding results when one path is missing (#781) - **Python/Node binding parity** — both bindings now expose the same API surface (#785) - **Live mount/unmount** on running `Bash` instances for dynamic filesystem composition (#784) ### What's Changed * fix(examples): exit langchain example to prevent NAPI event loop hang (#786) by @chaliy * feat(bindings): add Python/Node binding parity (#785) by @chaliy * feat(fs): expose live mount/unmount on running Bash instance (#784) by @chaliy * chore: add cargo-vet exemptions for jni-sys 0.3.1, 0.4.1 and jni-sys-macros 0.4.1 (#783) by @chaliy * fix: find with multiple paths no longer discards results on missing path (#781) by @achicu
When
findwas given multiple paths and one didn't exist, it would early-return with an error, discarding all stdout accumulated from previously valid paths. Now it continues processing all paths, collecting errors separately in stderr, and sets exit code 1 only if any path failed — matching real Unix find behavior.