Repository navigation
Conversation
📊 Automated PR Analysis
SummaryAdds --sort, --reverse, --limit, --filter, and --exclude controls to the Review Checklist
Linked issues: #1700 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
yeahjack
marked this pull request as ready for review
October 4, 2026 20:22
yeahjack
force-pushed
the
feat/gain-command-controls
branch
from
October 19, 2026 10:26
a43e77f to
51c8b27
Compare
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
--sort saved|count|ratio,--reverse,--limit N(0for all), and literal--filter/--excludecontrols to thertk gainBy Command table.Addresses #1700.
Usage and compatibility
rtk gain --sort count --limit 25 rtk gain --sort ratio --reverse rtk gain --filter gradle --exclude test rtk gain --project --limit 0 --format jsonThe default stays at ten rows sorted by saved tokens. Filters are case-sensitive literal substrings of the full recorded RTK command. They affect the By Command rows; summary totals, graph, history, and quota retain their current scope. Command-table controls conflict with temporal/failure/recall/reset views rather than being silently ignored;
--allretains its existing temporal meaning.Summary JSON adds
by_commandrecords withcommand,count,saved_tokens,savings_pct, andavg_time_ms. Summary CSV now exports those columns, with full command names and CSV escaping. Temporal export schemas stay unchanged.Accounting semantics are preserved: sorting uses signed recorded savings before the existing display clamp; ratios remain
SUM(saved_tokens) / SUM(input_tokens), with zero-input groups returning zero. A derived potential score and a pager are outside this change.Test plan
Verified locally on Linux with Rust 1.99.0:
cargo fmt --all --checkcargo clippy --locked --all-targetscargo test --locked --all: 4,123 passed, zero failed, eight existing ignoredGIT_DIR,RTK_DB_PATH,RTK_NO_TOML, andRTK_TEEvaluesdevelopand pass with this implementationcargo build --locked --releaseand isolated release-binary smoke checks for count sorting beyond the old top ten, unlimited results, and CSV selectiongit diff --checkand repository test-presence checkThe eight existing ignored tests were not run locally.
Windows CI follow-up
The initial CI run exposed a Windows test-thread stack overflow in Clap's large generated command parser. The follow-up commit isolates only the five new options in a boxed, flattened argument group. Existing option names, defaults, conflicts, and query behavior are preserved; global stack settings are unchanged.
After the fix, CI run 37138579529 passes on head
7445367: Linux, Windows, and macOS tests, benchmark, fmt/clippy, security scan, and Semgrep. Windows explicitly passes the previously overflowing parser test and all ten new gain integration tests. CLA also passes. The optional AI documentation-review step was skipped because the repository API key is not configured.