Skip to content

fix(filters): aggresivity batch fix#1895

Merged
aeppling merged 7 commits into
developfrom
fix/aggressive-filters-batch
May 19, 2026
Merged

fix(filters): aggresivity batch fix#1895
aeppling merged 7 commits into
developfrom
fix/aggressive-filters-batch

Conversation

@aeppling
Copy link
Copy Markdown
Contributor

Summary

  • Some filter were too aggressive, lower filtering & more accurate results

aeppling and others added 3 commits May 15, 2026 19:12
…iltering

Several filters dropped or rewrote information an agent needs, producing
output that was misleading rather than merely compressed. This fixes the
clear-cut cases surfaced by the TheDecipherist/rtk-test suite:

- ls: stop hiding the `.env` file (removed `.env`/`env` from NOISE_DIRS).
- git status: restore the explicit "HEAD detached at <sha>" line instead of
  the opaque "* HEAD (no branch)".
- log/docker logs: recognise CRITICAL/FATAL/ALERT/EMERGENCY/SEVERE (and
  NOTICE) as severities so those lines are no longer silently filtered;
  expose `log` as a `rtk pipe` filter and accept a positional filter name.
- wc: forward stdin to the child so `cat file | rtk wc` counts the pipe
  instead of reporting 0 (new RunOptions::inherit_stdin).
- jest/vitest: include skipped/pending test count in the compact summary.
- pytest: surface xfailed/xpassed counts and list XFAIL/XPASS entries with
  their reasons (adds `-rxX`).
- ruff/eslint: list individual violations with file:line:col, not just
  rule/file group counts.
- pnpm/npm list: render the actual package list instead of the false-positive
  "All packages up-to-date" when there's no upgrade info.
- git add: stay silent on a no-op instead of printing an ambiguous "ok".
- git stash: pass git's own message through instead of collapsing to "ok".
- docker ps: keep the Status column (health/restart info) and list
  stopped/exited containers; docker images: show all images with full names;
  docker compose ps: use `-a` so crashed services stay visible.

All 1870 unit tests pass; cargo fmt + clippy clean.
@aeppling aeppling changed the title fix: filter aggresivity batch fix fix(filters): aggresivity batch fix May 15, 2026
Copy link
Copy Markdown
Collaborator

@KuSh KuSh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpicks and questions. Otherwise LGTM!

Comment thread src/cmds/cloud/container.rs Outdated
}
}
if running.len() > 20 {
rtk.push_str(&format!(" ... +{} more\n", running.len() - 20));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick, prefer utf8 character

Suggested change
rtk.push_str(&format!(" ... +{} more\n", running.len() - 20));
rtk.push_str(&format!(" +{} more\n", running.len() - 20));

Comment thread src/cmds/cloud/container.rs Outdated
if count > 15 {
rtk.push_str(&format!(" ... +{} more", count - 15));
if stopped.len() > 20 {
rtk.push_str(&format!(" ... +{} more\n", stopped.len() - 20));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rtk.push_str(&format!(" ... +{} more\n", stopped.len() - 20));
rtk.push_str(&format!(" +{} more\n", stopped.len() - 20));

Comment thread src/cmds/cloud/container.rs Outdated
if lines.len() > 15 {
rtk.push_str(&format!(" ... +{} more", lines.len() - 15));
if lines.len() > MAX_IMAGES {
rtk.push_str(&format!(" ... +{} more\n", lines.len() - MAX_IMAGES));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rtk.push_str(&format!(" ... +{} more\n", lines.len() - MAX_IMAGES));
rtk.push_str(&format!(" +{} more\n", lines.len() - MAX_IMAGES));

Comment thread src/cmds/git/git.rs Outdated

// Porcelain `-b` reduces a detached HEAD to "## HEAD (no branch)"; restore
// the explicit "HEAD detached at <sha>" from the plain status we captured.
if let Some(detached) = extract_detached_head(&raw_output) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to check that before calling format_status_output and pass it detached instead of replacing the result afterward?

if pkgs.len() > 10 {
result.push_str(&format!(" ... +{} more\n", pkgs.len() - 10));
if pkgs.len() > MAX_PER_LETTER {
result.push_str(&format!(" ... +{} more\n", pkgs.len() - MAX_PER_LETTER));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while you're at it:

Suggested change
result.push_str(&format!(" ... +{} more\n", pkgs.len() - MAX_PER_LETTER));
result.push_str(&format!(" +{} more\n", pkgs.len() - MAX_PER_LETTER));

Comment thread src/cmds/python/ruff_cmd.rs Outdated
}
if diagnostics.len() > MAX_VIOLATIONS {
result.push_str(&format!(
" ... +{} more violations\n",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" ... +{} more violations\n",
" +{} more violations\n",

Comment thread src/parser/formatter.rs
lines.push(format!(" {} {}{}", dep.name, dep.current_version, dev));
}
if self.dependencies.len() > 50 {
lines.push(format!(" ... +{} more", self.dependencies.len() - 50));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lines.push(format!(" ... +{} more", self.dependencies.len() - 50));
lines.push(format!(" +{} more", self.dependencies.len() - 50));

Comment thread src/parser/formatter.rs
Comment on lines +131 to +134
for dep in self.dependencies.iter().take(50) {
let dev = if dep.dev_dependency { " (dev)" } else { "" };
lines.push(format!(" {} {}{}", dep.name, dep.current_version, dev));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a hierarchy in deps? dep > dev dep > opt dep > ... shouldn't we first print dependencies, then if < 50 pick dev dependencies until we reach 50?

@pszymkowiak
Copy link
Copy Markdown
Collaborator

Tested the branch build against real commands — solid work, the filters no longer hide crashed containers, skipped/xfail tests, ruff locations, or report a false up-to-date. 11 commands verified end-to-end. Two points before merge:

1. git stash no-op is mis-reported on non-English locales (git.rs:1510)

result.combined().contains("No local changes") matches an English-only string. On a FR locale git stash prints "Pas de modifications locales à sauver", so the check fails and a no-op stash prints ok stashed — telling the agent its changes were saved when nothing was. (Verified on a FR machine.)

This is the tip of a larger issue: git.rs matches localized git output in ~9 places (rebase/merge detection L750-762, nothing to commit L846/L1078, Everything up-to-date L1123, Already up to date L1183, shortstat parsing L1194-1210…). The robust fix is to run rtk's internal git invocations with LC_ALL=C so git emits stable English — worth a dedicated change. At minimum, L1510 should not regress a no-op into ok stashed.

2. constants.rs — removing env/.env from NOISE_DIRS is the only change with no test and no rationale. env/ is a very common Python virtualenv dir; dropping it can flood rtk tree/find/grep with venv noise. Could you add a line explaining the intent (and ideally a test)?

Everything else is good to go.

aeppling added 3 commits May 16, 2026 15:00
- fix signal truncation gaps + kush reviews
- added a new tee and hints function to give an hint with tail (avoid re-ingest of the head)
- extracted patterns in constants
- docker ps reverts to plain (no -a augmentation)
- docker ps -a / compose ps -a wired to the running/stopped split filter
- ruff Violations: capped at 50 + force_tee_tail_hint recovery
- tests for the ruff and pytest xfail caps
@aeppling aeppling merged commit 90c285c into develop May 19, 2026
17 checks passed
@aeppling aeppling mentioned this pull request May 19, 2026
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.

3 participants