Skip to content

LG-9784 New Hybrid Handoff Controller fka Upload Step#8407

Merged
eric-gade merged 23 commits intomainfrom
eric-lg-9784
May 25, 2023
Merged

LG-9784 New Hybrid Handoff Controller fka Upload Step#8407
eric-gade merged 23 commits intomainfrom
eric-lg-9784

Conversation

@eric-gade
Copy link
Contributor

🎫 Ticket

LG-9784

🛠 Summary of changes

Adding new HybridHandoffController with show method, view, and specs. This controller is behind a feature flag and is set to false by default.

Do not merge until #8394 has been merged and deployed.

@eric-gade eric-gade requested a review from a team May 16, 2023 20:10
Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

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

LGTM!

eric-gade and others added 21 commits May 25, 2023 10:56
Co-authored-by: Sonia Connolly <sonia.connolly@gsa.gov>
Co-authored-by: Amir Reavis-Bey <amir.reavis-bey@gsa.gov>

changelog: Internal, FSM Removal, Add new controller for hybrid
handoff (feature-flagged)
Adding initial update method(s) and single passing test using it
Co-authored-by: Sonia Connolly <sonia.connolly@gsa.gov>
Updated the flow hashes for steps and final_url to conditionally add
the Upload step based on the presence/absence of the config flag
Analytics always need a bucket value for the Acuant AB Test, and will
provide :default if you pass in nil.
Conditional FSM settings don't work well with CI
-- Why
The original upload step spec did not test for the presence of the
acuant analytics at all. We added this check to the _new_ controller
test, but it's unclear that we want to even log acuant ab testing
information at this step.

We are also restoring the removed code in the acuant concern which
checked for the presence of a document capture session uuid before
returning any value
Copy link
Contributor

@soniaconnolly soniaconnolly left a comment

Choose a reason for hiding this comment

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

LGTM! Some comments, and a query about a feature test enclosing context.

Findings from testing locally:

  • Basic functionality works great. It goes to the page from Agreement with the flag set.

  • Throttling works on sending link.

  • On the hybrid_handoff page, visiting link_sent early redirects to document_capture instead of back to hybrid_handoff. I think this is worth investigating, but not a blocker to merge. The back button works!

  • Visiting hybrid_handoff from the hybrid_mobile flow 500s because of a before action using current_user. I'm going to put in a PR on main for that.

  • Can click back to get to hybrid_handoff after submitting docs, but clicking upload photos goes straight to SSN step because of guards in document_capture. We should either put a guard on hybrid_handoff if there's already pii in session, or remove the guards in document_capture. Again, I don't think this should block merging.

Comment on lines +46 to +47
idv_session.phone_for_mobile_flow = params[:doc_auth][:phone]
flow_session[:phone_for_mobile_flow] = idv_session.phone_for_mobile_flow
Copy link
Contributor

Choose a reason for hiding this comment

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

Noting here that when we're ready to delete the feature flag, we'll stop adding flow_session[:phone_for_mobile_flow] and start reading it from idv_session in LinkSentController.

errors: { message: telephony_result.error&.friendly_message },
extra: {
telephony_response: telephony_result.to_h,
destination: :link_sent,
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we still need destination in analytics or if we can delete that everywhere.

before_action :confirm_agreement_step_complete

def show
flow_session[:flow_path] = 'standard'
Copy link
Contributor

Choose a reason for hiding this comment

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

Setting flow_path here so it will show up in analytics, although it doesn't really make sense if they haven't chosen a flow_path yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is done to get it into the analytics so we can make a GET request to the document capture controller. An alternative approach may be to set this param in the document capture controller or link sent controller methods. That way the last one the user visits will persist for the rest of the flow.

Comment on lines 46 to 47
if flow_session[:flow_path] == 'standard'
redirect_to idv_document_capture_url
Copy link
Contributor

Choose a reason for hiding this comment

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

We're checking for flow_path == standard here because link_sent is currently the final url for DocAuthFlow. We'll need to think through this again when we change the final url again.

and_return(fake_attempts_tracker)
end

context 'on a desktop device', js: true do
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need js: true? I believe this enclosing context is left over from when there was a mobile -> desktop flow, so it could be deleted to leave the specs at the top level. Or renamed to say the feature flag is set, and add a 404 test at the bottom for when the feature flag is not set. Optional, since that's in the controller tests already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately we need the JS here because anything with phone numbers gets cleaned up client side, so the numbers won't match otherwise

@soniaconnolly soniaconnolly requested a review from jmhooper May 25, 2023 16:58
**analytics_arguments.merge(form_response(destination: :link_sent).to_h),
)

telephony_form_response
Copy link
Contributor

Choose a reason for hiding this comment

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

Returning the form response object is a relic of the flow state machine. I don't think we need it anymore. I think we should move the analytics call up with the irs_attempts_api_tracker call and then let the failure_reason conditional be the last thing we do here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately analytics_arguments needs to read from the flow_session to get the correct :flow_path, and that is only set on line 62 in hybrid cases. If analytics is moved before that line it will report the incorrect flow path. But agree on returning the response

Copy link
Contributor

Choose a reason for hiding this comment

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

gotcha. regardless I don't think we need this return

<%= simple_form_for(
:doc_auth,
url: url_for(type: :desktop),
method: 'PUT',
Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed making this a link. Did we decide not to take that approach in this changeset?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided against it for now because there were too many unknowns. For example, if we change how we are using the flow session to update/read the flow_path, we lose the ability to set it to standard explicitly in the form handler for manual upload (see bypass_send_link_steps). In the same vein, we would need to decide whether we really need an analytics call when users click that option, and, if so, whether that call would now happen on the frontend

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're setting flow_path to standard on :show, that might make it easier to make this a link. Good point about analytics though.

@eric-gade eric-gade merged commit a6728ff into main May 25, 2023
@eric-gade eric-gade deleted the eric-lg-9784 branch May 25, 2023 20:07
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.

4 participants