Skip to content

refactor(iam): promote supported_actions to const, extract CreatePolicyInput#356

Merged
vieiralucas merged 3 commits intomainfrom
worktree-cleanup-iam-policies-supported-actions
Apr 13, 2026
Merged

refactor(iam): promote supported_actions to const, extract CreatePolicyInput#356
vieiralucas merged 3 commits intomainfrom
worktree-cleanup-iam-policies-supported-actions

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 13, 2026

Summary

  • Promote `IamService::supported_actions` from an inline 130-element `&[&str]` to a file-level `SUPPORTED_ACTIONS` const, matching the shape PR refactor(logs): extract subscription filter delivery and promote action list #336 used for logs. The method body is now one line.
  • Extract `CreatePolicyInput::from_query` from `create_policy`. The parse + validate prologue (PolicyName, PolicyDocument, Path, Description, Tags + tag validation, MalformedPolicyDocument check) is now isolated from the state-mutation flow.

Audited and judged already-clean

  • `list_policies` (49L): most of the body is sequential `validate_optional_*` calls, with a short filter+render tail. Splitting would just rearrange validate calls without improving readability.

Test plan

  • `cargo fmt`
  • `cargo clippy -p fakecloud-iam --all-targets -- -D warnings`
  • `cargo test -p fakecloud-iam --lib` — 73 passed
  • `cargo test --workspace --exclude fakecloud-e2e --exclude fakecloud-conformance`

Summary by cubic

Promotes IAM supported actions to a file-level SUPPORTED_ACTIONS const and extracts CreatePolicyInput to keep create_policy focused. No behavior changes; also fixes the conformance audit scanner to handle const-based supported_actions().

  • Refactors

  • Bug Fixes

    • fakecloud-conformance audit scanner now supports const-backed supported_actions() by scanning the function body, resolving the const name, and parsing its definition; fixes the test failure.

Written for commit 26a7718. Summary will update on new commits.

…cyInput

- Promote IamService::supported_actions inline 130-element &[&str] to a
  file-level SUPPORTED_ACTIONS const; same shape PR #336 used for logs.
- Extract CreatePolicyInput::from_query from create_policy. The parse +
  validate prologue (PolicyName, PolicyDocument, Path, Description, Tags
  + tag validation, MalformedPolicyDocument check) is now isolated from
  the state-mutation flow.

list_policies (49L) audited in the same pass and judged clean: most of
the body is parameter validation calls, with a short filter+render
tail. Splitting would just rearrange validate_* calls.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

…ions

When the supported_actions() function returns a const instead of an inline
array, the scanner now:
1. Limits search for &[ to the function body (not the entire file after it)
2. Falls back to extracting the const name from the function body
3. Searches for the const definition and parses it

This fixes the test failure introduced when IAM's supported_actions was
promoted to a const.
@vieiralucas vieiralucas merged commit 820d301 into main Apr 13, 2026
22 checks passed
@vieiralucas vieiralucas deleted the worktree-cleanup-iam-policies-supported-actions branch April 13, 2026 16:12
vieiralucas added a commit that referenced this pull request Apr 13, 2026
…Input

The two longest functions in the SSM sub-modules were create_patch_baseline
(~150 lines) and create_association_inner (~162 lines). Both were dominated
by body parsing, field validation, and field extraction — with the actual
state mutation only in the last 30-40 lines.

This extracts dedicated *Input structs with from_body() constructors,
leaving each function focused on idempotency, ID generation, and struct
assembly. Same pattern as PRs #324/#328/#338/#355/#356.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant