Repository navigation
Conversation
71459b5 to
0f4b8ab
Compare
0f4b8ab to
44cf0ea
Compare
Protocol-zero-0
left a comment
There was a problem hiding this comment.
Independently tested 44cf0ea against base 8a24ce2 using real Python 3.14.7. Three behavior changes need attention before the automatic rewrite is safe:
python3 -handpython3 --helprewrite to this command but print RTK's Python-subcommand help; Python's own option help never runs.- Successful output below 1 KiB is not preserved exactly.
python3 -c "import sys; sys.stdout.write('OK')"changesb'OK'tob'OK\n';python3 -c passgains a newline. A successful script writingresult\nto stdout andwarning\nto stderr instead emits both on stdout and leaves stderr empty. python3 -v -c "print('OK')"explicitly requests interpreter import diagnostics, but the proxy summarizes them once they exceed 1 KiB. The native/base run retains the full diagnostics on stderr; head reduces them to a summary/recovery hint on stdout. Please preserve Python's requested verbose modes, including combined short-option forms.
The checks cover 20 scenarios / 60 native-base-head CLI executions: small/large output, both streams, exit 7, help/version, verbose and interactive modes, stdin, script arguments, and interpreter identity. Base leaves these generic invocations unchanged. Large successful output is summarized with a recovery file whose contents match raw output exactly; the tested failure exits and output are preserved. Eight focused unit/routing/CLI tests, fmt, and warnings-denied clippy pass. Linux only; no full suite, Windows, or current-develop integration run. AI-assisted independent review.
| }, | ||
|
|
||
| /// Python with large-output summarization | ||
| #[command(visible_alias = "py")] |
There was a problem hiding this comment.
[P2] Let native Python help reach the interpreter
The new rewrite sends python3 -h / python3 --help here, but Clap handles both flags before should_passthrough can run. On this head, rtk python --executable python3 -h prints Python with large-output summarization and RTK options instead of Python's usage/options; base leaves the native command unchanged. Disable the generated help flag for this subcommand (or otherwise forward native help) and add a compiled-CLI regression for both spellings.
| eprintln!("Running: {}", command_label.trim_end()); | ||
| } | ||
|
|
||
| runner::run_filtered( |
There was a problem hiding this comment.
[P2] Preserve successful small output bytes and stream identity
This captured runner merges stdout/stderr and normally prints a trailing newline, so the advertised exact-output path below 1 KiB is already lossy. Real Python controls: -c pass changes empty stdout into b'\n'; -c "import sys; sys.stdout.write('OK')" changes b'OK' into b'OK\n'; and a successful script writing a result to stdout plus a warning to stderr moves the warning onto stdout. Keep both captured streams and their original bytes for the small-output branch, with process-level regressions; the existing string-only test cannot detect these changes.
| return true; | ||
| } | ||
|
|
||
| if args.iter().any(|arg| { |
There was a problem hiding this comment.
[P2] Preserve explicitly requested Python verbose diagnostics
Python's -v is not an ordinary output-producing script mode: it explicitly requests import diagnostics. python3 -v -c "print('OK')" produces full diagnostics on stderr natively, while this head summarizes them and moves the result to stdout once the output exceeds 1 KiB. That hides the import/search-path detail being requested. Treat interpreter verbose forms (-v, -vv, and combined short options) as passthrough, parsing only interpreter options so an unrelated script argument is not mistaken for an interpreter flag.
Summary
rtk python/rtk pyrouting for directpythonandpython3invocationspytestandmypymodule routingVerification
cargo test --all-targets --all-featurescargo clippy --all-targets --all-features -- -D warningscargo fmt --checkgit diff --checkCloses #2312