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 1 commit intortk-ai:developfrom
Conversation
|
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.
|
|
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 |
|
@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 |
|
Hey @aeppling, good points — you're right those were too aggressive. Fixed in the latest commit:
Also took the opportunity to align the runners with the six-phase contract from src/cmds/README.md (stderr in tracking, tee on failure path). |
|
Hey @jbronssin , I do not see any commit related to the filter quality fix |
|
Damn... might still not be pushed. Sorry mate, I'll see that tonight |
done :) |
|
Hello @jbronssin You'll need rebase and if possible with your new filters, use the aws run filtered function wrapper to ensure conformity with the codebase. This is part of a refacto currently on going. For the README.md take modifications from develop branch. I'll get back to you asap then to merge this :) Thanks again, |
f8ceca5 to
891e0e9
Compare
|
@aeppling done — rebased on latest develop and adapted to the new codebase patterns:
Let me know if anything else needs adjusting. |
Add 17 specialized filters for high-token-waste AWS operations: - CloudWatch Logs (get-log-events, filter-log-events, get-query-results) - CloudFormation describe-stack-events (failures-first) - Lambda list-functions, get-function (strips Environment secrets) - IAM list-roles (extract principals), list-users - DynamoDB scan/query/get-item (recursive type unwrapping) - ECS describe-tasks (stoppedReason + exitCode) - EC2 describe-security-groups (compact rule notation) - S3API list-objects-v2, S3 sync/cp (text summary) - EKS describe-cluster, SQS receive-message - Secrets Manager get-secret-value Architecture: - Extract run_aws_filtered() shared runner with Result<i32> return - Add force_tee_hint() for truncation recovery (no dead ends for LLMs) - Follow six-phase contract (stderr tracking, tee on failure, exit codes) - Migrate existing 8 handlers to shared runner Inspired by rtk-ai#644 for DynamoDB get-item, S3 transfer, Secrets Manager, query-results, and N-type precision.
891e0e9 to
d1b37ce
Compare

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