Repository navigation
feat(gcloud): add command-aware output filtering - #3974
Raymondtaoo wants to merge 2 commits into
Conversation
Signed-off-by: Raymond Tao <[email protected]>
There was a problem hiding this comment.
🟡 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 gcloudcommand that routes supported subcommands to structured output filters and otherwise falls back to passthrough. - Removed the legacy
src/filters/gcloud.tomlTOML 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.
📊 Automated PR Analysis
SummaryAdds 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
Linked issues: #3963 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
Signed-off-by: Raymond Tao <[email protected]>
Summary
Output projections
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