refactor(eventbridge): split start_replay into phases#349
Merged
vieiralucas merged 1 commit intomainfrom Apr 13, 2026
Merged
Conversation
start_replay was ~275 lines combining input parsing, destination/archive validation, event collection, replay record insertion, and per-target delivery fan-out. Extract: - StartReplayInput::from_body for the parse + validate phase - collect_replay_events_with_targets to walk the archive + match rules - deliver_replay_event_to_target as a method on the service so the per-protocol dispatch (sqs/sns/lambda/logs/states/http) is reachable as its own named helper The outer function now reads as a 70-line sequence of named phases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`start_replay` was ~275 lines combining input parsing, destination/archive validation, event collection, replay record insertion, and per-target delivery fan-out. Extract three helpers so the outer function reads as a 70-line sequence of named phases:
Test plan
Summary by cubic
Refactored EventBridge
start_replayinto clear phases to improve readability and reuse without changing behavior. The outer function is now ~70 lines and preserves AWS validation order.StartReplayInput::from_bodyfor parsing and validating inputs (including destination ARN).collect_replay_events_with_targetsto filter archive events by time and match rules on the destination bus.deliver_replay_event_to_targetto encapsulate per-protocol delivery (SQS, SNS, Lambda, Logs, Step Functions, HTTP).Written for commit 10616f6. Summary will update on new commits.