fix: keep filter output faithful for find, ls -R, env, and cargo#2272
Open
sysrow wants to merge 4 commits into
Open
fix: keep filter output faithful for find, ls -R, env, and cargo#2272sysrow wants to merge 4 commits into
sysrow wants to merge 4 commits into
Conversation
The --max budget was counted across directories, so the last shown
directory could be cut after only some of its files while still being
rendered as a normal "dir/ files" line. A reader could not tell it was
partial and would read it as complete, and the trailing "+N more" was
attributed to other directories.
Truncate at directory boundaries instead: every fully shown directory is
complete, a directory that alone exceeds the budget is marked explicitly
"(+N more here)", and the remainder is reported per directory
("+N more in M more dir(s)") so whole missing directories stay visible.
CargoBuildHandler is shared by `cargo build` and `cargo check`, but its summary string was hardcoded to "cargo build", so `rtk cargo check` reported "cargo build (N crates compiled)". Thread the subcommand into the handler and render it, so check and build are labeled correctly.
`ls -R` prints one "path:" section per directory. The compactor parsed every section into a single flat list and dropped the headers, so files could no longer be mapped to their directory (a dozen distinct mod.rs entries became indistinguishable, and the output could even be larger than the raw listing). Parse and render per section, keeping each directory's entries under its "path:" header. Non-recursive output is a single header-less section and is rendered exactly as before. Adds tests for both cases.
A sensitive variable that did not match a known category (cloud, tool, language, ...) fell through every bucket and was omitted entirely, so `rtk env` implied it was unset. Route such variables into a "Sensitive (masked)" section that shows the masked value, so the reader knows the variable is set without leaking it.
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.
Summary
Keeps RTK's filtered output faithful to the data that was requested, in four cases (one fix per commit):
(+N more here)), and report the remainder per directory (+N more in M more dir(s)) so whole missing directories stay visible.path:section so directory headers are preserved instead of flattened; non-recursive output is unchanged. Adds tests for both cases.Sensitive (masked)section instead of dropping them entirely (values stay masked, so nothing leaks).rtk cargo checkno longer reportscargo build.Closes #2271
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test(all green)rtk <command>output inspected before/after for find, ls -R, env, and cargo check