Commit Graph

768 Commits

Author SHA1 Message Date
aesoft a4b7f7422e Merge pull request #2422 from luccinmasirika/fix/cargo-json-build-failure-2419
fix(cargo): surface --message-format=json build errors instead of "compiled"
2026-07-07 09:57:09 +02:00
guyoron1 34a0f0e5c0 fix(grep): only insert -- separator when context flags are active
Native grep only prints -- between non-adjacent match blocks when
-A/-B/-C context is requested. The grouped output path was inserting
-- on any line-number gap unconditionally, so `rtk grep -rn todo`
invented separators between every match that grep never emits.

Gate the insertion on has_context_flag() which checks for -A/-B/-C
and their long-form equivalents.
2026-07-06 09:21:11 +03:00
guyoron1 cae9b710d4 fix(grep): preserve -- separator between non-adjacent match blocks
When context flags (-A/-B/-C) are used, grep prints -- between
non-adjacent match blocks. parse_match_line() returned None for
this separator, and both output paths silently dropped it, merging
distinct matches into one contiguous block.

Fixes #2795
2026-07-06 09:21:03 +03:00
Luccin Masirika 1143e6fb63 docs(cargo): explain why run_test has no json branch 2026-07-03 19:48:56 +02:00
Luccin Masirika 6f67c9e6af refactor(cargo): drop CargoBuildHandler new/for_check wrappers 2026-07-03 19:45:49 +02:00
Luccin Masirika 39a4d28d21 refactor(cargo): drop dead json parse from the streamed build handler 2026-07-03 19:44:45 +02:00
Luccin Masirika a3e65e99e9 fix(cargo): give the json batch filter the exit code 2026-07-03 19:42:26 +02:00
Luccin Masirika e0c5306a65 refactor(cargo): put failure summary line first, reuse join_with_overflow 2026-07-03 19:34:04 +02:00
Luccin Masirika 8654edb4cb refactor(cargo): parse json diagnostics into typed structs, count ICE
Deserialize each compiler-message line into typed structs instead of
indexing serde_json::Value, mirroring filter_go_test_json. Route the
internal-compiler-error level into the errors bucket so an ICE is no longer
dropped.
2026-07-03 19:28:52 +02:00
aesoft 31f9d43d81 Merge pull request #2748 from rtk-ai/feat/toml-filters-in-hook
feat(hook): wire TOML filters + better tee tail hint
2026-07-03 16:51:04 +02:00
aesoft 1b38eece9b Merge pull request #2801 from rtk-ai/fix/git-stash-show-diffstat
fix(git): compact git stash show instead of forcing -p
2026-07-03 15:22:20 +02:00
Adrien Eppling b619ecfb24 test(git): update stash summary tests for comma-free format 2026-07-03 14:57:47 +02:00
aesoft 6c3d81f970 no commas 2026-07-03 14:06:23 +02:00
Adrien Eppling 0ac5f5c311 fix(git): compress git stash show summary line
Shorten "N files changed, X insertions(+), Y deletions(-)" to "N changed, X +, Y -"; numbers preserved, no signal loss.
2026-07-03 13:39:50 +02:00
Luccin Masirika 1f74614ea8 fix(cargo): keep "No issues found" wording for clean clippy json runs
Routing clippy json through the build filter reported a clean run as
"cargo clippy (N crates compiled)". Detect the clean case up front and emit
the same "cargo clippy: No issues found" the human path uses; errors and
warnings still route through the diagnostics summary.
2026-07-03 12:22:44 +02:00
Adrien Eppling c9468ee178 fix(analytics): floor prefix slices to char boundary instead of full-string fallback 2026-07-03 12:18:58 +02:00
Adrien Eppling add35e0928 fix(git): compact git stash show instead of forcing -p
Strip the diffstat decorations and cap the file list; savings are measured against the real command, not an inflated -p patch.
2026-07-03 12:14:01 +02:00
Luccin Masirika 59ed885752 fix(cargo): match the human path when skipping the json warning summary
cargo emits "\`crate\` generated N warnings" which ends in "warning", so the
ends_with("generated") check never matched it and the summary could inflate
the count. Use contains, matching the human-text skip elsewhere in the file.
2026-07-03 12:06:59 +02:00
Luccin Masirika c02becb79b refactor(cargo): thread label to handler in filter_cargo_build_labeled
The batch filter built the handler with a hardcoded "build" label. It is
unused today (only the free summary functions receive the label) but would
silently mislabel if the function ever called handler.format_summary. Pass
the real label through.
2026-07-03 12:05:37 +02:00
Luccin Masirika 25d6a09c01 fix(cargo): honor last --message-format when the flag is repeated
cargo uses last-flag-wins, so --message-format=json --message-format=human
builds in human format. Track the last occurrence instead of returning on
the first json match.
2026-07-03 12:04:22 +02:00
Luccin Masirika 751bf3e760 revert(cargo): drop --message-format=json install routing
cargo install --message-format=json is effectively never used, and routing
its success through the build filter dropped the "Installed <crate>" line
(cargo prints it as plain text, not a json record). Keep install on its
dedicated filter which preserves that information.
2026-07-03 11:59:41 +02:00
Luccin Masirika e4bfe3593c fix(cargo): restore failure check before trusting reused build filter
The !is_empty() guard was always true (filter_cargo_build_labeled never
returns empty), making the last-5-lines fallback dead code and letting a
success-shaped line through on a false-positive compile-error detection.
Check for the "cargo test:" failure summary instead.
2026-07-03 11:58:30 +02:00
Luccin Masirika 7fb9459fc6 fix(cargo): surface --message-format=json install errors 2026-07-03 11:19:34 +02:00
Luccin Masirika 58abbf253c fix(cargo): surface --message-format=json clippy errors 2026-07-03 11:16:35 +02:00
Luccin Masirika f9b720c8f7 fix(cargo): surface --message-format=json test compile errors 2026-07-03 10:58:13 +02:00
Luccin Masirika 90b4f5f40f fix(cargo): label check output as "check" instead of "build" 2026-07-03 10:56:26 +02:00
Adrien Eppling 47b22e03a4 fix(analytics): truncate display strings on UTF-8 char boundaries
rtk gain --history panicked with "byte index 22 is not a char
boundary" when a tracked command contained non-ASCII text (Cyrillic,
CJK, emoji). The same byte-slicing pattern existed in the --failures
display (top commands, recent failures, timestamp prefix) and in the
session id column of rtk session, all reproduced as real panics.

