Skip to content

refactor(ssm): extract CreatePatchBaselineInput and CreateAssociationInput#361

Merged
vieiralucas merged 1 commit intomainfrom
worktree-cleanup-ssm-commands
Apr 13, 2026
Merged

refactor(ssm): extract CreatePatchBaselineInput and CreateAssociationInput#361
vieiralucas merged 1 commit intomainfrom
worktree-cleanup-ssm-commands

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 13, 2026

Summary

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.

Test plan

  • cargo clippy -p fakecloud-ssm --all-targets -- -D warnings
  • cargo test -p fakecloud-ssm (60 passed)

Summary by cubic

Refactored SSM create flows by extracting CreatePatchBaselineInput and CreateAssociationInput with from_body() parsing and validation. This simplifies create_patch_baseline and create_association_inner and keeps them focused on idempotency and state updates.

  • Refactors
    • Moved body parsing, field extraction, and validation into CreatePatchBaselineInput::from_body and CreateAssociationInput::from_body.
    • Shortened the two longest functions and improved readability and testability.
    • Preserved behavior, defaults, and validation logic (no functional changes).

Written for commit 7289b60. Summary will update on new commits.

…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.
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

@vieiralucas vieiralucas merged commit 0502c14 into main Apr 13, 2026
22 checks passed
@vieiralucas vieiralucas deleted the worktree-cleanup-ssm-commands branch April 13, 2026 17:04
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