PIR: Add handling of GenerateEmail action#8294
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6eac148. Configure here.
| val updatedProfileWithEmail = currentBrokerStep.profileToOptOut.copy( | ||
| email = (event as EmailReceived).generatedEmailData.emailAddress, | ||
| ) | ||
| attemptFireOptOutStagePixel(currentBrokerStep, state) |
There was a problem hiding this comment.
We should revisit if we want to fire pixels for scan and optout/email confirmation?
| actionToExecute, | ||
| pushDelay, | ||
| completeRequestData(currentBrokerStep, actionToExecute, state.profileQuery, requestData), | ||
| completeRequestData(currentBrokerStep, actionToExecute, state.profileQuery, requestData, state.generatedEmailData), |
There was a problem hiding this comment.
I assume this will still change once we introduce the GetEmailData right?
57b9781 to
feb3698
Compare
f2f0cf0 to
9fde6a4
Compare
feb3698 to
b9ac7be
Compare
9fde6a4 to
ec6dfe0
Compare
b9ac7be to
2b18366
Compare
2b18366 to
e974a7d
Compare
ec6dfe0 to
a5d392a
Compare
a5d392a to
f9b69ff
Compare
e974a7d to
9cb269d
Compare
9cb269d to
81eaf81
Compare
f9b69ff to
8197210
Compare
81eaf81 to
aa8e6f8
Compare
8197210 to
9ef29ae
Compare


Task/Issue URL: https://app.asana.com/1/137249556945/project/481882893211075/task/1213993026941869?focus=true
Description
Adds logic for GenerateEmail action and refactors the implicit email handling to use same approach as the new explicit one.
Steps to test this PR
Will be testable later when feature is complete.
UI changes
No UI changes
Note
Medium Risk
Moderate risk because it changes PIR action sequencing and how generated emails are propagated into script request data, which can affect opt-out/email-confirmation flows and retries across multiple broker step types.
Overview
Adds first-class handling for
BrokerAction.GenerateEmail:ExecuteBrokerStepActionEventHandlernow requests email generation when encountering this action, andEmailReceivedEventHandleradvances to the next action when the current action wasGenerateEmail.Refactors the legacy implicit
needsEmailpath to stop mutatingprofileToOptOut.email; instead it stores the email inState.generatedEmailDataand injects the email intoUserProfile.extractedProfileonly when building script request params (including retry cases), and fails fast if the implicit path is hit forScanStep.Updates and expands unit tests to cover explicit vs implicit flows, scan-step behavior, pixel emission, and ensuring existing
generatedEmailDataprevents re-requesting email generation.Reviewed by Cursor Bugbot for commit 9ef29ae. Bugbot is set up for automated code reviews on this repo. Configure here.