Skip to content

LG-8901: New Hybrid Handoff (upload step) with feature flag#7849

Merged
eric-gade merged 31 commits intomainfrom
eric-lg-8230
Feb 22, 2023
Merged

LG-8901: New Hybrid Handoff (upload step) with feature flag#7849
eric-gade merged 31 commits intomainfrom
eric-lg-8230

Conversation

@eric-gade
Copy link
Contributor

@eric-gade eric-gade commented Feb 17, 2023

🎫 Ticket

LG-8901

🛠 Summary of changes

This PR is the first in a multi-step process of completing the parent story LG-8230. At issue is combining the current upload and send_link FSM steps. The Figma for the new designs can be found here.

These particular changes do the following:

  1. Create a new feature flag / config variable called doc_auth_combined_hybrid_handoff_enabled, which is by default set to false.
  2. Updates the upload_step to handle functionality that is currently handled by the send_link step (in particular, the sending of the hybrid flow SMS link), but only in cases where the feature flag is enabled
  3. Creation of split views for the upload step -- one for the "combined" version (with feature flag enabled) and one that keeps the status quo
  4. Updating of relevant tests with respect to the feature flag
  5. Updating templates, locales, and styles to comply with the designs for the new combined hybrid handoff view (ie upload step)

📜 Testing Plan

The description for ticket LG-8230 contains a plan for how these PRs/deployments should work. For this particular step, we should do the following:

  • Deploy these changes with the feature flag disabled (which is the default), which should maintain the status quo.
  • Test the alternation of the feature flag in a dev environment, particularly trying to simulate a 50/50 deploy state.
  • If there are no errors/bugs caught in the dev testing or in the status quo in prod, update the feature flag to true in prod and monitor.
  • Continue with the remaining sub-tasks of LG-8230, which include the removal of the old code and references to the feature flag.

👀 Screenshots

If relevant, include a screenshot or screen capture of the changes.

Before (upload step with feature flag disabled, ie status quo):

Screen Shot 2023-02-17 at 11 12 31 AM

After (upload step with feature flag enabled):

Screen Shot 2023-02-17 at 11 10 59 AM

eric-gade added 17 commits February 9, 2023 12:45
-- What
Adding initial fields and new icons
-- What
Old code was testing for case where user is at the hybrid handoff
screen (upload step), but is on mobile. We have not allowed that to
happen for a long time, so the code is dead.

changelog: User-Facing Improvements, Hybrid Handoff Screen, Combining
upload and send link steps into one screen
changelog: User-Facing Improvements, Hybrid Handoff Screen, Combining
upload and send link steps into one screen
-- What
Due to the 50/50 issue, and the fact that this ticket requires
combining two FSM steps into one, we need to feature flag all
capabilities relating to the new combined hybrid handoff step while
retaining the existing functionality. With that in mind, this commit
does the following:

1. Creates a new feature flag called
doc_auth_combined_hybrid_handoff_enabled;
2. Splits the normal upload step view to use one or another of two
partials based on the status of that feature flag (the disabled
feature flag version of the partial is exactly the same as the
existing view);
3. Adds some feature tests for the new combined version with the flag
enabled only in the tests
4. Updates the upload_step.rb file to include checking for the feature
flag, while preserving the existing and expected behavior in the
default case of the flag being false
changelog: User-Facing Improvements, Hybrid Handoff Screen, Combining
upload and send link steps into one screen
-- What
The change was causing other steps -- especially the phone step -- to
fail.
Co-authored-by: Sonia Connolly <sonia.connolly@gsa.gov>

changelog: User-Facing Improvements, Hybrid Handoff Screen, Combining
upload and send link steps into one screen
-- What
This commit represents a complete merging of the send_link_step
feature tests into the new combined hybrid handoff / upload step (when
feature flag is enabled).
-- What
This prepares us for the removal of the send_link step, while
preserving the existing testing for the step controller in its new
form under the upload_step
@eric-gade eric-gade requested a review from a team February 17, 2023 16:14
@matthinz
Copy link
Contributor

I might have found an issue in the 50/50 case:

  1. Turn feature flag on
  2. Enter your phone number on the new combined page (/verify/doc_auth/upload), but don't submit the form
  3. Stop the server, turn feature flag off, restart the server
  4. Submit the new combined page
  5. End up on the old "Take a photo with a phone" screen with the phone number field blank; have to re-enter my phone number

