fix(aws): honor explicit --output json/yaml losslessly#2140
Conversation
rtk forced its summarizers/schema compression on aws commands even when the user explicitly requested --output json (or yaml), dropping field values and emitting non-parseable output. Route explicitly-requested lossless formats through an unmodified passthrough so jq/json.load keep working (issue rtk-ai#2139). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Automated triage on #2139 (by wshm) independently confirms this: categorized as bug, priority high, 93% confidence, with the recommended fix being to "bypass summarization when an explicit output format flag is present" — which is exactly what this PR does. This PR narrows that slightly: it only bypasses for parseable formats ( |
- explicit_lossless_format: last --output wins (aws CLI semantics), and a dangling --output (no value) no longer falls through to lossy filtering - run_generic: detect the --output=<fmt> form so it doesn't inject a second --output json on top of an explicit human format - run_passthrough: document the intentional tee skip - tests: cover repeated and dangling --output Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Note for the PR Testing Checklist: the "token savings ≥60%" item is N/A here. This isn't a new/compressing filter — it's a correctness fix that bypasses compression when the user explicitly requests The remaining checklist items are covered:
On security: the new |
|
I believe I tackled this problem a bit differently a few hours earlier #2135 ;) rtk adds |
Summary
--output json(returns non-JSON schema skeleton, drops field values) #2139:rtk aws ... --output jsonreturned a lossy schema skeleton (string,int,string[64]) or a one-line table summary instead of valid JSON, dropping field values (ImageUri,CodeSha256, env vars) and breaking downstreamjq/json.load.filter_lambda_get) or generic schema compression (filter_json_string) regardless of the user-requested output format.--output json/--output=json/yaml/yaml-stream),run()short-circuits to a new byte-faithfulrun_passthrough. Lossy/human formats (table,text) and the no-flag default keep the existing compression behavior.This covers all
awssubcommands, not justlambda.Test plan
cargo fmt --allcleancargo clippy --all-targets— zero warningscargo test --all— 1947 passedtest_explicit_lossless_formatcovers json/yaml/=json positives and table/text/absent negatives🤖 Generated with Claude Code