fix(find): fall back to raw find for unsupported flags#2160
Open
mariuszs wants to merge 1 commit into
Open
Conversation
rtk find errored out (anyhow::bail!) on native find features it can't
model — compound predicates (-not/-or), actions (-exec/-delete), and
time/size/perm tests — forcing the user to reach for `rtk proxy find`.
This violated RTK's mandated fallback pattern ("if filter fails, execute
raw command unchanged; never block the user"). run_from_args now detects
unsupported flags and streams the real `find` via run_passthrough,
tracking at 0% savings and mirroring the child exit code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rtk finderrors out when given nativefindfeatures it can't model in its structured walker — compound predicates (-not,-or,-and), actions (-exec,-execdir,-delete,-print0), and time/size/perm tests (-size,-mtime,-perm, …):This forces users to reach for
rtk proxy find ... | rtk proxy xargs ...to get any result, and it contradicts RTK's fallback principle: if a filter can't handle the input, run the real command unchanged rather than blocking the user.Fix
run_from_argsnow detects unsupported flags up front and falls back to the realfindviacore::runner::run_passthrough:rtk gain --history, likertk proxy),std::process::exitinmain()like every other command (run_from_argsnow returnsResult<i32>).Supported syntax (
-name,-iname,-type,-maxdepth, RTK shorthand) is unaffected — it still goes through the compact filter.Tests
unsupported_flags_detected/supported_flags_not_flagged_as_unsupported— flag classificationrun_from_args_falls_back_for_unsupported_flags—-notnow runs the realfindand returnsOk(0)instead of erroringparse_*_rejects_*tests that asserted the old blocking behaviorGate (
cargo fmt --all --check && cargo clippy --all-targets && cargo test --all) is green ondevelop: 1983 passed, 7 ignored, 0 clippy warnings.