Repository navigation
feat: passthrough fallback when Clap parse fails + review fixes - #200
Conversation
|
Tested locally — solid approach, needs rebase + 2 fixes before merge. Testing results:
Must fix:
Nice to have (non-blocking):
This will fix #204, #228, #229 and any future unknown-flag issues globally. Great work! |
0c07be2 to
8142173
Compare
@pszymkowiak Rebased and implemented requested changes. |
…tk-ai#217, rtk-ai#196, rtk-ai#248, rtk-ai#211, rtk-ai#200, rtk-ai#192, rtk-ai#268) Wave 1 (critical bugs): - fix(registry): fi/done moved to IGNORED_EXACT — find no longer shadowed (rtk-ai#246) - fix(playwright): f64 duration, specs[] structure, --reporter=json after subcmd (rtk-ai#193) - fix(gh): should_passthrough_gh_view for --json/--jq/--template/--web in view_pr/issue/run (rtk-ai#217+196) Wave 2 (reliability): - fix(git): is_blob_show_arg — blob show passthrough without trailing-newline trim (rtk-ai#248) - fix(find): parse_find_args with native -name/-type/-maxdepth/-iname support (rtk-ai#211) - fix(main): graceful Clap fallback + parse_failures SQLite table + rtk gain --failures (rtk-ai#200) Wave 3 (UX): - feat(git): global options -C/-c/--git-dir/--work-tree/--no-pager/--no-optional-locks/--bare/--literal-pathspecs (rtk-ai#192) - feat(proxy): streaming output via spawn()+threads instead of buffered output() (rtk-ai#268) Tests: 1091 → 1117 (+26), 0 regressions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Please rebase on master before we can merge — there are conflicts in |
When RTK cannot parse a command (e.g. `rtk git -C /path status`), instead of exiting with error code 2, it now falls back to running the raw command directly. This keeps developer workflows unbroken. - Replace Cli::parse() with try_parse() + run_fallback() - Add parse_failures SQLite table for failure analytics - Add `rtk gain --failures` / `-F` to view failure log - Fallback preserves stdin/stdout/stderr via Stdio::inherit() - --help and --version still work normally Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When Clap fails to parse a meta-command like `rtk gain --badtypo`, show the Clap error directly instead of trying to execute `gain` as a binary from $PATH. Adds RTK_META_COMMANDS constant listing gain, discover, learn, init, config, proxy, hook-audit, cc-economics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TimedExecution::start() was called after the command finished, so all fallback commands showed ~0ms in rtk gain --history. Now the timer captures actual command runtime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The parse_failures table was never cleaned up because only record() called cleanup_old(). Now parse failures also trigger 90-day retention cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Clap errors may contain terminal color codes. Strip them with utils::strip_ansi() before storing in the parse_failures table to avoid garbled output and wasted space. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- cargo test check now matches RTK's filtered output format ("passed")
in addition to raw "test result:" and "FAILURES"
- Fix undefined `skip` calls to use existing `skip_test` function
with proper (name, reason) arguments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c9816a5 to
a888f02
Compare
Upstream v0.23.0 release bumped Cargo.toml version and added mypy_cmd module. Update docs to match for CI validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pszymkowiak Done. |
|
Hi, this PR has conflicts with master in |
|
Tested locally — all good.
All review items addressed (must-fix and nice-to-have). LGTM, ready to merge. |
…ai#200) * feat: passthrough fallback when Clap parse fails When RTK cannot parse a command (e.g. `rtk git -C /path status`), instead of exiting with error code 2, it now falls back to running the raw command directly. This keeps developer workflows unbroken. - Replace Cli::parse() with try_parse() + run_fallback() - Add parse_failures SQLite table for failure analytics - Add `rtk gain --failures` / `-F` to view failure log - Fallback preserves stdin/stdout/stderr via Stdio::inherit() - --help and --version still work normally Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: guard RTK meta-commands from fallback to raw execution When Clap fails to parse a meta-command like `rtk gain --badtypo`, show the Clap error directly instead of trying to execute `gain` as a binary from $PATH. Adds RTK_META_COMMANDS constant listing gain, discover, learn, init, config, proxy, hook-audit, cc-economics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: move timer start before command execution in fallback TimedExecution::start() was called after the command finished, so all fallback commands showed ~0ms in rtk gain --history. Now the timer captures actual command runtime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: add cleanup_old() call to record_parse_failure() The parse_failures table was never cleaned up because only record() called cleanup_old(). Now parse failures also trigger 90-day retention cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: strip ANSI codes from Clap error before SQLite storage Clap errors may contain terminal color codes. Strip them with utils::strip_ansi() before storing in the parse_failures table to avoid garbled output and wasted space. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: smoke test cargo test assertion and missing skip_test calls - cargo test check now matches RTK's filtered output format ("passed") in addition to raw "test result:" and "FAILURES" - Fix undefined `skip` calls to use existing `skip_test` function with proper (name, reason) arguments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: fmt upstream files after rebase Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update version refs to 0.23.0 and module count to 51 Upstream v0.23.0 release bumped Cargo.toml version and added mypy_cmd module. Update docs to match for CI validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Every one earned on 2026-08-04, none invented. CTX-010 (REVIEW) — "tests pass" must name the suite. Green was reported from `cargo test --lib` repeatedly across a whole session while `cargo test` was red the entire time. The claim was narrower than it sounded. CTX-011 (ENFORCED) — a persisted store must repair a schema it did not write. `CREATE TABLE IF NOT EXISTS` is not a migration. Renaming first_seen to last_seen passed every test and two reviews, then made every query error against an already-deployed DB; the feature failed open and went silently inert. Unit tests structurally cannot see this — they always start empty. CTX-012 (REVIEW) — verify what a reproduction actually measures. rtk-ai#200's repro timed the shell, not the process, and a working fix was nearly reported as broken and re-worked. The same trap caught a council finding: both the panel and a first local test claimed the Gemini path leaked, using a payload shape Gemini ignores. Driven correctly it was already failing closed. CTX-013 (REVIEW) — a failing test is a finding until root-caused. 21 tests were written off as "environmental" five separate times before anyone looked; they were a real portability defect that had been breaking the suite for every contributor whose umask is not 022. CTX-011's lint uses an explicit PERSISTED_STORES registry rather than scanning for CREATE TABLE, because test fixtures create throwaway tables too and flagging those would train the reader to ignore the lint. Mutation-tested: removing the schema check fails it and passes again when restored. The CLAUDE.md drift check did its job unprompted — it failed the moment the four rules existed in the law but not in the file sessions actually read. Full `cargo test`, all 19 binaries: green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXCRs8F7G1fFqYczid9cu7
Summary
git -C /path status), RTK executes the raw command instead of erroring outgain,discover,learn,init,config,proxy,hook-audit,cc-economics) from falling through to raw$PATHexecution — bad flags likertk gain --badtyposhow the Clap error directlyrtk gain --history(was showing ~0ms)record_parse_failure()(parse_failures table was never cleaned up)cargo testassertion now matches RTK's filtered output, fix undefinedskip→skip_testcallsTest plan
cargo test)bash scripts/test-all.sh)rtk gain --badtyposhows Clap error (not "command not found")rtk git -C /path statusfalls back to rawgit -C /path statusrtk --helpandrtk --versionstill work normallyFixes #204, #228, #229
🤖 Generated with Claude Code