@eric-gade
Copy link
Contributor Author

@matthinz Good catch. I just tried that locally and you are correct. Gonna think about this a bit

-- What
As @matthinz pointed out, the current code does not account well for
the following 50/50 states:
1. User is shown the new combined upload view, but submits the phone
number to an instance with the feature flag off;
2. User is shown the original upload view, but clicks the phone button
submitting to an instance where the feature flag is now on

We handle this case by adding a request param _only_ to the form
rendered by the new combined view. That view is only shown to users
who have the feature flag enabled. The upload step will now check for
that param -- called :combined -- and can determine regardless of the
current state of the feature flag, that the user actually has
submitted a phone number to the upload step itself, and that the send
link step should be skipped.
@eric-gade
Copy link
Contributor Author

@matthinz I have just pushed a commit (here) that I think fixes this and other potential 50/50 issues.

The basic idea is this: if the user was ever shown the new view, we will now know because we only tell the form to pass a specific param in the form specified in that view. So regardless of the feature flag state at the time the submission comes in, the upload step will know how to handle the situation.

This assumes that we have deployed with the feature flag off, and that all users are using the new upload step.

That said, I'm not entirely confident in this fix, but it seems to work.

@matthinz
Copy link
Contributor

@eric-gade I think it is fair to assume that the code will go out initially with the feature flag off, then we'll turn it on. Your solution works for me!

Copy link
Contributor

@matthinz matthinz left a comment

Choose a reason for hiding this comment

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

This looks really good! Are you planning on doing the "We sent a message to your phone" screen in this PR? Looks like there are a couple changes in the Figma there.

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
@eric-gade
Copy link
Contributor Author

@matthinz There is another ticket for dealing with the "link sent" screen redesign (LG-8231) and @kbighorse is already on the case.

Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

LGTM 👍

<%= t('doc_auth.info.combined_upload') %>
</p>

<div class="grid-row grid-gap grid-gap-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

From the design reference, it looks like the gap should be 1rem, which would be 2 units in the design system.

Suggested change
<div class="grid-row grid-gap grid-gap-1">
<div class="grid-row grid-gap grid-gap-2">


def formatted_destination_phone
raw_phone = permit(:phone)[:phone]
PhoneFormatter.format(raw_phone, country_code: 'US')
Copy link
Contributor

Choose a reason for hiding this comment

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

Recognizing there's a lot of legacy here being copied verbatim, I still want to flag that it's a bit problematic how we assume phone numbers are U.S., especially since PhoneInputComponent will provide us with a international_code parameter we can plug in here. I suspect this is a hold-over logic from previous implementation where the phone input was a plain input field.

<%= t('doc_auth.info.tag') %>
</div>
<h2 class="margin-y-105">
<%= t('doc_auth.headings.combined_upload_from_phone') %>
Copy link
Contributor

@aduth aduth Feb 22, 2023

Choose a reason for hiding this comment

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

In the future, maybe we circle back to unqualify these as "combined", since once the feature is enabled and the feature flag removed, I don't think we need to consider this as anything other than the default text for the screen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that was the plan. Anything with "combined" will be renamed, including querystring params.

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
@eric-gade eric-gade merged commit 826f9ad into main Feb 22, 2023
@eric-gade eric-gade deleted the eric-lg-8230 branch February 22, 2023 18:27
<%= t('doc_auth.info.combined_upload') %>
</p>

<div class="grid-row grid-gap grid-gap-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

This grid-gap-2 update was missed

@eric-gade
Copy link
Contributor Author

@aduth follow up here: #7873

