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

Omit empty FormResponse errors from analytics logging #11799

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion app/services/form_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def success?

def to_h
hash = { success: success }
hash[:errors] = errors if !serialize_error_details_only?
hash[:errors] = errors.presence if !serialize_error_details_only?
hash[:error_details] = flatten_details(error_details) if error_details.present?
hash.merge!(extra)
hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
'Account Reset: delete',
user_id: user.uuid,
success: true,
errors: {},
mfa_method_counts: {
backup_codes: BackupCodeGenerator::NUMBER_OF_CODES,
webauthn: 2,
Expand Down Expand Up @@ -117,7 +116,6 @@
'Account Reset: delete',
user_id: user.uuid,
success: true,
errors: {},
mfa_method_counts: { phone: 1 },
profile_idv_level: 'legacy_unsupervised',
identity_verified: true,
Expand All @@ -140,7 +138,6 @@
'Account Reset: delete',
user_id: user.uuid,
success: true,
errors: {},
mfa_method_counts: { phone: 1 },
profile_idv_level: 'unsupervised_with_selfie',
identity_verified: true,
Expand All @@ -165,7 +162,6 @@
'Account Reset: delete',
user_id: user.uuid,
success: true,
errors: {},
mfa_method_counts: { phone: 1 },
profile_idv_level: 'in_person',
identity_verified: true,
Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/account_reset/request_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
totp: true,
piv_cac: false,
email_addresses: 1,
errors: {},
)
end

Expand All @@ -127,7 +126,6 @@
email_addresses: 1,
request_id: 'fake-message-request-id',
message_id: 'fake-message-id',
errors: {},
)
end

