Skip to content

fix: keep filter output faithful for find, ls -R, env, and cargo#2272

Open
sysrow wants to merge 4 commits into
rtk-ai:developfrom
sysrow:fix/filter-output-faithfulness
Open

fix: keep filter output faithful for find, ls -R, env, and cargo#2272
sysrow wants to merge 4 commits into
rtk-ai:developfrom
sysrow:fix/filter-output-faithfulness

Conversation

@sysrow
Copy link
Copy Markdown

@sysrow sysrow commented Jun 4, 2026

Summary

Keeps RTK's filtered output faithful to the data that was requested, in four cases (one fix per commit):

  • find: truncate at directory boundaries instead of mid-directory, mark a partial directory explicitly ((+N more here)), and report the remainder per directory (+N more in M more dir(s)) so whole missing directories stay visible.
  • ls -R: parse and render per path: section so directory headers are preserved instead of flattened; non-recursive output is unchanged. Adds tests for both cases.
  • env: surface uncategorized secret-bearing variables in a Sensitive (masked) section instead of dropping them entirely (values stay masked, so nothing leaks).
  • cargo: label the summary with the actual subcommand, so rtk cargo check no longer reports cargo build.

Closes #2271

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test (all green)
  • Manual testing: rtk <command> output inspected before/after for find, ls -R, env, and cargo check

sysrow added 4 commits June 4, 2026 23:05
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.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 4, 2026

CLA assistant check
All committers have signed the CLA.

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.

Some filters drop or misrepresent requested data (find, ls -R, env, cargo label)

2 participants