You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rtk ruff cuts SARIF, JUnit, GitLab, JSON Lines and rule --output-format=json output at the passthrough cap #4655
rtk ruff sends every invocation it has no filter for through truncate(stdout.trim(), passthrough_max_chars) (2000 chars). That includes ruff check when the user picked a non-JSON --output-format, and ruff rule --output-format=json. Those outputs are documents, and cutting one at 2000 chars leaves something no consumer can parse. No hint says how to get the rest.
Reproduction (ruff 0.16.6, LC_ALL=C, a 301-file package big/ with one F401 per file)
2001 B, cut inside the # noqa example; the ## Options list and the PEP 8 link are gone
ruff analyze graph had the same problem (#3929) and is fixed by #3942, which exempts only that subcommand.
Direction
Under "Correctness VS Token Savings" in CONTRIBUTING.md, an output format the user asked for by name is detail they want to see. Pass these through uncapped, or give them a filter that keeps the document valid. If the cap stays anywhere, it needs the recovery hint that "Never Block" asks for. Related: #2204 (passthrough truncation with no marker).
PR delivery after #3968 merged: #4896 (consolidates the format/rule and completion patches on the merged router; the staged patch below is historical).
I reproduced #4655 on develop 9a501c8d with Ruff 0.17.0 and prepared an incremental fix on top of the shared-router integration in #4654.
The change reuses #3968's routing and #3964's tokenizer-based output-format lookup. Explicit --output-format requests and ruff rule documentation use the runner's existing native passthrough, preserving stdout, stderr and exit status. That also avoids captured filtering's 10 MiB limit and newline normalization. Default check invocations still produce the existing summary.
With a 301-file fixture, the previous 2,001-byte truncated outputs become complete documents: SARIF 423,521 bytes, JUnit 174,407 bytes, GitLab 113,764 bytes, JSON Lines 152,306 bytes; rule --all --output-format=json returns all 1,584,699 bytes. rule E501 retains its complete 2,302-byte documentation.
Covers check and format's 12 supported output formats, both option spellings, leading global options, implicit checks, clean results, invalid/duplicate formats, missing config, graph/help/version controls, and a filename resembling --output-format=json after --.
27 focused unit tests and 5 process tests, including an 11 MiB document with no final newline plus separate stderr and exit 1.
Full local cargo test --locked: 4,698 passed, 8 ignored; fmt and warnings-denied all-targets clippy pass. Other platforms/Ruff versions were not tested.
The patch below applies after the #4654 patch linked above; both sequential application and the combined patch were checked against clean 9a501c8d. No runner changes or additional dependencies. #3964's format-summary changes remain separate.
One more row from the #3968 review (ruff 0.16.6, LC_ALL=C), not in the list above: rtk ruff generate-shell-completion bash returns 2001 of ruff's 311361 bytes (exit 0). The script is cut mid-function, so eval "$(rtk ruff generate-shell-completion bash)" breaks.
Also, once #3968 lands, rtk ruff --output-format concise src reaches the same cap as rtk ruff check --output-format concise src (byte-identical 2001 B; native 18363 B). Before #3968 it exited 2. The incremental patch above covers that spelling through the shared router.
The two additional rows are now checked with real Ruff 0.17.0 on Linux.
generate-shell-completion bash still hits the cap with my earlier #4655 patch: 2,001 bytes rather than Ruff's 311,984, and bash -n rejects the truncated script. The incremental change below treats the routedgenerate-shell-completion command as a document and uses the same native passthrough as selected output formats and rule documentation. No runner changes.
Validation:
22 real Ruff scenarios / 66 native, prior-patch and fixed executions. All five shell scripts match native stdout exactly; the five Bash rows (plain, --isolated, --config, --color, -q) also pass bash -n. The prior patch fails all five Bash syntax checks. This checks syntax without evaluating generated scripts.
--output-format concise big, its equals spelling, leading global options and explicit check preserve the complete 15,399-byte diagnostic output and exit 1. Clean/error controls retain stdout, stderr and exit codes 0/1/2. The format requests already worked with the earlier patch; completion is the new fix.
A config value named generate-shell-completion still routes to a normal summarized check; the same word after -- does not select document passthrough. New unit and process regressions cover these distinctions and exact CRLF/argv preservation. The new process regression fails before the change.
28 Ruff unit tests, six process tests, full local workspace tests (4,998 passed, 8 ignored), fmt and warnings-denied all-targets clippy pass.
This is a delta afterthe earlier #4655 patch, tested on its original 9a501c8d + #4654/#4655 staged combination. Exported patch application reproduces the tested source tree exactly. It is not a claim of integration with revised #396863454754 or current develop; that rebase remains to be checked. #4654's separate PR still waits for #3968 to merge, as agreed. Only Linux/Ruff 0.17.0 was run.
Activity
rtk-wshm-sync-bot commentedon Oct 19, 2026
🔍 Automated Triage
bughighSummary
rtk ruff truncates structured output formats (SARIF, JUnit, GitLab, JSON Lines, rule --output-format=json) at a 2000-char passthrough cap, producing unparseable documents with no recovery hint.
📁 Relevant files
src/cmds/ruff.rsSuggested Actions
rtk ruffreads the subcommand from fixed positions, so ruff global options makertk ruff --isolated analyze graphtruncate the JSON #4654, which also touches rtk ruff's subcommand/arg parsingTriaged automatically by wshm · This is an automated analysis, not a human review.
Protocol-zero-0 commentedon Oct 19, 2026
PR delivery after #3968 merged: #4896 (consolidates the format/rule and completion patches on the merged router; the staged patch below is historical).
I reproduced #4655 on develop
9a501c8dwith Ruff 0.17.0 and prepared an incremental fix on top of the shared-router integration in #4654.The change reuses #3968's routing and #3964's tokenizer-based output-format lookup. Explicit
--output-formatrequests andruff ruledocumentation use the runner's existing native passthrough, preserving stdout, stderr and exit status. That also avoids captured filtering's 10 MiB limit and newline normalization. Default check invocations still produce the existing summary.With a 301-file fixture, the previous 2,001-byte truncated outputs become complete documents: SARIF 423,521 bytes, JUnit 174,407 bytes, GitLab 113,764 bytes, JSON Lines 152,306 bytes;
rule --all --output-format=jsonreturns all 1,584,699 bytes.rule E501retains its complete 2,302-byte documentation.Validation on Linux:
rtk ruffreads the subcommand from fixed positions, so ruff global options makertk ruff --isolated analyze graphtruncate the JSON #4654 and fixed executions. Selected-format and rule stdout match native bytes exactly; exit codes 0/1/2 are preserved. JSON/XML consumers parse 23 structured-output cases.--output-format=jsonafter--.cargo test --locked: 4,698 passed, 8 ignored; fmt and warnings-denied all-targets clippy pass. Other platforms/Ruff versions were not tested.The patch below applies after the #4654 patch linked above; both sequential application and the combined patch were checked against clean
9a501c8d. No runner changes or additional dependencies. #3964's format-summary changes remain separate.Incremental patch for #4655
KuSh commentedon Oct 21, 2026
One more row from the #3968 review (ruff 0.16.6, LC_ALL=C), not in the list above:
rtk ruff generate-shell-completion bashreturns 2001 of ruff's 311361 bytes (exit 0). The script is cut mid-function, soeval "$(rtk ruff generate-shell-completion bash)"breaks.Also, once #3968 lands,
rtk ruff --output-format concise srcreaches the same cap asrtk ruff check --output-format concise src(byte-identical 2001 B; native 18363 B). Before #3968 it exited 2. The incremental patch above covers that spelling through the shared router.Protocol-zero-0 commentedon Oct 24, 2026
The two additional rows are now checked with real Ruff 0.17.0 on Linux.
generate-shell-completion bashstill hits the cap with my earlier #4655 patch: 2,001 bytes rather than Ruff's 311,984, andbash -nrejects the truncated script. The incremental change below treats the routedgenerate-shell-completioncommand as a document and uses the same native passthrough as selected output formats and rule documentation. No runner changes.Validation:
--isolated,--config,--color,-q) also passbash -n. The prior patch fails all five Bash syntax checks. This checks syntax without evaluating generated scripts.--output-format concise big, its equals spelling, leading global options and explicitcheckpreserve the complete 15,399-byte diagnostic output and exit 1. Clean/error controls retain stdout, stderr and exit codes 0/1/2. The format requests already worked with the earlier patch; completion is the new fix.generate-shell-completionstill routes to a normal summarized check; the same word after--does not select document passthrough. New unit and process regressions cover these distinctions and exact CRLF/argv preservation. The new process regression fails before the change.This is a delta after the earlier #4655 patch, tested on its original
9a501c8d+ #4654/#4655 staged combination. Exported patch application reproduces the tested source tree exactly. It is not a claim of integration with revised #396863454754or current develop; that rebase remains to be checked. #4654's separate PR still waits for #3968 to merge, as agreed. Only Linux/Ruff 0.17.0 was run.Incremental completion patch after #4655