Expand All @@ -145,7 +143,6 @@
totp: false,
piv_cac: true,
email_addresses: 1,
errors: {},
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
expect(@analytics).to have_logged_event(
'Multi-Factor Authentication',
success: true,
errors: {},
multi_factor_auth_method: TwoFactorAuthenticatable::AuthMethod::REMEMBER_DEVICE,
enabled_mfa_methods_count: 0,
new_device: true,
Expand Down Expand Up @@ -219,7 +218,6 @@
expect(@analytics).to have_logged_event(
'Multi-Factor Authentication',
success: true,
errors: {},
multi_factor_auth_method: TwoFactorAuthenticatable::AuthMethod::SMS,
enabled_mfa_methods_count: 1,
new_device: true,
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/event_disavowal_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
end
end

def build_analytics_hash(success: true, errors: {}, user_id: nil)
def build_analytics_hash(success: true, errors: nil, user_id: nil)
hash_including(
{
event_created_at: event.created_at,
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/address_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
expect(@analytics).to have_logged_event(
'IdV: address submitted',
success: true,
errors: {},
address_edited: true,
)
end
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/agreement_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
let(:analytics_args) do
{
success: true,
errors: {},
step: 'agreement',
analytics_id: 'Doc Auth',
}
Expand Down
9 changes: 2 additions & 7 deletions spec/controllers/idv/by_mail/enter_code_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@
expect(@analytics).to have_logged_event(
'IdV: enter verify by mail code submitted',
success: true,
errors: {},
pending_in_person_enrollment: false,
fraud_check_failed: false,
enqueued_at: pending_profile.gpo_confirmation_codes.last.code_sent_at,
Expand Down Expand Up @@ -246,7 +245,6 @@
expect(@analytics).to have_logged_event(
'IdV: enter verify by mail code submitted',
success: true,
errors: {},
pending_in_person_enrollment: true,
fraud_check_failed: false,
enqueued_at: pending_profile.gpo_confirmation_codes.last.code_sent_at,
Expand Down Expand Up @@ -276,7 +274,6 @@
expect(@analytics).to have_logged_event(
'IdV: enter verify by mail code submitted',
success: true,
errors: {},
pending_in_person_enrollment: false,
fraud_check_failed: true,
enqueued_at: pending_profile.gpo_confirmation_codes.last.code_sent_at,
Expand Down Expand Up @@ -314,7 +311,6 @@
expect(@analytics).to have_logged_event(
'IdV: enter verify by mail code submitted',
success: true,
errors: {},
pending_in_person_enrollment: false,
fraud_check_failed: true,
enqueued_at: user.pending_profile.gpo_confirmation_codes.last.code_sent_at,
Expand Down Expand Up @@ -357,7 +353,6 @@
expect(@analytics).to have_logged_event(
'IdV: enter verify by mail code submitted',
success: true,
errors: {},
pending_in_person_enrollment: false,
fraud_check_failed: true,
enqueued_at: user.pending_profile.gpo_confirmation_codes.last.code_sent_at,
Expand Down Expand Up @@ -455,11 +450,11 @@

failed_gpo_submission_events =
@analytics.events['IdV: enter verify by mail code submitted']
.reject { |event_attributes| event_attributes[:errors].empty? }
.reject { |event_attributes| event_attributes[:errors].blank? }

successful_gpo_submission_events =
@analytics.events['IdV: enter verify by mail code submitted']
.select { |event_attributes| event_attributes[:errors].empty? }
.select { |event_attributes| event_attributes[:errors].blank? }

expect(failed_gpo_submission_events.count).to eq(max_attempts - 1)
expect(successful_gpo_submission_events.count).to eq(1)
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/document_capture_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@
let(:analytics_args) do
{
success: true,
errors: {},
analytics_id: 'Doc Auth',
flow_path: 'standard',
step: 'document_capture',
Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/idv/how_to_verify_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@
{
analytics_id: 'Doc Auth',
step: 'how_to_verify',
errors: {},
success: true,
selection:,
}
Expand All @@ -230,7 +229,6 @@
{
analytics_id: 'Doc Auth',
step: 'how_to_verify',
errors: {},
success: true,
selection:,
}
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/hybrid_handoff_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@
let(:analytics_args) do
{
success: true,
errors: {},
destination: :document_capture,
flow_path: 'standard',
step: 'hybrid_handoff',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
let(:analytics_args) do
{
success: true,
errors: {},
analytics_id: 'Doc Auth',
flow_path: 'hybrid',
step: 'document_capture',
Expand Down
9 changes: 0 additions & 9 deletions spec/controllers/idv/image_uploads_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down Expand Up @@ -392,7 +391,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload vendor pii validation',
success: true,
errors: {},
attention_with_barcode: false,
user_id: user.uuid,
submit_attempts: 1,
Expand Down Expand Up @@ -479,7 +477,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down Expand Up @@ -558,7 +555,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down Expand Up @@ -637,7 +633,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down Expand Up @@ -713,7 +708,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down Expand Up @@ -788,7 +782,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down Expand Up @@ -890,7 +883,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down Expand Up @@ -957,7 +949,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: true,
errors: {},
user_id: user.uuid,
submit_attempts: 1,
remaining_submit_attempts: IdentityConfig.store.doc_auth_max_attempts - 1,
Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/idv/in_person/address_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@
let(:analytics_args) do
{
success: true,
errors: {},
analytics_id: 'In Person Proofing',
flow_path: 'standard',
step: 'address',
Expand Down Expand Up @@ -217,7 +216,6 @@
let(:analytics_args) do
{
success: false,
errors: {},
analytics_id: 'In Person Proofing',
flow_path: 'standard',
step: 'address',
Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/idv/in_person/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
flow_path: 'standard',
step: 'ssn',
success: true,
errors: {},
}
end

Expand Down Expand Up @@ -176,7 +175,6 @@
step: 'ssn',
success: true,
previous_ssn_edit_distance: 6,
errors: {},
}
end

Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/in_person/state_id_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@
let(:analytics_args) do
{
success: true,
errors: {},
analytics_id: 'In Person Proofing',
flow_path: 'standard',
step: 'state_id',
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/otp_verification_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
'IdV: phone confirmation otp submitted',
hash_including(
success: true,
errors: {},
code_expired: false,
code_matches: true,
otp_delivery_preference: :sms,
Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/idv/phone_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@
'IdV: phone confirmation form',
hash_including(
success: true,
errors: {},
area_code: '703',
country_code: 'US',
carrier: 'Test Mobile Carrier',
Expand Down Expand Up @@ -441,7 +440,6 @@
success: true,
new_phone_added: true,
hybrid_handoff_phone_used: false,
errors: {},
phone_fingerprint: Pii::Fingerprinter.fingerprint(proofing_phone.e164),
country_code: proofing_phone.country,
area_code: proofing_phone.area_code,
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/idv/resend_otp_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
hash_including(
success: true,
phone_fingerprint: Pii::Fingerprinter.fingerprint(Phonelib.parse(phone).e164),
errors: {},
otp_delivery_preference: :sms,
country_code: 'US',
area_code: '225',
Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/idv/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@
flow_path: 'standard',
step: 'ssn',
success: true,
errors: {},
}
end

Expand All @@ -177,7 +176,6 @@
step: 'ssn',
success: true,
previous_ssn_edit_distance: 6,
errors: {},
}
end

Expand Down
Loading