feat(aws): expand CLI filters from 8 to 25 subcommands#885
feat(aws): expand CLI filters from 8 to 25 subcommands#885jbronssin wants to merge 4 commits intortk-ai:developfrom
Conversation
Add 12 specialized filters for high-token-waste AWS operations: - CloudWatch Logs (get-log-events, filter-log-events) - CloudFormation describe-stack-events (failures-first) - Lambda list-functions, get-function (strips Environment secrets) - IAM list-roles, list-users (strips AssumeRolePolicyDocument) - DynamoDB scan/query (recursive type unwrapping) - ECS describe-tasks - EC2 describe-security-groups (compact rule notation) - S3API list-objects-v2 - EKS describe-cluster - SQS receive-message (strips ReceiptHandle) Refactor: extract run_aws_filtered() shared runner, eliminating 25-line boilerplate per handler. Add force_tee_hint() so truncated output always has a recovery path (no dead ends for LLMs). Security: Lambda Environment and Code.Location are never emitted.
|
Jb seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
already signed it in the original message/issue |
Live output examplesTested against a real AWS account. Personal data redacted.
|
…filters Inspired by rtk-ai#644 — cherry-picks the best ideas and integrates them into the shared runner architecture: - DynamoDB get-item: single-item unwrapping with ConsumedCapacity - DynamoDB scan/query: now shows ConsumedCapacity (RCU) and pagination status - DynamoDB N-type: try i64 first, then f64 (better precision) - CloudWatch Logs get-query-results: field=value format, strips @ptr - S3 sync/cp: text-based transfer summary (upload/download/delete counts) - Secrets Manager get-secret-value: extracts Name + SecretString only Total: 25 specialized AWS filters + generic fallback.
|
Update: Added a second commit with 5 more filters inspired by #644 (great work by @JamieCressey):
Total is now 25 specialized AWS filters + generic fallback. 65 unit tests. |
|
Hello jbronssin ! Thanks for contributing to RTK, this PR will close #644 as expected, but a few thing to be addressed before : Bug:
|
|
Thanks to @JamieCressey as well |
- Fix redundant .as_str() fallback in filter_logs_query_results - Fix CFN events underreporting failure count (used capped vec len instead of separate counter) - Add force_tee_hint() unit tests (env disable + write path) - Add snapshot-style tests for major filters (logs, lambda, dynamodb, security groups, cfn events) - Add empty collection edge case tests for all filters - Add test verifying CFN failure count > MAX_ITEMS reports correctly
- Update src/cmds/cloud/README.md with expanded AWS filter details - Add AWS section to README.md command list + rewrite mapping table - Add CHANGELOG.md entries under [Unreleased] - Document force_tee_hint() in src/core/README.md
|
@aeppling thanks for the thorough review — all 5 points addressed in the last two commits: Bug: redundant fallback in Bug: Missing: snapshot tests — Added 5 snapshot-style Missing: Missing: empty collection edge cases — Added 11 tests covering empty arrays for Functions, Roles, Users, Items, tasks, SecurityGroups, Contents (absent key), Messages (absent key), events, Reservations, and StackEvents. Total is now 82 AWS tests + 2 tee tests. |
1. filter_logs_query_results: non-string values still renderThe redundant fallback is gone (good), but non-string values (numbers, booleans) from CloudWatch Insights still become "?". 2. Aggresive filters (new feedback, forgot to mention this before:RTK filter transparently commands output, so we cannot strip important information that could cost token from the LLM searching this information and having a hard time understanding why it has not. Please review the following to ensure those are not too aggressive :
Some can be debatable but those like EC2 instance stripping are too aggressive for example |

Summary
run_aws_filtered()shared runner, replacing 25-line boilerplate per handlerforce_tee_hint()— truncated output always saves full data to a file with a recovery hint, so LLMs don't burn tokens working around missing data{"S":"foo"}→"foo") with i64-first precisionEnvironmentandCode.Locationare never emittedInspired by #644 for DynamoDB get-item, S3 transfer, Secrets Manager, query-results, and N-type precision.
Test plan
cargo fmt --all --check && cargo clippy --all-targets && cargo test --all