Commit Graph

1198 Commits

Author SHA1 Message Date
aesoft d86f0073ec Merge pull request #2498 from hgunduzoglu/fix/git-status-compact-exit-code
fix(git): propagate exit code on git status failure in compact path
dev-0.43.0-rc.288
2026-06-26 11:49:23 +02:00
Husam a271b5e003 chore: re-trigger CI (transient crates.io download failure on windows runner) 2026-06-26 12:10:00 +03:00
Husam ee5a675f40 refactor(git): drop explanatory comment on status failure guard
Per review (#2498): the guard is self-explanatory; remove the comment
to avoid noise.
2026-06-26 11:35:00 +03:00
aesoft af81b08175 Merge pull request #2554 from rtk-ai/fix/global-never-worse-guard
fix(core): never-worse output guard
dev-0.43.0-rc.287
2026-06-25 09:02:04 +02:00
Adrien Eppling 5a344524e3 test(bench): drop env --show-all (flag removed) 2026-06-24 20:37:04 +02:00
Adrien Eppling 3d4189cc63 fix(docker): report 0 containers/images instead of empty output 2026-06-24 20:37:02 +02:00
Adrien Eppling 9870c1c8bc Merge remote-tracking branch 'origin/develop' into fix/global-never-worse-guard
# Conflicts:
#	src/cmds/system/grep_cmd.rs
2026-06-24 20:11:28 +02:00
Adrien Eppling 25a095e90d fix(aws): guard the s3 ls and s3 sync/cp text emits 2026-06-24 19:27:06 +02:00
Adrien Eppling b52db52da0 fix(docker): make the agent's command authoritative for the guard baseline
docker ps/ps -a/images ran a plain command for the raw baseline and a
separate --format command for parsing, capturing the plain run with
unwrap_or_default(). A failed plain run while --format succeeded left
raw empty, and never_worse("", summary) dropped real output.

Run the agent's actual command first as the source of truth: on failure
show its output/exit faithfully; on success use its stdout as raw and
treat --format as a best-effort parse aid that falls back to raw. The
guard stays pure and always sees a real baseline. Parsers unchanged.
2026-06-24 18:44:42 +02:00
Adrien Eppling 9a2ad90360 fix(read): make guard baseline faithful to cat/cat -n output
Compare filtered output against the raw the agent's command would
emit (numbered for -n), not against unnumbered content, so the
guard keeps requested line numbers instead of dropping to plain.
2026-06-24 16:43:54 +02:00
Adrien Eppling 9d9ad7cb17 fix(pipe): apply the never-worse guard
pipe filters piped stdin but bypassed the guard; route its output through
never_worse like every other compressor.
2026-06-24 14:32:25 +02:00
Adrien Eppling 223dda2996 fix(env): clean up feature from secrets rewrite
Masking env secrets is not what core RTK (OSS) is for -- it compresses command
output, it does not redact what the command itself already reveals. It also
broke raw-vs-filtered consistency, which the never-worse guard relies on.
2026-06-24 11:18:32 +02:00
aesoft ee9e2f8a2a Merge pull request #2550 from rtk-ai/fix/grep-context-flags
fix(grep): correctly handle all flag shapes and never exceed raw output
dev-0.43.0-rc.286
2026-06-23 21:54:56 +02:00
Adrien Eppling 861a46dee5 fix(core): never-worse output guard so RTK never exceeds the raw command
RTK could emit more tokens than the underlying command on small inputs:
filters that add headers, summaries, re-indentation, or a tee hint, plus
synthetic no-result messages ("0 matches", "No stashes", "[docker] 0
containers") printed where the raw command emitted nothing. Both break the
Transparency principle and inflate tokens instead of saving them.

- core::guard::never_worse(raw, filtered) returns raw when the filtered form
  has more tokens (reuses tracking::estimate_tokens), so RTK output is never
  larger than the real command.
- runner::emit_guarded(filtered, hint, raw) composes body + tee hint, guards
  the whole, prints, and returns what was shown so printed == tracked.
- run_captured_filter guards the run_filtered* family centrally; per-site
  guards cover the remaining single-string filters.
- On empty raw, emit empty and preserve the exit code instead of a synthetic
  no-result message (the messages were cosmetic with no dependents; #2461
  reports the grep one as actively harmful).
- git stash show now propagates its exit code instead of masking a real
  failure as Ok(0).

Resolves #2551.
2026-06-23 21:53:35 +02:00
aesoft ced70c6f0d Merge pull request #1334 from wlami/feat/pulumi-add-cli-filters
feat(pulumi): add CLI filters for preview/up/destroy/refresh/stack
dev-0.43.0-rc.285
2026-06-23 21:39:20 +02:00
Adrien Eppling 3a59d23235 test(grep): cover bundled -rln files-with-matches cluster (#2543)
Review feedback on #2550: the flag-shape tests all used standalone flags, leaving the exact #2543 repro -- a bundled -rln/-ln files-with-matches cluster -- unexercised. Assert rtk grep -rln <pat> <dir> lists matching files instead of a false '0 matches'.
2026-06-23 16:09:29 +02:00
Wladi Mitzel 5cfe4d5f87 fix(pulumi): keep Owner and version in pulumi-stack filter
Per review: avoid signal loss that pushes agents to retry with
`rtk proxy`. pulumi-stack now keeps the full stack identity block
(Owner:, Pulumi version used:) alongside the header and Last updated:.
Only interactive prompt and help-footer noise is stripped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:51:39 +02:00
Adrien Eppling 0adfae6cf6 fix(grep): correctly handle all flag shapes and never exceed raw output
The grep argument-parsing rework routed many flag shapes through the
grouping reparse, which silently dropped any line it could not parse and
returned a success exit. Common invocations produced wrong or empty
output -- and grep-only syntax like `--include` failed outright -- which
pushed agents back to unfiltered `rtk proxy grep`.

Every valid grep invocation now produces correct output:

- Context (`-A`/`-B`/`-C`) is grouped and compressed instead of dropped;
  the header counts matches only and context lines are shown.
- Output the reparse cannot represent (`-N`, `-I`, `--color`, `-p`,
  `--heading`, binary-file notices, ...) is passed through verbatim
  instead of reported as a false "0 matches".
- Format/shape flags (`-c`, `-l`, `-o`, `-Z`, `--column`, `-b`,
  `--vimgrep`, `--null-data`) pass through cleanly with no NUL leak.
- grep-only syntax (`--include`, `--exclude`, ...) works: ripgrep is the
  fast path and rtk falls back to system grep when ripgrep rejects a flag.
- rtk grep never emits more than plain grep: if grouping is not smaller
  than `file:line:content`, the raw form is shown.

Resolves #2543.
2026-06-23 13:16:27 +02:00
Wladi Mitzel 1f6e36b27e fix(pulumi): keep stack identity in pulumi-stack filter
Stop stripping `Current stack is X:` and `Last updated:`. pulumi stack
is read-only (exit 0) so there's no tee fallback; dropping the active
stack identity was irreversible signal loss. Keeping the header also
fixes the orphaned indented `Managed by <user>` line.

Owner: and Pulumi version used: remain stripped as noise.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 07:57:18 +02:00
aesoft 6946bf9562 Merge pull request #2502 from Tailoo/fix/2501-dotnet-test-failure-dedup
fix(dotnet): stop duplicating failures on failing test runs (#2501)
dev-0.43.0-rc.284
2026-06-22 15:50:05 +02:00
Wladi Mitzel 729ac36682 Merge remote-tracking branch 'upstream/develop' into feat/pulumi-add-cli-filters
# Conflicts:
#	src/core/toml_filter.rs
2026-06-22 13:41:33 +02:00
Tailoo 5e7eab5846 fix(dotnet): keep raw fallback when parsed failures incomplete
test_needs_raw_fallback dropped the raw stdout prepend whenever every
parsed failure carried detail, but never checked the list was complete
against summary.failed. A run reporting 5 failures but parsing only 3
detailed blocks would silently lose the 2 unparsed failures.

Add a `failed_tests.len() < summary.failed` clause so the raw fallback is
kept when the structured section is numerically incomplete. Add a
regression test and fix an inconsistent existing fixture (failed: 5 with a
single parsed entry) that the new clause correctly flagged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 22:41:00 +02:00
aesoft e3f60e9822 Merge pull request #2294 from jsiu93/fix/vitest-reporter-passthrough
fix(vitest): preserve explicit reporters
dev-0.43.0-rc.283
2026-06-20 17:17:41 +02:00
xiaozh f9469d12cf fix(vitest): add passthrough recovery hint
Explicit Vitest reporters can produce successful output that exceeds the passthrough cap. Track truncation as structured state and use force_tee_hint so the full verbose output remains recoverable.
2026-06-20 19:31:01 +08:00
aesoft 444f1c0908 Merge pull request #2514 from rtk-ai/fix/oc-classification-resync
fix(tests): resync & list oc as passthrough for test
dev-0.43.0-rc.282
2026-06-19 17:25:14 +02:00
Adrien Eppling d2babe2bfb test(main): classify oc subcommand in PASSTHROUGH allowlist 2026-06-19 13:15:20 +02:00
Adrien Eppling 177242ad83 Merge remote-tracking branch 'origin/master' into fix/oc-classification-resync 2026-06-19 11:29:58 +02:00
Tailoo 2d9dc1ab9e fix(dotnet): stop duplicating failures on failing test runs
On failing `dotnet test` runs the orchestrator prepended the full raw
stdout ahead of the filtered summary. The `Failed Tests:` section already
reproduces each failure (name + message + clipped stack) parsed from
TRX/console, so every failure was printed twice — inflating output +65%
vs raw, scaling linearly with failure count (issue #2501).

Gate the raw-stdout prepend behind `test_needs_raw_fallback`: skip it when
the structured section carries detail, keep it when the filter is blind
(no failures parsed, or a parsed failure has empty detail — e.g. a
self-closing <UnitTestResult> with no <ErrorInfo>, or a build failure /
crash where nothing reaches failed_tests).

Extracts two pure, unit-tested fns (`test_needs_raw_fallback`,
`compose_failure_output`) so the orchestration decision is covered without
running dotnet.

Closes #2501

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 22:46:27 +02:00
aesoft 39cbb96897 Merge pull request #2243 from Alcamech/feat/oc-support
feat(oc): add Openshift CLI support with shared k8s filtering
2026-06-18 22:08:08 +02:00
Husam 756c2a4ce8 fix(git): propagate exit code on git status failure in compact path
The compact status path only caught the "not a git repository" error and
let every other failure (corrupt index, lock contention, broken refs)
fall through to a formatted "Clean working tree" + Ok(0), masking a real
git error. The non-compact path already guards on result.success(); apply
the same guard to the compact path, keeping the friendly not-a-repo
message and propagating git's real exit code otherwise.

Part of #2497
2026-06-18 22:53:49 +03:00
Ousama Ben Younes 3572d11e26 refactor(grep): extract error-exit decision into pure unit-tested fn
Address KuSh review on #2465:
- Move the `exit_code >= 2` decision into a pure `is_grep_error_exit`
  function and unit-test it directly (0/1 = normal, >=2 = error),
  instead of faking the rg binary in an integration test.
- Drop the GREP_ERROR_EXIT const; the doc comment on the function
  conveys the grep/rg exit convention.
- Remove tests/grep_error_test.rs (faked binary) in favour of the
  unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dev-0.43.0-rc.280
2026-06-18 17:06:14 +02:00
Ousama Ben Younes fa7e5102a3 style(test): cargo fmt grep_error_test.rs
Wrap the rtk binary path expression per rustfmt to satisfy
`cargo fmt --all -- --check` on CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:06:14 +02:00
Ousama Ben Younes 99969e02e2 test(grep): gate grep_error_test with #![cfg(unix)] for Windows CI
The test simulates a broken `rg` via a chmod'd shell script (from_mode,
PermissionsExt) which is unix-only. The unconditional `use std::os::unix`
broke compilation of the integration-test crate on the Windows CI target.
Gate the whole file so Windows stays green while preserving unix coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:06:14 +02:00
Ousama Ben Younes d727db3fa1 fix(grep): surface error on exit code >= 2 instead of false "0 matches"
Exit codes >= 2 signal real errors in grep/rg (bad regex, tool
crash, missing binary). rtk was only checking the narrow case
exit_code == 2 with non-empty stderr, letting any other error
exit masquerade as a clean "0 matches" false negative.

Now any exit code >= 2 surfaces the error to stderr instead of
printing a false zero-match result.

Fixes #2461
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 17:06:14 +02:00
aesoft c8722bd55e Merge pull request #2416 from BrokkAi/fix/hook-uv-run-pytest
fix(hook): rewrite pytest under uv run
dev-0.43.0-rc.279
2026-06-18 16:13:32 +02:00
Jonathan Ellis 34441dd464 fix(hook): treat uv run as a transparent prefix 2026-06-18 03:53:27 -05:00
Lawton Mizell c7f493b0cd feat(oc): add Openshift CLI support with shared k8s filtering 2026-06-17 10:08:28 -04:00
vegetablechicken233 abe7d4210e fix(grep): use portable --null in system grep fallback (BSD/macOS)
The system-grep fallback (used when ripgrep is not installed) passed
-rnHZ, relying on -Z for the NUL filename separator the match parser
requires. -Z only means --null on GNU grep; on BSD/macOS grep it is an
alias for --decompress (zgrep mode), so output is plain
file:line:content with no NUL. parse_match_line() then matches zero
filenames and every result collapses into "N matches in 0 files" with
all lines hidden behind [+N more].

Use the long option --null instead, which both GNU and BSD grep define
as "print a zero-byte after the file name".

Related to #2310

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dev-0.43.0-rc.278
2026-06-16 23:41:13 +02:00
aesoft 3a73bcdffc Merge pull request #2394 from hgunduzoglu/fix/diff-modified-lines-false-identical
fix(diff): report modified-only diffs and follow diff exit convention
dev-0.43.0-rc.277
2026-06-16 20:29:49 +02:00
aesoft d8c550eefb Merge pull request #2333 from KuSh/grep_arg_parsing
fix(grep): stabilize argument parsing — trailing_var_arg, -v invert-match, --version passthrough, safe rg invocation
dev-0.43.0-rc.276
2026-06-14 18:23:19 +02:00
Nicolas Le Cam 307b557383 feat(grep): sort content alphabetically 2026-06-14 15:31:20 +02:00
Nicolas Le Cam 34aac6ed95 refactor(grep): extract parse_cluster to make cluster parsing directly testable
The left-to-right scanning logic now lives entirely in parse_cluster(), which
returns a ClusterResult enum (Boolean or ValueTaking). extract_pattern_path
just dispatches on the result — no loop logic inline.

parse_cluster() is the only place that touches cluster bytes, so the full
contract is testable in isolation:

  parse_cluster("ecarrot") → ValueTaking { prefix: None, flag: 'e', inline: "carrot" }
  parse_cluster("rne")     → ValueTaking { prefix: Some("n"), flag: 'e', inline: "" }
  parse_cluster("g*.rs")   → ValueTaking { prefix: None, flag: 'g', inline: "*.rs" }
  parse_cluster("rn")      → Boolean(Some("n"))

strip_r() remains as the focused r/R-stripping helper used internally by
parse_cluster (and tested directly to document the "carrot"→"caot" danger).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 15:29:21 +02:00
Nicolas Le Cam 8d29f75833 fix(grep): restore strip_r as explicit testable helper + pre-existing clippy fix
The left-to-right cluster scan now calls strip_r() at emit time on the
accumulated flag-letter prefix (raw_prefix), never on inline value bytes.
This makes the safety contract explicit and testable: strip_r("carrot")
produces "caot", documenting exactly why it must not touch value bytes.

Also fix pre-existing unused-mut in aws_cmd.rs (has_output_flag).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 15:29:21 +02:00
Nicolas Le Cam b7d93b509e fix(grep): left-to-right cluster scan, long value flags, format passthrough
Five regressions on grep_arg_parsing vs develop:

- `-ecarrot` matched "caot" — strip_r was applied to the inline value bytes.
  Fix: scan cluster left-to-right; stop at first value-taking letter and
  treat the remainder as the inline value without r/R stripping.

- `-g*.rs` glob became `*.s` — same root cause, inline glob value r-stripped.

- `--glob '*.md'` took `*.md` as a path — no VALUE_FLAGS_LONG existed; the
  value token fell through to the positional collector.
  Fix: add VALUE_FLAGS_LONG covering all rg long flags that take a value.

- `--max-count 1 fn file` took `1` as the pattern — same missing long flag.

- VALUE_FLAGS_SHORT expanded: add t/T (--type/--type-not), d (--max-depth),
  M (--max-columns) so inline short forms and space-separated forms parse
  correctly without mis-routing values to patterns or paths.

- --regexp (long form of -e) now routes to patterns like -e does.

- has_format_flag: add --count-matches, --json, --passthru, --files so
  these output-format modes get passthrough treatment instead of silent
  "0 matches in 0 files".

2183 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 11:44:32 +02:00
aesoft 8a7dd7e557 Merge pull request #2406 from rtk-ai/release-please--branches--master--components--rtk
chore(master): release 0.42.4
v0.42.4
2026-06-12 18:06:05 +02:00
rtk-release-bot[bot] f1dc9f0558 chore(master): release 0.42.4 2026-06-12 15:19:00 +00:00
aesoft 769b6ce5a4 Merge commit from fork
fix(security): harden installer checksum, filter-trust, meta-command
2026-06-12 17:18:09 +02:00
aesoft 069a089c40 fix(security): harden meta command list check
fail in cicd before letting meta command omission reach production
2026-06-12 14:56:27 +02:00
aesoft 9cc4937dac fix(security): harden installer checksum, filter-trust, meta-command fallthrough 2026-06-12 14:01:04 +02:00
aesoft c75342424e Merge pull request #2291 from rtk-ai/develop
Next Release
2026-06-12 08:52:50 +02:00