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

[CCAP-661][CCAP-698] Handle incorrect confirmation code on landing screen followup work #1229

Merged
merged 9 commits into from
Feb 28, 2025

Conversation

cram-cfa
Copy link
Contributor

πŸ”— Jira ticket

https://codeforamerica.atlassian.net/browse/CCAP-661
https://codeforamerica.atlassian.net/browse/CCAP-698

✍️ Description

πŸ“· Design reference

βœ… Completion tasks

  • Added relevant tests
  • Meets acceptance criteria

@enyia21 enyia21 temporarily deployed to il-gcc-marc-ccap-661-cp9249epv February 28, 2025 14:59 Inactive
submissionRepositoryService.save(dummyFamilySubmission);

dummyFamilySubmission = submissionRepositoryService.save(dummyFamilySubmission);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol this literally wasted 3 hours of my life, as I struggled to figure out why the family submission id was magically being removed from the session. oops.

@@ -40,6 +41,7 @@ void setUp() {
submission.setId(UUID.randomUUID());
}

@Ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tired of this test failing more often than not on Github, so commenting it out until we have time to investigate further. Hopefully next week I can find the time!

if (("/").equals(refererUri.getPath())) {
newSession.setAttribute(SESSION_KEY_CAME_FROM_HOME_PAGE, true);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just grab the referrer (infamously misspelled) from the request header. If it's the root of the application, we know it's the homepage. If someone clicked a link, it shouldn't be set at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could this live in a helper method cameFromHomePage(Referer referer)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I make a little helper method!

submissionRepositoryService.save(providerSubmission);
providerSubmission.getInputData().put("clientResponseChildren",
ProviderSubmissionUtilities.getChildrenDataForProviderResponse(familySubmission.get()));
submissionRepositoryService.save(providerSubmission);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is all just reformatting of the code. I was in it while debugging, no actual code changes here.

@enyia21 enyia21 temporarily deployed to il-gcc-marc-ccap-661-cp9249epv February 28, 2025 15:14 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-marc-ccap-661-cp9249epv February 28, 2025 15:27 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-marc-ccap-661-cp9249epv February 28, 2025 15:55 Inactive
@@ -40,6 +41,7 @@ void setUp() {
submission.setId(UUID.randomUUID());
}

@Disabled
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test keeps failing intermittently on Github runs. Skipping it for now, and hopefully we can find time in the next week to make the test more reliable.

Copy link
Contributor

@enyia21 enyia21 left a comment

Choose a reason for hiding this comment

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

I had one small comment. I will test this on heroku but the code looks great. πŸ‘

@enyia21 enyia21 temporarily deployed to il-gcc-marc-ccap-661-cp9249epv February 28, 2025 17:19 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-marc-ccap-661-cp9249epv February 28, 2025 17:37 Inactive
if (referer != null) {
URI refererUri = new URI(referer);
if (("/").equals(refererUri.getPath())) {
newSession.setAttribute(SESSION_KEY_CAME_FROM_HOME_PAGE, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

cool so this is only set when it was a valid confirmation code

@@ -525,6 +525,8 @@ flow:
beforeSaveAction: ConnectProviderApplicationToFamilyApplication
onPostAction: GenerateDummyFamilySubmissionForDev
nextScreens:
- name: response
condition: ShouldSkipConfirmationCode
- name: confirmation-code
confirmation-code:
crossFieldValidationAction: ValidateConfirmationCodeAndSaveId
Copy link
Contributor

Choose a reason for hiding this comment

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

My only concern is whether any if these actions are important for an application: ValidateConfirmationCodeAndSaveId or CheckFamilySubmissionForProvider

Copy link
Contributor Author

@cram-cfa cram-cfa Feb 28, 2025

Choose a reason for hiding this comment

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

Great question and valid concern! I dug into those yesterday to make sure I wasn't missing something obvious.

ValidateConfirmationCodeAndSaveId validates that the confirmation code was valid and not expired, etc but we already know that it's good to go because the initial intake of the code from the homepage will already have validated it. It also saves the familySubmissionId to the provider submission, that happens as well when the Provider enters their id number with ConnectProviderApplicationToFamilyApplication -- and because the provider can't change the confirmation code from family submission A to family submission B now, because we're not showing the screen to enter the confirmation code, there's no risk of us joining the wrong family submission to the provider submission in this scenario.

CheckFamilySubmissionForProvider is a similar scenario -- we run this action on the initial intake of the confirmation code, either via a link or now from the homepage input. We have to run it again if we allow the provider to enter a confirmation code because they might have entered/used the link for family A... and then they could change it to family B... but since we're now skipping the screen, the provider won't be able to cause chaos in that manner.

So, we should be good here. I walked through the flow and it seemed to all work for me, the tests all pass, etc. Staring at this yesterday and today, walking through it with the debugger, I feel pretty confident in the above two paragraphs πŸ˜„

@enyia21
Copy link
Contributor

enyia21 commented Feb 28, 2025

Tested in Heroku. Works Great!

…CCAP-661 (#1230)

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
@enyia21 enyia21 temporarily deployed to il-gcc-marc-ccap-661-cp9249epv February 28, 2025 19:53 Inactive
Copy link
Contributor

@analoo analoo 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 fixing these

@cram-cfa cram-cfa merged commit b1768f9 into main Feb 28, 2025
5 checks passed
@cram-cfa cram-cfa deleted the marc-CCAP-661 branch February 28, 2025 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants