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-14231: Users can't access accounts after enrollment expires #11105

Merged

Conversation

eileen-nava
Copy link
Contributor

@eileen-nava eileen-nava commented Aug 16, 2024

🎫 Ticket

LG-14231: Expired enrollments put users in broken account state

🛠 Summary of changes

  • The GetUspsProofingResultsJob, when it expires in_person_enrollments, will now also mark the associated profile's in_person_verification_pending_at field as nil and mark the profile as inactive.
  • This was meant to fix a bug described below
  1. a user does IPP verification online
  2. doesn’t go to the post office within the necessary time and their enrollment expires
  3. after the enrollment expires, they log into login.gov and can’t access their account due to a 500

Related PR: Bug fix for PR10847 - Verified pending states

📜 Testing Plan

  • Login through the oidc sinatra application selecting the Enhanced In-Person Proofing level of service.
  • Create a new account
  • Complete the in-person enrollment flow reaching the barcode (ready_to_verify page)
  • Use the rails console to update the enrollment to have a past-due due date
enrollment = InPersonEnrollment.last
enrollment.days_to_due_date ==> 6
enrollment.update!(enrollment_established_at: enrollment.created_at - 8.days)
enrollment.days_to_due_date => -1
job =GetUspsProofingResultsJob.new 
job.instance_variable_set('@enrollment_outcomes', { enrollments_expired: 0, enrollments_ch
ecked: 0 }) 
job.send(:check_enrollment, enrollment)
enrollment.reload
  • Refresh the page and confirm that you don't see a 500.

Then, examine the profile with the below command
enrollment.profile

Confirm that

  • the profile is not active
  • the profile in_person_verification_pending_at field is nil

@eileen-nava eileen-nava requested review from a team and shanechesnutt-ft August 16, 2024 21:26
@eileen-nava eileen-nava changed the title Em/14231 users cant access accounts after enrollment expires LG-14231: Users can't access accounts after enrollment expires Aug 16, 2024
@eileen-nava eileen-nava requested review from a team August 16, 2024 21:27
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.

How should we handle existing expired in-person enrollments?

Can we add a test for the identity verification view that had been raising exceptions, to include a context case that would fail on main for the expired enrollment?

@@ -196,6 +196,14 @@ def deactivate_due_to_gpo_expiration
)
end

def deactivate_due_to_ipp_expiration
Copy link
Contributor

Choose a reason for hiding this comment

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

Seeing that this largely follows from the equivalent GPO behavior, would we have a similar need to track the "expired at" value as is done with GPO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we need to see when an in_person_enrollment was expired, we could inspect the in_person_enrollment's status_check_completed_at field. It's set in the GetUspsProofingResultsJob when we expire an enrollment.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think for parity with other profile features we should get an ipp_enrollment_expired_at field added to Profile, then use the status_check_completed_at to seed those values.

Copy link
Contributor

Choose a reason for hiding this comment

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

(That does not need to block this PR though)

@@ -259,6 +259,12 @@

before do
enrollment_records = InPersonEnrollment.where(id: pending_enrollments.map(&:id))
# Below sets in_person_verification_pending_at
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a ticket for refactoring the in_person_enrollments factory, LG-14237. I agree that this isn't the ideal set-up, but due to the time-sensitive nature of the bug, this was the approach we took.

@@ -196,6 +196,14 @@ def deactivate_due_to_gpo_expiration
)
end

def deactivate_due_to_ipp_expiration
Copy link
Contributor

Choose a reason for hiding this comment

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

Might recommend writing tests for this in spec/models/profile_spec.rb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See 554c8f6.

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.

Approving since I think it helps stem future issues, but still curious about existing ones.

@eileen-nava eileen-nava merged commit 9dac9eb into main Aug 19, 2024
2 checks passed
@eileen-nava eileen-nava deleted the em/14231-users-cant-access-accounts-after-enrollment-expires branch August 19, 2024 17:02
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