Skip to content

fix(ruff): preserve analyze graph output with global options - #4892

Open
Protocol-zero-0 wants to merge 1 commit into
rtk-ai:developfrom
Protocol-zero-0:fix/ruff-analyze-graph-routing
Open

Protocol-zero-0 wants to merge 1 commit into
rtk-ai:developfrom
Protocol-zero-0:fix/ruff-analyze-graph-routing

Conversation

@Protocol-zero-0

Copy link
Copy Markdown
Contributor

Global options before analyze, or between analyze and graph, currently move the graph out of the positional exemption and truncate valid JSON to 2,001 bytes. This adds the requested AnalyzeGraph route on top of the merged #3968 router, preserving the complete graph and the original argv.

The lookahead uses the same token stream and global-option grammar as check/format routing. It skips consumed option values, stops at --, and stops on a non-global option or help/version request. Command-like config filenames cannot become the graph action. Other passthrough commands retain their cap. Completion and other structured outputs remain in #4655.

Fixes #4654. Follows the integration requested in #4654 (comment).

Validation on Linux, base 954c3371, real Ruff 0.17.0:

  • 31 scenarios / 93 native, unmodified-base and patched executions, carrying over the 28-scenario matrix and adding check-only-option controls. All patched exit codes match native. Graph/help/version stdout matches native after terminal whitespace normalization; 11 graph cases change from truncated, invalid JSON on the base to complete, valid JSON.
  • 41 Ruff unit tests and 6 process tests pass, including exact argv and complete captured JSON for all eight reported global-option forms plus command-like option values, and the existing leading-double-dash regressions.
  • Full workspace: 5,415 passed, 8 ignored; root/proxy fmt and warnings-denied all-target clippy pass.

The real-Ruff controls also cover both option levels, graph direction, small graphs, a directory named format, check routing, help/version, invalid arguments, and the existing rule E501 cap. Other operating systems and Ruff versions have not been run locally.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working python ruff labels Oct 31, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Fixes Ruff analyze routing so global options placed before analyze or between analyze and graph no longer push the graph action out of the passthrough exemption, which previously caused valid JSON output to be truncated to 2,001 bytes. Adds an AnalyzeGraph route using a lookahead over the same tokenization/global-option grammar as check/format, with tests and real-Ruff validation covering both option levels and command-like config values.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4654


Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python ruff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk ruff reads the subcommand from fixed positions, so ruff global options make rtk ruff --isolated analyze graph truncate the JSON

2 participants