Replace the ad-hoc byte-based truncations with the shared char-safe
core::utils::truncate() helper, and use .get(..n).unwrap_or() for the
timestamp and session id prefix slices so they fall back to the full
string instead of panicking. Output is byte-identical to the previous
behavior for pure-ASCII data.

Fixes #2787
2026-07-02 15:28:41 +02:00
Adrien Eppling 2d487cb947 fix(trust): surface parse errors, skip already-trusted files, fail loudly when non-interactive 2026-07-02 13:35:54 +02:00
Adrien Eppling 315a94398e fix(filter): address review findings in the TOML filter path
Recoverable loss for a fired head/max cut (never a bare marker), schema-gate the hook match set, parse-error probe for trust; + tests.
2026-07-02 13:35:53 +02:00
Luccin Masirika 6c9a60d83e fix(cargo): tighten json warning-summary skip to ends_with
contains("generated") could swallow a real diagnostic mentioning both
"warning" and "generated"; the rustc summary record ends with "generated",
so match that precisely.
2026-07-02 01:18:11 +02:00
Luccin Masirika d12528055c test(cargo): drop flaky tee-capture test
The test set a shared RTK_TEE_DIR and read back the tee file, but with the
finding-1 tee call other parallel tests now write to the same dir and the
max_files cleanup could evict the file before the read. The overflow line and
true totals are already covered by test_filter_cargo_build_json_errors_capped,
and force_tee_hint has its own tests in core/tee.rs.
2026-07-02 01:11:07 +02:00
Luccin Masirika 5ea03f3d1b feat(cargo): route --message-format=json builds through explicit arg detection
Detect --message-format=json (and the json-* variants, inline and
space-separated) in the args and route build/check to the batch
filter_cargo_build path instead of inferring json mode from output content.
Makes json routing an explicit decision and removes reliance on the
has_compile_errors invariant.
2026-07-02 00:34:06 +02:00
Luccin Masirika 9f20821e7c refactor(cargo): single-alloc cargo_build_success_line 2026-07-01 21:38:54 +02:00
Luccin Masirika ff6cebda45 refactor(cargo): extract shared json diag count merge 2026-07-01 21:38:11 +02:00
Luccin Masirika cf1caf93b8 fix(cargo): tee-hint dropped json diagnostics beyond the cap 2026-07-01 21:37:36 +02:00
Luccin Masirika b47653a9ec fix(cargo): strip ansi from json rendered diagnostics 2026-07-01 21:33:56 +02:00
Luccin Masirika 9ae0872aee fix(cargo): skip "N warnings generated" record in json diagnostics 2026-07-01 21:30:36 +02:00
Adrien Eppling 34c0bcf2da perf(hook): match TOML filters with a match-only RegexSet
The rewrite path only needs a yes/no match, not the full compiled pipeline find_matching_filter forces on every not-in-RULES command (~10ms/call saved; selection still uses find_matching_filter in run_fallback).
2026-07-01 16:35:08 +02:00
Adrien Eppling a4872d9bbf fix(gain): note untrusted custom filters so they can be re-trusted 2026-07-01 15:55:45 +02:00
Adrien Eppling bbeee4c85e docs(trust): fix README to match silent skip; note global-filter migration 2026-07-01 15:41:54 +02:00
Adrien Eppling a9c33e2987 fix(trust): label detected filters as project- or global-scoped 2026-07-01 15:11:17 +02:00
Adrien Eppling e0a83ac824 feat(trust): rtk trust uses the same opt-in prompt as init
Concise filter list + [y/N] (--yes for non-interactive); drops the full-file dump and silent auto-trust. Shared prompt helper with init.
2026-07-01 14:46:38 +02:00
Adrien Eppling 9d3b678242 fix(trust): skip untrusted filters silently on the command path
The warning printed to stderr on every rewritten command, adding tokens; trust is surfaced only in `rtk init`/`rtk trust`.
2026-07-01 14:46:37 +02:00
Nicolas Le Cam 32dda24e5b Merge pull request #2751 from guyoron1/fix/cjk-emoji-char-boundary-panic
fix(parser): use byte offsets instead of char indices in extract_json_object
2026-07-01 13:31:19 +02:00
Adrien Eppling 1130a7cafd feat(trust): gate custom filters (project + user-global) + init opt-in flags
Trust-gate both filter files; `rtk init` prompts to enable detected filters, or --trust-filters/--no-trust-filters for scripts.
2026-07-01 13:18:35 +02:00
Ilia Alshanetsky d67fc28884 test(php): add token-savings assertion to paratest per cli-testing guide
.claude/rules/cli-testing.md marks token-savings verification as a 🔴
requirement for filters. Add a ≥60% savings assertion over a realistic
paratest run (banner + config + parallel-worker progress → one-line
summary), alongside the existing behavioral tests.
2026-07-01 06:18:31 -04:00
Ilia Alshanetsky 5e34f61f9c Merge remote-tracking branch 'origin/develop' into feat/php-tooling
# Conflicts:
#	src/main.rs
2026-07-01 06:17:07 -04:00
Ilia Alshanetsky fe755957e1 test(php): add paratest unit tests to satisfy test-presence gate
paratest_cmd.rs lacked the mandatory #[cfg(test)] module, failing the
check-test-presence CI gate. Add tests exercising the ParaTest-specific
path in filter_test_runner_output: banner + "Random Seed:" + dot progress
stripped, result summary and failure details preserved.
2026-07-01 06:11:33 -04:00
guyoron1 28948d9176 Merge branch 'develop' into fix/cjk-emoji-char-boundary-panic 2026-07-01 11:58:22 +03:00
guy oron 0632d838ed style: apply rustfmt to BUILTIN_TRANSPARENT_PREFIXES 2026-07-01 11:12:38 +03:00