Skip to content
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

LG-12979: Create new idv_level value of 'in_person' on Profile #10371

Merged

Conversation

gina-yamada
Copy link
Contributor

@gina-yamada gina-yamada commented Apr 5, 2024

🎫 Ticket

LG-12979 Create new idv_level value of 'in_person'

🛠 Summary of changes

  • Create new value of in_person for idv_level on profile
  • Assign in_person to idv_level on profile when IdentityConfig.store.in_person_proofing_enforce_tmx is true
  • Update specs

📜 Testing Plan

Testing locally...

  • Step 1 Set in_person_proofing_enforce_tmx to false in config.application.yml
  • Step 2 Run idp locally, create an account, attempt to proof but fail remote (else pick IPP if opt-in IPP is enabled) to ultimately create an enrollment in the in person proofing flow
  • Step 3 In another terminal, open the rails console rails c
  • Step 4 Save the enrollment you just created e = InPersonEnrollment.last. (Note the timestamp)
  • Step 5 Inspect the user's profile associated with that enrollment p = e.profile to confirm the value of idv_level is "legacy_in_person"
  • Step 6 Sign out. Close rails console. Shut down server.
  • Step 7 Set in_person_proofing_enforce_tmx to true in config.application.yml
  • Step 8 Run idp locally, create an account, attempt to proof but fail remote (else pick IPP if opt-in IPP is enabled) to ultimately create an enrollment in the in person proofing flow
  • Step 9 In another terminal, open the rails console rails c
  • Step 10 Save the enrollment you just created e2 = InPersonEnrollment.last (Confirm is was the enrollment you just created by checking timestamps.)
  • Step 11 Inspect the user's profile associated with that enrollment p2 = e2.profile to confirm the value of idv_level is "in_person"
  • Step 12 Sign out. Close rails console. Shut down server.

Copy link
Member

@n1zyy n1zyy left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together on such short notice!

I need to pull this down and experiment, but at a glance this looks great. All of the comments I left are extremely trivial suggestions about formatting in the tests; the core logic here all looks great.

spec/services/idv/profile_maker_spec.rb Show resolved Hide resolved
spec/services/idv/profile_maker_spec.rb Show resolved Hide resolved
spec/services/idv/profile_maker_spec.rb Outdated Show resolved Hide resolved
spec/services/idv/profile_maker_spec.rb Outdated Show resolved Hide resolved
spec/services/idv/profile_maker_spec.rb Show resolved Hide resolved
spec/services/idv/profile_maker_spec.rb Show resolved Hide resolved
added multiple newline to separate cases, updated context for consistent communication around tmx

Co-authored-by: Matt Wagner <mattwagner@navapbc.com>
@@ -47,7 +47,9 @@ def save_profile(
private

def set_idv_level(in_person_verification_needed:, selfie_check_performed:)
if in_person_verification_needed
if in_person_verification_needed && IdentityConfig.store.in_person_proofing_enforce_tmx
Copy link
Contributor

Choose a reason for hiding this comment

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

Slight refactor to help clarify what's going on with this check (feel free to ignore)

  if in_person_verification_needed
    if IdentityConfig.store.in_person_proofing_enforce_tmx
      :in_person
    else
      :legacy_in_person
  elsif ...

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 originally had it coded that way but refactored it. I believe elsif is more performant over a nested if. I am happy to change it if nested is preferred.

Copy link
Member

Choose a reason for hiding this comment

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

I don't feel strongly about any of this, but...

I had actually initially gotten hung up on line 52, because I think the && !IdentityConfig.store.in_person_proofing_enforce_tmx bit is logically unnecessary—if it weren't false, it would have matched on line 50. But I think having it anyway makes it a tiny bit clearer what is going on (Jack's suggestion does the same), so I didn't comment.

I'm academically curious to experiment with how nested conditionals compare to inlined ones, but I wouldn't worry too much about that level of optimization here.

tl;dr, I don't have a strong opinion and will support whatever you think is most readable 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.

Okay, for readability I am going with Jack's suggestion as that is how I originally wrote it as well. See commit c08407d

Copy link
Member

Choose a reason for hiding this comment

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

It's an edge case, but I think we should probably also check that FeatureManagement.proofing_device_profiling_decisioning_enabled? is returning true before marking as non-legacy.

Copy link
Contributor

Choose a reason for hiding this comment

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

@matthinz Just curious but what does that value represent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@matthinz - Jack and I talked through your suggestion. We agree with it! I talked Jack into implement it in a different PR as we thought we had better inspect all instances of IdentityConfig.store.in_person_proofing_enforce_tmx to evaluate if FeatureManagement.proofing_device_profiling_decisioning_enabled? should also be considered. That task seemed out of scope for this ticket and we didn't want it to get overlooked here.

Thank you for reviewing this!

New ticket
PR

@n1zyy n1zyy requested review from matthinz and jmhooper April 5, 2024 20:08
@n1zyy
Copy link
Member

n1zyy commented Apr 5, 2024

Manual testing

  • Created an IPP account with everything enabled: marked as in_person
  • Created an IPP account with in_person_proofing_enforce_tmx disabled: marked as legacy_in_person
  • Toggling the flag back on, restarting the app, logging in as the legacy_in_person user, and making an unrelated change to my profile: correctly remains legacy_in_person

Copy link
Contributor

@JackRyan1989 JackRyan1989 left a comment

Choose a reason for hiding this comment

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

Tested locally, works great. Looks good to me!

@@ -48,7 +48,11 @@ def save_profile(

def set_idv_level(in_person_verification_needed:, selfie_check_performed:)
if in_person_verification_needed
:legacy_in_person
if IdentityConfig.store.in_person_proofing_enforce_tmx
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 I will add a check for FeatureManagement.proofing_device_profiling_decisioning_enabled? in a separate pull request.

@gina-yamada
Copy link
Contributor Author

@jmhooper @matthinz I am hoping to get a review/approval from your team on this PR before merging it in. Please let me know what you think. Thanks

@gina-yamada gina-yamada merged commit 3ab92af into main Apr 9, 2024
2 checks passed
@gina-yamada gina-yamada deleted the yamada/LG-12979-create-new-idv-level-value-of-in-person branch April 9, 2024 14:09
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.

None yet

4 participants