Skip to content

LG-16288: Guard against nil enrollment#12288

Merged
solipet merged 3 commits intomainfrom
dprice/lg-16288
Jul 1, 2025
Merged

LG-16288: Guard against nil enrollment#12288
solipet merged 3 commits intomainfrom
dprice/lg-16288

Conversation

@solipet
Copy link
Contributor

@solipet solipet commented Jun 25, 2025

🎫 Ticket

Link to the relevant ticket:
LG-16288

🛠 Summary of changes

We have seen some errors where the enrollment passed to the IPP verify_info_presenter is nil.

In #11939 we started cancelling enrollments upon visiting the Welcome page which is how, we believe, the user ended up with a nil enrollment. That change doesn't align with the work we did previously on Team Ada with the FlowPolicy which intended for controllers in the idv flow to define a StepInfo that includes preconditions and a proc to clean up (undo) the action. The FlowPolicy work was intentionally done to allow users to use the back/forward buttons at will.

This PR updates the IPP controllers preconditions to ensure that if an establishing enrollment is not present the user will be redirected back in the flow to the proper place.

We have seen some errors where the enrollment passed to the IPP
verify_info_presenter is nil. This guards against that error, though it
is currently unclear how the enrollment could be nil here.

This may result in kicking the error further down the stack, but that
may give a clue as to where/how this is happening.

changelog: Bug Fixes, Passports, Guard against a nil enrollment.

def passport_flow?
@enrollment.passport_book?
@enrollment&.passport_book?
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels dangerous to allow a nil enrollment here since it in theory can't be. Can we look further to understand the cause better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks for the pushback!

Shane and I paired yesterday afternoon and managed to identify the uuid of the user that triggered this and examine their activity. Our best guess is that they started IPP, then when they failed IV they appear to have gone back to the Welcome page, but then returned to the verify info page, either via browser back/forward buttons or maybe a saved url.

I've updated the title and summary to reflect the new changes.

solipet and others added 2 commits June 26, 2025 16:36
the establishing enrollment exists.

Co-authored-by: Shane Chesnutt <shane.chesnutt@gsa.gov>
@solipet solipet requested a review from mitchellhenke June 27, 2025 18:01
Copy link
Contributor

@AShukla-GSA AShukla-GSA left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Mawar2 Mawar2 left a comment

Choose a reason for hiding this comment

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

Looks good - the preconditions approach is much cleaner than defensive nil checks. Nice work tracking down the root cause.

@solipet solipet merged commit 54d37d5 into main Jul 1, 2025
1 check passed
@solipet solipet deleted the dprice/lg-16288 branch July 1, 2025 04:33
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