Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
34f820c
LG-15168 | ProofingComponents now only use idv_session
n1zyy Jan 16, 2025
64006e2
Merge branch 'main' into mattw/LG-15168-proofing-components-session
n1zyy Jan 17, 2025
269f3eb
Further cleanup now that LG-15166 is merged
n1zyy Jan 17, 2025
f486fdf
LPT: When changing a method definition, consider changing the places …
n1zyy Jan 17, 2025
dfaa0e4
Merge branch 'main' into mattw/LG-15168-proofing-components-session
n1zyy Jan 24, 2025
d4a259b
Merge branch 'main' into mattw/LG-15168-proofing-components-session
n1zyy Jan 27, 2025
2636f8c
Address some failing tests
n1zyy Jan 27, 2025
d22972b
Create enrollment ahead of time
n1zyy Jan 28, 2025
ac46a70
Merge branch 'main' into mattw/LG-15168-proofing-components-session
n1zyy Jan 28, 2025
28cdc2e
Update spec/controllers/idv/in_person/usps_locations_controller_spec.rb
matthinz Jan 28, 2025
e2d3126
LG-15394 Add tooling for an SP proofing events by UUID report (#11787)
jmhooper Jan 28, 2025
59bb941
LG-15248: Account Management no change available (#11701)
jmdembe Jan 28, 2025
d4dd239
Extract mixin for common MFA deletion behaviors (#11796)
aduth Jan 28, 2025
0fd5a07
LG-15309 simple log pii validation to analytics (#11813)
jmax-gsa Jan 29, 2025
f9c2f0a
Create MFA Report script (#11740)
Jan 29, 2025
9c9816e
LG-15395 Add specialized SP IdV Dropoff Report (#11803)
jmhooper Jan 29, 2025
a140ffb
LG-15179 Timed out hybrid user should be able to retry docv (#11792)
theabrad Jan 29, 2025
277b069
LG-15457 Read the sex attribute from the TrueID authentication result…
jmhooper Jan 29, 2025
261d971
Merge branch 'main' into mattw/LG-15168-proofing-components-session
n1zyy Jan 31, 2025
664cf93
Removes unnecessary dead code
n1zyy Jan 31, 2025
04b395f
Fix IPP analytics logging
n1zyy Feb 3, 2025
870be44
Merge branch 'main' into mattw/LG-15168-proofing-components-session
n1zyy Feb 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions app/controllers/concerns/idv/verify_info_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ def shared_update
threatmetrix_session_id: idv_session.threatmetrix_session_id,
request_ip: request.remote_ip,
ipp_enrollment_in_progress: ipp_enrollment_in_progress?,
proofing_components: ProofingComponents.new(
user: current_user,
idv_session:,
session:,
user_session:,
),
proofing_components: ProofingComponents.new(idv_session:),
)

return true
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/idv/enter_password_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,7 @@ def init_profile
profile = idv_session.create_profile_from_applicant_with_password(
password,
is_enhanced_ipp: resolved_authn_context_result.enhanced_ipp?,
proofing_components: ProofingComponents.new(
user: current_user,
idv_session:,
session:,
user_session:,
).to_h,
proofing_components: ProofingComponents.new(idv_session:).to_h,
)

if profile.gpo_verification_pending?
Expand Down
8 changes: 5 additions & 3 deletions app/controllers/idv/in_person/state_id_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def update
pii_from_user[attr] = flow_params[attr]
end

analytics.idv_in_person_proofing_state_id_submitted(
**analytics_arguments.merge(**form_result),
)
# Accept Date of Birth from both memorable date and input date components
formatted_dob = MemorableDateComponent.extract_date_param flow_params&.[](:dob)
pii_from_user[:dob] = formatted_dob if formatted_dob
Expand All @@ -57,6 +54,11 @@ def update
end

idv_session.doc_auth_vendor = Idp::Constants::Vendors::USPS

analytics.idv_in_person_proofing_state_id_submitted(
**analytics_arguments.merge(**form_result),
)
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.

We need to log this after setting doc_auth_vendor now.

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 may or may not be my fault. (Unfortunately, it was the least janky way of doing it.)


redirect_to redirect_url
else
render :show, locals: extra_view_variables
Expand Down
7 changes: 1 addition & 6 deletions app/services/idv/analytics_events_enhancer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,7 @@ def proofing_components
service_provider: sp,
)

proofing_components_hash = ProofingComponents.new(
idv_session:,
session:,
user:,
user_session:,
).to_h
proofing_components_hash = ProofingComponents.new(idv_session:).to_h

proofing_components_hash.empty? ? nil : proofing_components_hash
end
Expand Down
19 changes: 3 additions & 16 deletions app/services/idv/proofing_components.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@

module Idv
class ProofingComponents
def initialize(idv_session:, session:, user:, user_session:)
def initialize(idv_session:)
@idv_session = idv_session
@session = session
@user = user
@user_session = user_session
end

def document_check
if user.establishing_in_person_enrollment || user.pending_in_person_enrollment
Idp::Constants::Vendors::USPS
elsif idv_session.remote_document_capture_complete?
DocAuthRouter.doc_auth_vendor(
request: nil,
service_provider: idv_session.service_provider,
session:,
user_session:,
user:,
)
end
idv_session.doc_auth_vendor
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.

🎉

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.

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.

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.

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?

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.

You're totally right. I was thinking in terms of jobs not the controller context. This is fine

end

def document_type
Expand Down Expand Up @@ -73,6 +60,6 @@ def to_h

private

attr_reader :idv_session, :session, :user, :user_session
attr_reader :idv_session
end
end
2 changes: 1 addition & 1 deletion spec/controllers/idv/cancellations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
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.

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. 🫨


before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
Expand Down
34 changes: 0 additions & 34 deletions spec/controllers/idv/in_person/usps_locations_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,6 @@
)
expect(enrollment.service_provider).to eq(sp)
end

it 'updates proofing component vendor' do
proofing_components = Idv::ProofingComponents.new(
idv_session: controller.idv_session,
session: controller.session,
user_session: controller.user_session,
user:,
)

expect(proofing_components.document_check).to be_nil

response

user.reload

expect(proofing_components.document_check).to eq Idp::Constants::Vendors::USPS
end
end

context 'when the user is going through EIPP' do
Expand All @@ -411,23 +394,6 @@
)
expect(enrollment.service_provider).to eq(sp)
end

it 'updates proofing component vendor' do
proofing_components = Idv::ProofingComponents.new(
idv_session: controller.idv_session,
session: controller.session,
user_session: controller.user_session,
user:,
)

expect(proofing_components.document_check).to be_nil

response

user.reload

expect(proofing_components.document_check).to eq Idp::Constants::Vendors::USPS
end
end

context 'when unauthenticated' do
Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/idv/link_sent_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@

proofing_components = Idv::ProofingComponents.new(
idv_session: subject.idv_session,
session: subject.session,
user_session: subject.user_session,
user:,
)
expect(proofing_components.document_check).to eq('mock')
expect(proofing_components.document_type).to eq('state_id')
Expand Down
2 changes: 1 addition & 1 deletion spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand 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'
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.

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.

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.

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.

},
'IdV: in person proofing state_id submitted' => {
success: true, flow_path: 'standard', step: 'state_id', analytics_id: 'In Person Proofing', birth_year: '1938', document_zip_code: '12345', proofing_components: { document_check: 'usps' }
Expand Down
8 changes: 1 addition & 7 deletions spec/services/idv/agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@
end
end
let(:proofing_components) do
Idv::ProofingComponents.new(
idv_session:,
session:,
user:,
user_session:,
)
Idv::ProofingComponents.new(idv_session:)
end

subject(:agent) { Idv::Agent.new(applicant) }
Expand Down Expand Up @@ -147,7 +142,6 @@
expect(ResolutionProofingJob).to receive(:perform_later).with(
hash_including(
proofing_components: {
document_check: 'mock',
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.

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.

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.

@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.

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 test is just checking that the proofing components are being passed to the ResolutionProofingJob. So I would say removing this one line is fine

document_type: 'state_id',
},
),
Expand Down
1 change: 0 additions & 1 deletion spec/services/idv/analytics_events_enhancer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def track_event(_event, **kwargs)
expect(analytics.called_kwargs).to eql(
extra: true,
proofing_components: {
document_check: 'mock',
document_type: 'state_id',
},
)
Expand Down
48 changes: 5 additions & 43 deletions spec/services/idv/proofing_components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

subject do
described_class.new(
session:,
user:,
user_session:,
idv_session:,
)
end
Expand All @@ -40,12 +37,13 @@
idv_session.threatmetrix_review_status = 'pass'
idv_session.source_check_vendor = 'aamva'
idv_session.resolution_vendor = 'lexis_nexis'
idv_session.doc_auth_vendor = 'feedabee'
end

it 'returns expected result' do
expect(subject.to_h).to eql(
{
document_check: 'test_vendor',
document_check: 'feedabee',
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.

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.

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.

Good ol' deadbeef anagrams!

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.

(But much more happy!)

document_type: 'state_id',
source_check: 'aamva',
resolution_check: 'lexis_nexis',
Expand All @@ -58,46 +56,10 @@
end

describe '#document_check' do
it 'returns nil by default' do
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.

suggestion: these tests still seem valuable, no?

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.

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.

expect(subject.document_check).to be_nil
end

context 'in-person proofing' do
context 'establishing' do
let!(:enrollment) { create(:in_person_enrollment, :establishing, user:) }

it 'returns USPS' do
expect(subject.document_check).to eql(Idp::Constants::Vendors::USPS)
end
end

context 'pending' do
let!(:enrollment) { create(:in_person_enrollment, :pending, user:) }

it 'returns USPS' do
expect(subject.document_check).to eql(Idp::Constants::Vendors::USPS)
end
end
end

context 'doc auth' do
before do
allow(IdentityConfig.store).to receive(:doc_auth_vendor_default).and_return('test_vendor')
end

context 'before doc auth complete' do
it 'returns nil' do
expect(subject.document_check).to be_nil
end
end

context 'after doc auth completed successfully' do
let(:pii_from_doc) { Idp::Constants::MOCK_IDV_APPLICANT }
before { idv_session.doc_auth_vendor = 'feedabee' }

it 'returns doc auth vendor' do
expect(subject.document_check).to eql('test_vendor')
end
end
it 'returns doc_auth_vendor' do
expect(subject.document_check).to eql('feedabee')
end
end

Expand Down