Repository navigation
Description
gcloud is currently handled by src/filters/gcloud.toml, a generic filter that strips blank lines, clips each line at 120 characters, and keeps the first 30 lines. Measured against a real project, this gives a poor trade between bytes saved and information kept.
Related: #3485 reports that rtk rewrite "gcloud ..." is refused on v0.45.0. This issue is about what the filter does once it is reached. #1128 proposes expanding the TOML, which does not address points 2 and 3 below.
What the filter does today
Bytes are stdout+stderr of one run on develop.
| Command | Raw bytes | Filtered bytes | Saving | What survives |
|---|---|---|---|---|
compute instances list |
15,419 | 3,745 | 76% | 30 of 113 rows, STATUS column lost on every row |
container clusters list |
810 | 811 | 0% | passthrough, only the stderr footer is reordered |
logging read --limit=30 |
42,868 | 1,045 | 98% | about 1.5 of 30 entries |
storage ls |
4,347 | 989 | 77% | 30 of 146 buckets |
compute instances list --format=value(name,status) |
6,720 | 1,914 | 72% | 30 of 113 rows, although the user asked for the full list |
config list, storage cp |
208 / 701 | 208 / 711 | 0% | passthrough |
Problems
- The row cap has no relation to the data. 30 lines is the TOML default. A 113-instance inventory or a 146-bucket listing loses most rows. A recovery hint is appended, but the cap is not a filter decision, it is a coincidence.
- Line clipping at 120 characters drops columns silently. gcloud's default table is wide. On
compute instances listthe STATUS column falls past the clip on every row, with no marker. The output looks complete and is not. - A user-supplied
--formatis still truncated.--format=value(...)or--format=jsonsignals the user wants exactly the shape they asked for. The filter caps it at 30 lines anyway. Related to rtk crashes (SIGABRT) ongcloud compute instances list --format=…— poisoned Once cascade #2400, where--format=handling caused a crash. - Where savings are highest, content is lowest.
logging readshows 98% saving because 28 of 30 entries are gone. Each entry is 40 to 70 lines of JSON, so 30 lines is not even one full entry in some cases. - Nothing on the dense commands.
container clusters listandconfig listpass through unchanged, so no gain where output is already tabular.
Comparison point
aws_cmd.rs handles the equivalent commands by forcing JSON and emitting one compact row per resource, with CAP_LIST (20) for resource lists and CAP_INVENTORY (50) for log events, plus a tail hint. gcloud has the same shape of problem and the same JSON capability, including field projections (--format=json(name,zone,status)) that keep the raw output small. Full --format=json for compute instances list is 12.6 MB on the same project, above the 10 MiB capture cap, so a projection is needed rather than plain JSON.
Proposal to discuss
- Treat gcloud like aws: a small Rust module for the handful of hot commands (
compute instances list,container clusters list,run services list,logging read,storage ls,storage cp/rsync/mv), everything else passthrough. - Respect any explicit
--formatand pass the command through untouched. - Use the shared cap classes from
src/core/truncate.rsrather than a flat 30 lines. - Keep stderr visible. gcloud reports partial failures as
WARNING: Some requests did not succeedon stderr with exit 0.
Open questions: which columns matter per command (for example PREEMPTIBLE on instances, NODE_VERSION on clusters), and whether gsutil should be in scope.
Activity
rtk-wshm-sync-bot commentedon Sep 9, 2026
🔍 Automated Triage
featuremediumSummary
Replace generic TOML filter for gcloud with a dedicated Rust module (like aws_cmd.rs) using content-aware caps, format-string passthrough, and column-safe output instead of blind 30-line/120-char clipping.
📁 Relevant files
src/filters/gcloud.tomlsrc/core/truncate.rssrc/filters/aws_cmd.rsTriaged automatically by wshm · This is an automated analysis, not a human review.