-
Notifications
You must be signed in to change notification settings - Fork 128
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-15168 | Proofing components now only takes idv_session #11771
Conversation
changelog: Internal, IDV, Update ProofingComponents to only take an idv_session
…that call it to avoid everything breaking in an utterly predicatable manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hit some really bizarre test failures. I'm starting to wrap up for the day, but want to dig into them tomorrow morning.
@@ -63,6 +63,8 @@ def update | |||
sponsor_id: enrollment_sponsor_id, | |||
) | |||
|
|||
idv_session.doc_auth_vendor = Idp::Constants::Vendors::USPS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I question later down in the spec whether this is actually correct behavior. Arguably this isn't a doc auth proofing component here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the IPP flow, the USPS effectively takes the role of doc auth, so that is how it gets logged (the history seems to go back to this commit from ~2 years ago)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, actually: We are doing this exact thing over in StateIdController
now.
So I think we can:
- Delete this line
- Move the tests for proofing components a that are currently in usps_locations_controller_spec.rb over to state_id_controller_spec.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's even better than that. The tests already do it: https://github.com/18F/identity-idp/blob/main/spec/controllers/idv/in_person/state_id_controller_spec.rb#L208-L212
Just pushed an update removing this line and the obsolete tests.
@@ -147,7 +142,6 @@ | |||
expect(ResolutionProofingJob).to receive(:perform_later).with( | |||
hash_including( | |||
proofing_components: { | |||
document_check: 'mock', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to sync up with someone tomorrow on this. This was previously being inferred in the ProofingComponents class. Should we figure out how to do that again, or should we not make this assumption? I slightly leaned towards the latter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthinz I would value your input on this. This was previously being inferred in a Rube Goldberg fashion from DocAuthRouter. It seems like doc_auth_vendor
is being set where it's actually used, and thus this test is no longer accurate because it was testing it in isolation. But I want to treat cautiously removing test coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is just checking that the proofing components are being passed to the ResolutionProofingJob. So I would say removing this one line is fine
end | ||
|
||
it 'returns expected result' do | ||
expect(subject.to_h).to eql( | ||
{ | ||
document_check: 'test_vendor', | ||
document_check: 'feedabee', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I somehow made gitleaks very angry when refactoring and it decided this was a secret. 'feedabee' is one of its approved test values. I just went with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good ol' deadbeef
anagrams!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(But much more happy!)
It looks like the ProofingComponents class was referencing this causing the let() to fire, maksing that it shoudl have been a let!() from the beginning.
@@ -212,7 +212,7 @@ | |||
|
|||
context 'with in establishing in-person enrollment' do | |||
let(:user) { build(:user, :with_establishing_in_person_enrollment) } | |||
let(:enrollment) { user.establishing_in_person_enrollment } | |||
let!(:enrollment) { user.establishing_in_person_enrollment } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This had me tearing my hair out because the enrollment stopped existing in tests here which seemed orthogonal to my changes.
This really should have been let!
from the start. But the if user.establishing_in_person_enrollment
check in ProofingComponents was causing this to pop into existence as a stealthy side effect. Removing that code as no longer necessary removed that unnoticed side effect and suddenly these tests failed because they didn't have an enrollment. 🫨
spec/controllers/idv/in_person/usps_locations_controller_spec.rb
Outdated
Show resolved
Hide resolved
@@ -147,7 +142,6 @@ | |||
expect(ResolutionProofingJob).to receive(:perform_later).with( | |||
hash_including( | |||
proofing_components: { | |||
document_check: 'mock', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthinz I would value your input on this. This was previously being inferred in a Rube Goldberg fashion from DocAuthRouter. It seems like doc_auth_vendor
is being set where it's actually used, and thus this test is no longer accurate because it was testing it in isolation. But I want to treat cautiously removing test coverage.
Co-authored-by: Matt Wagner <[email protected]>
We have an agency partner who requested a specialized report the involves a table with columns representing proofing events and rows representing users for the partner where the values in each cell correspond to whether that user encountered that event in the given time period. We have been manually servicing this request for a little while. This commit adds tooling to generate this report automatically so it does not require manual processing. [skip changelog]
* add requested attribute to accounts_show_presenter * add logic for decorated_sp_session * check for requested_attributes and ial2_requested * add tests for requested attribes and ial2 requested * changelog: User-Facing Improvements, account management, no change available if partner shares all emails * add logic to show/hide change button * clean up controller and presenter * clean up requested_attributes in the rest of controllers and specs * change logic for all emails requested as well as `nil` to `false` in specs * remove `ial2_requested` * lintfix * fix logic to show desired behavior when is false * remove debugger * fix logic * add supporting test for view * match `all_emails_requested` to be a boolean value * add logic for if the partner does not have `email` as a consented attribute * logic change to `all_emails_requested?` * refine check for no email (WIP), refine method name * fix all broken tests * change service provider -> partner * more logic correction * rename and fix logic * Update app/controllers/accounts/connected_accounts_controller.rb Co-authored-by: Andrew Duthie <[email protected]> * change `all_emails requested` -> `change_email_available?` * remove `change_email_available` * move logic around * logic in presenter and view * change to `change_option_available`, fix test * edit test block * change name to be more intuitive * add tests to view * fix account show presenter tests * method name cleanup * more test fixes * more changes * fix eager loading problem Co-authored-by: Andrew Duthie <[email protected]> * lintfix * add test * test 1 for connected apps * check against `identities` and pass value * place logic in model, remove logic from presenter and controller, add check to presenter * no longer doing logic in controller, so return connected apps to previous state * remove `requested_attributes` * fix logic in model and view * method name change * remove unneeded keyword * fix tests * Repurpose ServiceProviderIdentity#hide_change_email? as verified_single_email_attribute? * Revert changes to ApplicationController, AccountShowPresenter spec * Handle nil verified_attributes * Update tests for connected accounts view * Exempt eager loading error validation for connected accounts * Update stubbed identity in connected accounts feature spec to include email --------- Co-authored-by: Andrew Duthie <[email protected]> Co-authored-by: Andrew Duthie <[email protected]>
changelog: Internal, Code Quality, Extract mixin for common MFA deletion behaviors
Log Pii validation event to analytics in the Socure flow changelog: Upcoming Features, Socure, Log Pii validation --------- Co-authored-by: Amir Reavis-Bey <[email protected]>
changelog: Internal, Reporting, Create MFA Report script
We have a partner who requested a specialized IdV drop-off report for their service providers. This report needs to run every Monday and collect weekly data from a specified date up through the previous week. We have been running this report manually for a few weeks now. This commit moves the code the generates this report into the IdP so it can be run automatically. [skip changelog]
* set socure_docv_wait_polling timestamp to nil in show on hybrid mobile * add changelog changelog: Internal, IdV Doc Auth, Allow timed out user to retry docv * have spec ensure socure_docv_wait_polling_started_at is nil
…#11819) We have received clarification on the following from our vendor: 1. The `Fields_Sex` attribute is no longer available in the `ID_AUTH_FIELDS` group 2. The `Sex` attribute available in the `AUTHENTICATION_RESULT` group can be used to reliably determine the sex displayed on the document 3. The `Sex` attribute in the `AUTHENTICATION_RESULT` group takes on the values of `Male` or `Female`. This commit updates the `DocPiiReader` and the TrueID response fixtures to reflect this. [skip changelog]
|
||
analytics.idv_in_person_proofing_state_id_submitted( | ||
**analytics_arguments.merge(**form_result), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to log this after setting doc_auth_vendor
now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may or may not be my fault. (Unfortunately, it was the least janky way of doing it.)
@@ -584,7 +584,7 @@ | |||
flow_path: 'standard', opted_in_to_in_person_proofing: false | |||
}, | |||
'IdV: in person proofing state_id visited' => { | |||
step: 'state_id', flow_path: 'standard', analytics_id: 'In Person Proofing', proofing_components: { document_check: 'usps' } | |||
step: 'state_id', flow_path: 'standard', analytics_id: 'In Person Proofing' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to call out this behavior change. doc_auth_vendor
is now only set in the update method. IMHO this is correct behavior, because you don't really have a vendor until you've done the thing. But if any old events are depending on this field being here, it won't be going forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow-up: We should reach out to any teams that are depending on this field being present through the whole flow or just generally make a few announcements at eng huddle.
I have some scripts that I can share which check for usage of a particular field in CW queries and dashboard.
user:, | ||
) | ||
end | ||
idv_session.doc_auth_vendor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: There is probably some 50/50 state here that needs handling in the interim. I had to do something similar when I added source_check
and haven't gotten around to cleaning it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I'm seeing it, but let's make sure I'm not just overlooking something. doc_auth_vendor
is already being set in prod, right?
The constructor change should only be problematic if there's background job usage where what's available changes, and I didn't see any of that. I think all the controller-level action will be consistent since we're already storing this in the session in prod.
But my comment here is just intended to outline my thinking. What else should I be looking at?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right. I was thinking in terms of jobs not the controller context. This is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. My only "blocker" would be the 50/50 state issue.
I think that it will only affect folks in GPO/IPP flows since they may have started their IdV process before doc_auth_vendor was added to Idv::Session.
user:, | ||
) | ||
end | ||
idv_session.doc_auth_vendor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: There is probably some 50/50 state here that needs handling in the interim. I had to do something similar when I added source_check
and haven't gotten around to cleaning it up.
@@ -584,7 +584,7 @@ | |||
flow_path: 'standard', opted_in_to_in_person_proofing: false | |||
}, | |||
'IdV: in person proofing state_id visited' => { | |||
step: 'state_id', flow_path: 'standard', analytics_id: 'In Person Proofing', proofing_components: { document_check: 'usps' } | |||
step: 'state_id', flow_path: 'standard', analytics_id: 'In Person Proofing' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow-up: We should reach out to any teams that are depending on this field being present through the whole flow or just generally make a few announcements at eng huddle.
I have some scripts that I can share which check for usage of a particular field in CW queries and dashboard.
@@ -58,46 +56,10 @@ | |||
end | |||
|
|||
describe '#document_check' do | |||
it 'returns nil by default' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: these tests still seem valuable, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's debatable. The method now just returns whatever doc_auth_vendor
contains.
The IPP ones no longer make sense here, since we're looking at proofing components in isolation and it doesn't know anything about IPP. Equivalent coverage exists in the IPP code.
'returns nil by default' is valid-ish, but I figured I'd remove the whole thing because really it would just be testing that Ruby returns nil for uninitialized attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question resolved, LGTM!
🎫 Ticket
Link to the relevant ticket:
LG-15168
🛠 Summary of changes
Now that LG-15166 has landed, we can simply ProofingComponents a bit. The initializer only needs to take an
idv_session
, which also simplifies the code.