[PR #139] [MERGED] refactor: replace duplicated CallInfo with shared WaiterCallPattern #257

Closed
opened 2026-03-15 11:56:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/awslabs/iam-policy-autopilot/pull/139
Author: @adpaco-aws
Created: 2/4/2026
Status: Merged
Merged: 2/6/2026
Merged by: @adpaco-aws

Base: mainHead: refactor-call-info


📝 Commits (5)

  • da40af8 refactor: replace duplicated CallInfo with shared WaiterCallPattern
  • fa8d41b refactor: move synthetic call creation to WaiterCallPattern
  • 9f5fff3 Merge branch 'main' into refactor-call-info
  • 4cd52b3 fix: fix clippy warnings
  • 133693c Merge branch 'main' into refactor-call-info

📊 Changes

3 files changed (+228 additions, -231 deletions)

View changed files

📝 iam-policy-autopilot-policy-generation/src/extraction/go/waiter_extractor.rs (+23 -95)
📝 iam-policy-autopilot-policy-generation/src/extraction/python/waiters_extractor.rs (+54 -136)
📝 iam-policy-autopilot-policy-generation/src/extraction/shared/extraction_utils.rs (+151 -0)

📄 Description

Issue #, if available: Closes #88

*Description of changes:*Replace the duplicated CallInfo enum in Python and Go waiter extractors
with a shared WaiterCallPattern enum in extraction_utils.rs. This seemed like the best option to me considering that the alternative was to either

  1. replicate the logic through synthetic call creation methods for each variant (unmatched, matched and chained)
  2. follow a trait-based approach which feels over-complicated for this use case

In fact, we're currently doing (1) for paginator extraction leading to a significant amount of code duplication. If we agree on keeping an enum to drive this logic, I can follow up with a refactor to use WaiterCallPattern (with a better name) on the paginator extraction code.

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.

## 📋 Pull Request Information **Original PR:** https://github.com/awslabs/iam-policy-autopilot/pull/139 **Author:** [@adpaco-aws](https://github.com/adpaco-aws) **Created:** 2/4/2026 **Status:** ✅ Merged **Merged:** 2/6/2026 **Merged by:** [@adpaco-aws](https://github.com/adpaco-aws) **Base:** `main` ← **Head:** `refactor-call-info` --- ### 📝 Commits (5) - [`da40af8`](https://github.com/awslabs/iam-policy-autopilot/commit/da40af83cadafd15278ba5cc85e9791251aa22a8) refactor: replace duplicated `CallInfo` with shared `WaiterCallPattern` - [`fa8d41b`](https://github.com/awslabs/iam-policy-autopilot/commit/fa8d41bdb36eea32026bf5b8b458d822ba4ef496) refactor: move synthetic call creation to `WaiterCallPattern` - [`9f5fff3`](https://github.com/awslabs/iam-policy-autopilot/commit/9f5fff3ce783b2b5a0ffa4b66797d3fce8beee97) Merge branch 'main' into refactor-call-info - [`4cd52b3`](https://github.com/awslabs/iam-policy-autopilot/commit/4cd52b34951d35f22493609381a60aab30ead5e9) fix: fix clippy warnings - [`133693c`](https://github.com/awslabs/iam-policy-autopilot/commit/133693c16682e245699e183154072dcb2ad01c88) Merge branch 'main' into refactor-call-info ### 📊 Changes **3 files changed** (+228 additions, -231 deletions) <details> <summary>View changed files</summary> 📝 `iam-policy-autopilot-policy-generation/src/extraction/go/waiter_extractor.rs` (+23 -95) 📝 `iam-policy-autopilot-policy-generation/src/extraction/python/waiters_extractor.rs` (+54 -136) 📝 `iam-policy-autopilot-policy-generation/src/extraction/shared/extraction_utils.rs` (+151 -0) </details> ### 📄 Description *Issue #, if available:* Closes #88 *Description of changes:*Replace the duplicated `CallInfo` enum in Python and Go waiter extractors with a shared `WaiterCallPattern` enum in `extraction_utils.rs`. This seemed like the best option to me considering that the alternative was to either 1. replicate the logic through synthetic call creation methods for each variant (unmatched, matched and chained) 2. follow a trait-based approach which feels over-complicated for this use case In fact, we're currently doing (1) for paginator extraction leading to a significant amount of code duplication. If we agree on keeping an enum to drive this logic, I can follow up with a refactor to use `WaiterCallPattern` (with a better name) on the paginator extraction code. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-15 11:56:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/iam-policy-autopilot#257
No description provided.