@solipet solipet mentioned this pull request Feb 23, 2023
solipet added a commit that referenced this pull request Feb 23, 2023
* LG-8796: Add recaptcha disclosure form at bottom of phone setup screen for new and existing accounts (#7827)

* changelog: Upcoming Features, Authentication, Add recaptcha disclosure form at bottom of phone setup screen

* styling fixes and dont hardcode login.gov

* hide and show other movile service

* add captcha submit button to add new phone

* add to hide grecaptcha-badge

* use recaptcha disclosure shared

* remove empty space

* lint recaptcha badge

* Skip devices database query when identifier is null (#7856)

changelog: Internal, Performance, Skip devices database query when identifier is null

* Removed analytics check from password visibility toggle spec. (#7860)

The test was flaky and the flag is unused, per Andrew Duthie.

[skip changelog]

* Removed use of Faker email creation in user factory primary email (#7861)

* Removed use of Faker email creation in user factory primary email

We suspect that using Faker email, rather than explicitly setting
sequential emails, was occasionally creating collisions and leading to
flaky test failures.

[skip changelog]

* Add 2023 SAML certs (#7862)

(symlink 2022 ones to have non-blank files there)

changelog: Internal, Certificates, 2023 SAML Certificate rotation

* LG-8215 Update Event: IDV Reproof using Address verify by Mail (#7859)

changelog: Internal, Attempts API, Update in tracking event

* LG-8604 - Optimize s3 by streaming data w/ feature flag (#7843)

* WIP - optimize s3 by streaming data

changelog: Internal, Attempts API, Scalability Optimization

* shifted a line - rubocop apparently wasn't picky about this

* added feature flag.

updated spec to reflect nested conditionals

* cleaned up some comments.

* broke out s3 response code into its own method.

* cleaned up code based on feedback

* updated default buffer size and made some clarifying changes based on feedback

changelog: Internal, Attempts Api, Optimization: S3 Streaming

* cleaned up more test descriptions.

changelog: Internal, Attempts Api, Feature: S3 Streaming

* Add logging ahead of removing Analytics logic (#7864)

* Add Rails.logger.info logging near proposed call sites

changelog: Internal, Logging, Add logging ahead of streamlining analytics events

* Remove unused Authentication Presenter data  (#7868)

* Remove unused Authentication Presenter data

changelog: Internal, Maintenance, Remove unused methods and variables

* remove unused pivcac email data

* remove more unused methods

* Disable notify for good_job (#7870)

changelog: Internal, Background Jobs, Update GoodJob and disable NOTIFY

* LG-8423 log cancel analytics from barcode page (#7838)

* analytics logged when user cancels from barcode pg

* update event and add spec for for event in sessions controller

* event and spec added for cancellations controller

* changelog: Internal, Analytics Events, add cancel from barcode page analytics event

* fix lint issue w/ spec

* change step to barcode to make unique

* use cancellation go back w/ extra attributes when user comes from barcode pg

* remove new event and update session controller

* update spec

* change enrollment key

* update cancel spec

* check for enrollment and merge extra attributes and update tests

* use pending enrollment and remove sp as it is redundant

* update spec to create pending enrollment

* LG-8901: New Hybrid Handoff (upload step) with feature flag (#7849)

* Adding initial fields and new icons
* Deleting useless hybrid handoff mobile tests
* Pulling in send_link step functionality to upload_step
* Adding feature flag for new combined hybrid handoff step
* Adding additional checking for 50/50 conditions

-- What
As @matthinz pointed out, the current code does not account well for
the following 50/50 states:
1. User is shown the new combined upload view, but submits the phone
number to an instance with the feature flag off;
2. User is shown the original upload view, but clicks the phone button
submitting to an instance where the feature flag is now on

We handle this case by adding a request param _only_ to the form
rendered by the new combined view. That view is only shown to users
who have the feature flag enabled. The upload step will now check for
that param -- called :combined -- and can determine regardless of the
current state of the feature flag, that the user actually has
submitted a phone number to the upload step itself, and that the send
link step should be skipped.

Co-authored-by: Sonia Connolly <sonia.connolly@gsa.gov>
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>

changelog: User-Facing Improvements, Hybrid Handoff Screen, Combining
upload and send link steps into one screen

* Unpack a dynamic send to make code easier to trace (#7869)

* Remove now-unused constant

changelog: Internal, Refactor, Small update to remove dynamic send in 2FA mixin

* LG-8875 / LG-8877: Try to avoid race condition in document-capture-welcome (#7842)

* "Convert" document-capture-welcome to typescript

(It was already valid TS)

* Rework camera check to block form submission

Don't let the form submit until the promise we use to check for the presence / nonpresence of a camera has resolved.

* Disable submit buttons while we wait

* TEMP: Allow injecting delay into hasCamera()

Set HAS_CAMERA_DELAY_MS in localStorage to configure.

* Update app/javascript/packs/document-capture-welcome.ts

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>

* Use SpinnerButtonComponent for welcome/agreement

* Simplify cameraCheckPromise usage

Eliminate additional local variable and just race the promises

* Wrap agreement spinner button in <div>

Adding margin-top-4 to button does not get applied to the spinner dots

* changelog: User-Facing Improvements, Identity verification, help prevent mobile users from ending up in hybrid handoff flow

* Log event from frontend for mobile/camera checks

Ideally, we want to see if this code actually fixes anything.

(Relates to LG-8877)

Co-authored-by: Eric Gade <eric.gade@gsa.gov>

* Refactor perf measuring slightly

Pull out to a function that just augments the promise with perf data

* Add spin_on_click to SpinnerButtonComponent

Allow setting spin-on-click as needed.

* Toggle spinner on form submission

Just in case there is a form validation issue, don't start spinning until we're sure we can actually make the submission.

* await trackEvent that could occur during form submission

* Add idv_mobile_device_and_camera_check to AnalyticsEvents

Document the event and make it so it's not prefixed with "Frontend:"

* Revert "TEMP: Allow injecting delay into hasCamera()"

This reverts commit 96cbc3e.

* Don't use performance.measure()

Complicated API, don't need it for what we're doing.

---------

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
Co-authored-by: Eric Gade <eric.gade@gsa.gov>

* LG-7836 Automatically refresh USPS auth token when necessary (#7808)

* implement retry behavior with repetitive code

* remove begin/rescue blocks and get failing tests

* add retry options to faraday. tests still fail.

* refactor implementation & spec

* changelog:Bug Fixes, In-person proofing, refresh USPS auth token when request fails

* attempt broader retry behavior. tests still fail.

* attempt to refresh token before pinging USPS api. more tests fail

* got first test to pass, need to get other expired token tests passing

* get all expired token tests to pass

* DRY up proofer test setup

* add buffer to expires_at conditional

* fix broken tests by adding redis cache setup

* fix broken enrollment helper tests by adding caching setup

* respond to feedback

* remove no-op

* Fixing missed grid gap sizing (follow up to LG-8901) (#7873)

* Fixing missed grid gap sizing

h/t @aduth

changelog: User-Facing Improvements, Hybrid Handoff Screen, Combining
upload and send link steps into one screen

* LG-9025 Go to new SsnController from hybrid flow when feature flag is set (#7875)

From the DocumentCaptureStep, we only want to redirect to the new SsnController if we are in the DocAuthFlow. This step is reused from the Hybrid Flow, and we don't want to go to the SsnController on mobile. In hybrid flow, we don't return to the DocumentCaptureStep, so redirect to SsnController from LinkSentStep when the feature flag is true as well.

Duplicate the hybrid flow test with doc_auth_ssn_controller_enabled flag set to true and make sure it passes. Note that on my machine even on main without the feature flag I have to set a binding.pry and delay the mobile browser part of the test to get it to pass.

changelog: Internal, refactor, fix hybrid flow with new SsnController (feature flagged)

Co-authored-by: eric-gade <eric.gade@gsa.gov>

---------

Co-authored-by: Malick Diarra <malick.diarra@gsa.gov>
Co-authored-by: Mitchell Henke <mitchell.henke@gsa.gov>
Co-authored-by: John Maxwell <john.maxwell@gsa.gov>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Osman Latif <109746710+olatifflexion@users.noreply.github.com>
Co-authored-by: Rwolfe-Nava <87499456+Rwolfe-Nava@users.noreply.github.com>
Co-authored-by: Shannon A <20867088+svalexander@users.noreply.github.com>
Co-authored-by: Eric Gade <105373963+eric-gade@users.noreply.github.com>
Co-authored-by: Matt Hinz <matt.hinz@gsa.gov>
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
Co-authored-by: Eric Gade <eric.gade@gsa.gov>
Co-authored-by: eileen-nava <80347702+eileen-nava@users.noreply.github.com>
Co-authored-by: Sonia Connolly <sonia.connolly@gsa.gov>
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.

3 participants