8000 Step Functions: Support for Aliasing by MEPalma · Pull Request #12326 · localstack/localstack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Step Functions: Support for Aliasing #12326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from < 8000 svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy">
Mar 10, 2025
Merged

Step Functions: Support for Aliasing #12326

merged 6 commits into from
Mar 10, 2025

Conversation

MEPalma
Copy link
Contributor
@MEPalma MEPalma commented Mar 3, 2025

Motivation

These changes introduce initial support for AWS Step Functions aliasing features.

Future work on aliasing: CloudFormation support; paging in ListStateMachineAliases

Changes

  • Added a new object representation for State Machine aliases, including logic for sampling and handling alias-specific attributes.
  • Store updates: extended the Step Functions provider’s store to manage and track aliases
  • API actions: CreateStateMachineAlias, DescribeStateMachineAlias, ListStateMachineAliases (no pagination support yet), UpdateStateMachineAlias, DeleteStateMachineAlias
  • Complexity considerations: these changes focus on allowing creation and execution api actions of aliases to be optimized for constant time complexity; this comes at the cost of other operations such as deletion and listing that retain a linear complexity.
  • Included basic validations for alias operations and entities

Testing

  • Added new test suite for Step Functions aliasing features and lifecycles with positive and negative snapshot tests for all the api actions added in these changes

@MEPalma MEPalma added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Mar 3, 2025
@MEPalma MEPalma added this to the 4.3 milestone Mar 3, 2025
@MEPalma MEPalma self-assigned this Mar 3, 2025
Copy link
github-actions bot commented Mar 3, 2025

LocalStack Community integration with Pro

    2 files  ± 0      2 suites  ±0   1h 51m 50s ⏱️ - 2m 40s
4 125 tests +21  3 805 ✅ +33  320 💤  - 12  0 ❌ ±0 
4 127 runs  +21  3 805 ✅ +33  322 💤  - 12  0 ❌ ±0 

Results for commit 6f52c483. ± Comparison against base commit 288a34a.

This pull request skips 3 and un-skips 15 tests.
tests.aws.services.cloudformation.resources.test_redshift ‑ test_redshift_cluster
tests.aws.services.redshift.test_redshift.TestRedshift ‑ test_create_clusters
tests.aws.test_integration ‑ test_kinesis_lambda_forward_chain
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_happy_path
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_start_job[None-None]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_start_job[test-output-bucket-2-None]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_start_job[test-output-bucket-3-test-output]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_start_job[test-output-bucket-4-test-output.json]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_start_job[test-output-bucket-5-test-files/test-output.json]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_start_job[test-output-bucket-6-test-files/test-output]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_supported_media_formats[../../files/en-gb.amr-hello my name is]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_supported_media_formats[../../files/en-gb.flac-hello my name is]
tests.aws.services.transcribe.test_transcribe.TestTranscribe ‑ test_transcribe_supported_media_formats[../../files/en-gb.mp3-hello my name is]
…

♻️ This comment has been updated with latest results.

Copy link
Contributor
@gregfurman gregfurman left a comment

Choose a reason for hiding this comment

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

LGTM! Solid addition here adding alias support 🚀

Have left some comments. Mostly related to deletions since aliasing adds another layer onto the CRUD operations against our state machine store 😵‍💫

Comment on lines 1187 to 1192
for alias in state_machine_revision.aliases:
if alias.is_router_for(state_machine_version_arn=state_machine_version_arn):
raise ConflictException(
"Version to be deleted must not be referenced by an alias. "
f"Current list of aliases referencing this version: [{alias.name}]"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we not be constructing the exception message with multiple aliases?

)
state_machine_revision.delete_version(state_machine_version_arn)

state_machines.pop(state_machine_version.arn)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
state_machines.pop(state_machine_version.arn)
state_machines.pop(state_machine_version.arn, None)

Probably unlikely but since we're not locking here, that means that if this state machine version has already been deleted, doing a pop from a dictionary could result in aKeyError. Maybe let's be defensive and allow for the None case to be defaulted to.

Comment on lines 1166 to 1170
if (
state_machine_revision := state_machines.get(state_machine_version.source_arn)
) is None or not isinstance(state_machine_revision, StateMachineRevision):
continue
state_machine_revision.aliases.remove(alias)
Copy link
Contributor

Choose a reason for hiding this comment

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

When theStateMachineRevision is retrieved from the store, this state_machine_revision.aliases.remove(alias) will raise an exception. I noticed this being raised in test_base_lifecycle_create_update_describe.

Perhaps rather use the idempotent discard which wont raise an exception when trying to delete a non-existent key from a set:

Suggested change
if (
state_machine_revision := state_machines.get(state_machine_version.source_arn)
) is None or not isinstance(state_machine_revision, StateMachineRevision):
continue
state_machine_revision.aliases.remove(alias)
if (
state_machine_revision := state_machines.get(state_machine_version.source_arn)
) is None or not isinstance(state_machine_revision, StateMachineRevision):
continue
state_machine_revision.aliases.discard(alias)

@MEPalma MEPalma merged commit 596fae6 into master Mar 10, 2025
31 checks passed
@MEPalma MEPalma deleted the MEP-sfn-aliasing branch March 10, 2025 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0