Skip to content

feat(gcloud): add command-aware output filtering - #3974

Open
Raymondtaoo wants to merge 2 commits into
rtk-ai:developfrom
Raymondtaoo:feat/gcloud-command-filter
Open

Raymondtaoo wants to merge 2 commits into
rtk-ai:developfrom
Raymondtaoo:feat/gcloud-command-filter

Conversation

@Raymondtaoo

@Raymondtaoo Raymondtaoo commented Sep 10, 2026 •

Copy link
Copy Markdown

Summary

  • replace the generic gcloud TOML truncation with a narrow Rust dispatcher
  • preserve explicit --format forms and unsupported commands as true passthroughs
  • compact supported compute, GKE, Cloud Run, logging, and Cloud Storage output with semantic caps and recall hints

Output projections

  • instances: name, zone, machine type, status, preemptible
  • clusters: name, location, status, control-plane and node versions
  • services: name, ready revision, Ready condition
  • logs: timestamp, severity, log name, message
  • storage ls: native path lines; transfer commands retain warnings/errors and final progress

The repository smoke script was run against the worktree binary; it has unrelated environment/baseline failures (for example missing pnpm and existing output assertions). Read-only live GCP smoke tests were attempted; Compute, GKE, and Cloud Run APIs are disabled in the configured project. No storage-mutating command was run.

Resolves #3963

Copilot AI lite review requested due to automatic review settings September 10, 2026 03:48

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.

🟡 Changes recommended

There are a few concrete correctness/robustness issues in the new gcloud filter implementation (panic path, newline-safe hint emission, and avoidable allocations) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR replaces the generic TOML-based gcloud truncation with a Rust-based, command-aware dispatcher that preserves explicit --format passthrough while emitting compact summaries for a small set of high-volume gcloud commands.

Changes:

  • Added a dedicated rtk gcloud command that routes supported subcommands to structured output filters and otherwise falls back to passthrough.
  • Removed the legacy src/filters/gcloud.toml TOML filter and updated built-in filter counts/rust-handled command lists accordingly.
  • Added fixtures and unit tests covering the new gcloud projections and caps (compute, GKE, Cloud Run, logging, storage ls).
File summaries
File Description
src/main.rs Adds the Gcloud clap command + routing, and a parsing regression test for global flags.
src/cmds/cloud/gcloud_cmd.rs Implements command detection, JSON projection formatting, caps + recall hints, and unit tests/fixtures wiring.
src/cmds/cloud/README.md Documents the new gcloud filter behavior and passthrough rules.
src/filters/gcloud.toml Removes the legacy generic TOML filter for gcloud.
src/core/toml_filter.rs Marks gcloud as Rust-handled and updates built-in filter count assertions.
tests/fixtures/gcloud/* Adds redacted fixtures for supported gcloud commands and storage listing.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/cmds/cloud/gcloud_cmd.rs Resolved
Comment thread src/cmds/cloud/gcloud_cmd.rs Resolved
Comment thread src/cmds/cloud/gcloud_cmd.rs Resolved
Comment thread src/cmds/cloud/gcloud_cmd.rs Resolved
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

✨ Type feature
🟡 Risk medium

Summary

Adds a Rust dispatcher that applies command-aware output filtering for gcloud, compacting output for compute, GKE, Cloud Run, logging, and Cloud Storage commands with semantic caps and recall hints, while preserving explicit --format usage and unsupported commands as passthroughs. This replaces the previous generic TOML-based truncation approach for gcloud.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #3963


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

@Raymondtaoo
Raymondtaoo requested a balanced review from Copilot September 10, 2026 20:53

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 reached their quota limit.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gcloud: generic TOML filter truncates silently and saves almost nothing on the common commands

2 participants