Skip to content

IdV enrollment complete event#12132

Merged
Sgtpluck merged 9 commits intomainfrom
dmm/idv-enrollment-complete
May 6, 2025
Merged

IdV enrollment complete event#12132
Sgtpluck merged 9 commits intomainfrom
dmm/idv-enrollment-complete

Conversation

@Sgtpluck
Copy link
Copy Markdown
Contributor

@Sgtpluck Sgtpluck commented May 2, 2025

🎫 Ticket

Link to the relevant ticket:
163

🛠 Summary of changes

This change adds the idv-enrollment-complete event.

This is a new event that was added to fulfill the Enrollment complete milestone requirement.
It is a little tricky since there are several different pathways for users to finish their identity proofing journey, two of which are not part of the user flow.

The places where we activate a profile (thereby indicating that a profile's enrollment is "complete") is:

  • EnterPasswordController- where a user encrypts their data with their password
  • GpoVerifyForm - where a user submits their mail code
  • GetUSPSProofingResultsJob - where a user's IPP job is processed
  • ActionAccount::ReviewPass - where a user is cleared as valid after a fraud review

I would love to know if I am missing or misinterpreting any of these steps, or if other work should. (I wish I could just put this event on the Profile model's #active method, but there isn't a way really to inject the tracker into the Profile like that.)

@Sgtpluck Sgtpluck requested a review from mitchellhenke May 2, 2025 12:57
@amirbey amirbey requested review from a team, eileen-nava, solipet and theabrad and removed request for a team, eileen-nava and solipet May 2, 2025 17:01
@Sgtpluck Sgtpluck force-pushed the dmm/idv-enrollment-complete branch from 8fc57bb to f2adb19 Compare May 5, 2025 13:29
@Sgtpluck
Copy link
Copy Markdown
Contributor Author

Sgtpluck commented May 5, 2025

I added a reproof attribute to handle a milestone of identifying when a user had previously proofed completed idv enrollment.

@Sgtpluck Sgtpluck force-pushed the dmm/idv-enrollment-complete branch from f2adb19 to 825248e Compare May 5, 2025 13:50
Copy link
Copy Markdown
Contributor

@eileen-nava eileen-nava left a comment

Choose a reason for hiding this comment

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

I left some comments.

I have an overall question about the AttemptsApi's events. When I'm working locally, I frequently run make watch_events in terminal to see what events are being logged. Is there a similar process I could run to see what events are being logged for the AttemptsApi?

reproof = enrollment.user&.has_proofed_before?
enrollment.profile&.activate_after_passing_in_person

if enrollment.profile&.active?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since L494 activates the profile associated with the enrollment, I'm not clear why the conditional on L496 is necessary. Is there a scenario where the profile associated with the enrollment wouldn't be active? Are you concerned about the transaction in activate_after_passing_in_person failing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

both if it fails, or if an enrollment profile doesn't exist. i don't know what circumstances exist that a profile wouldn't exist on an enrollment, but i am taking my cues from the other code that adds the nil checker (such as enrollment.profile&.activate_after_passing_in_person, above)

success = true

if profile.active?
attempts_api_tracker(profile:).idv_enrollment_complete(reproof:)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good from an IPP perspective.

@gina-yamada
Copy link
Copy Markdown
Contributor

For IPP, above your wrote where a user's IPP job is processed. Should this log when the user passes? Or should it log when then enrollment is processed (ie: user may have failed or the enrollment with USPS may have expired)?

@Sgtpluck
Copy link
Copy Markdown
Contributor Author

Sgtpluck commented May 5, 2025

@gina-yamada it should log when the profile has been activated.

@eileen-nava interesting suggestion! there is not a way to do that currently from the idp, but i can consider building that in when i have some free time again. meanwhile, the sample sinatra oidc application does have an attempt-api endpoint now that shows tracked events, if you are using the sample oidc application locally.

Copy link
Copy Markdown
Contributor

@mitchellhenke mitchellhenke left a comment

Choose a reason for hiding this comment

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

Couple small questions, but otherwise looks good to me

end

def init_profile
reproof = current_user.has_proofed_before?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was going to ask if this could be moved into the conditional, but that wouldn't work because if we ran this check after creating a profile, it would always be true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, exactly. i thought about checking to see if there was more than one profile that had the activated_at attribute, but i don't think what was happening was as clear

end

if profile.active?
attempts_api_tracker.idv_enrollment_complete(reproof:)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could this be moved below UserAlerts::AlertUserAboutAccountVerified.call? I think it might be preferable to run the other things first (in terms of importance).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure, added in a39cefb

@gina-yamada
Copy link
Copy Markdown
Contributor

@gina-yamada it should log when the profile has been activated.

@eileen-nava interesting suggestion! there is not a way to do that currently from the idp, but i can consider building that in when i have some free time again. meanwhile, the sample sinatra oidc application does have an attempt-api endpoint now that shows tracked events, if you are using the sample oidc application locally.

I didn't check but the only edge case you may need to look into- if a user is flagged for fraud. They can be activated after the investigation concludes. It is not in the usps job but there is a script to activate users-I bet you already handled it.

@Sgtpluck
Copy link
Copy Markdown
Contributor Author

Sgtpluck commented May 5, 2025

@gina-yamada thanks for the heads-up about that edge case! i believe it is handled in the ActionAccount::ReviewPass class, but appreciate you bringing it to my attention in case I had overlooked it!

@gina-yamada
Copy link
Copy Markdown
Contributor

gina-yamada commented May 5, 2025

@gina-yamada thanks for the heads-up about that edge case! i believe it is handled in the ActionAccount::ReviewPass class, but appreciate you bringing it to my attention in case I had overlooked it!

That looks accurate! I should have looked at the code and posted if it was not there. I was replying to comments and then jumped back in. I agree - handled in ReviewPass class. I think you are set. Nice work.

@Sgtpluck Sgtpluck merged commit 8a75c74 into main May 6, 2025
1 check passed
@Sgtpluck Sgtpluck deleted the dmm/idv-enrollment-complete branch May 6, 2025 12:27
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