mirror of
https://github.com/awslabs/iam-policy-autopilot.git
synced 2026-04-26 00:15:57 +03:00
[PR #50] [MERGED] fix: improve Go SDK parameter extraction and service disambiguation #207
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/iam-policy-autopilot#207
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/awslabs/iam-policy-autopilot/pull/50
Author: @adpaco-aws
Created: 12/3/2025
Status: ✅ Merged
Merged: 12/5/2025
Merged by: @adpaco-aws
Base:
main← Head:fix-go-struct-fields-extraction📝 Commits (2)
bc6c411fix: improve Go SDK parameter extraction and service disambiguation accuracy18d74ddrefactor: update node kinds comparison to use constants📊 Changes
14 files changed (+1028 additions, -127 deletions)
View changed files
📝
iam-policy-autopilot-policy-generation/src/extraction/go/disambiguation.rs(+344 -60)📝
iam-policy-autopilot-policy-generation/src/extraction/go/extractor.rs(+595 -64)📝
iam-policy-autopilot-policy-generation/src/extraction/go/features_extractor.rs(+1 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/go/mod.rs(+1 -0)➕
iam-policy-autopilot-policy-generation/src/extraction/go/node_kinds.rs(+43 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/go/waiter_extractor.rs(+1 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/mod.rs(+6 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/python/common/argument_extractor.rs(+5 -3)📝
iam-policy-autopilot-policy-generation/src/extraction/python/disambiguation.rs(+2 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/python/disambiguation_tests.rs(+2 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/python/mod.rs(+1 -0)➕
iam-policy-autopilot-policy-generation/src/extraction/python/node_kinds.rs(+23 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/python/resource_direct_calls_extractor.rs(+2 -0)📝
iam-policy-autopilot-policy-generation/src/extraction/sdk_model.rs(+2 -0)📄 Description
Description of changes: Fixes two critical bugs in Go SDK method extraction that were causing incorrect service disambiguation and filtering of valid operations.
Problems Fixed
Incomplete struct field extraction
The extractor was using string parsing to extract field names from Go struct literals, which failed to reliably extract parameters. This prevented proper service disambiguation.
Fix: Implemented AST-based field extraction to accurately parse struct literals and extract field names directly from the syntax tree.
Case-sensitive parameter validation
AWS service models use inconsistent casing - some services use PascalCase while others use camelCase. Since the Go SDK always uses PascalCase, case-sensitive validation was incorrectly rejecting valid operations or matching them to the wrong services.
Fix: Changed parameter validation to use case-insensitive comparison for both valid parameter checks and required parameter checks.
Testing
Added 5 new tests covering:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.