Conversation
changelog: Improvements, In-Person Proofing, USPS API Transliteration
changelog: Bug Fixes, In-Person Proofing, Retain State ID and Address on form re-render after invalid submissions
… tbradley/lg-7832-transliterate-usps-api-frontend
…USPS submission changelog: Improvements, In-Person Proofing, Validate State ID and Address are transliterable to a valid USPS submission
… tbradley/lg-7832-transliterate-usps-api-frontend
…to tbradley/lg-7832-transliterate-usps-api-frontend
… tbradley/lg-7832-transliterate-usps-api-frontend
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
…to tbradley/lg-7832-transliterate-usps-api-frontend
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
…ttps://github.com/18F/identity-idp into tbradley/lg-7832-transliterate-usps-api-integration
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
…ley/lg-7832-transliterate-usps-api-integration
…ley/lg-7832-transliterate-usps-api-integration
…ley/lg-7832-transliterate-usps-api-fix-forms
…ttps://github.com/18F/identity-idp into tbradley/lg-7832-transliterate-usps-api-fix-forms
…to tbradley/lg-7832-transliterate-usps-api-frontend
… tbradley/lg-7832-transliterate-usps-api-frontend
…ley/lg-7832-transliterate-usps-api-frontend
…ley/lg-7832-transliterate-usps-api-frontend
app/services/usps_in_person_proofing/transliterable_validator.rb
Outdated
Show resolved
Hide resolved
| if (@fields & SUPPORTED_FIELDS).size < @fields.size | ||
| # Catch incorrect usage of the validator | ||
| raise StandardError.new( | ||
| "Unsupported transliteration fields: #{(@fields - SUPPORTED_FIELDS).to_json}", | ||
| ) | ||
| end |
There was a problem hiding this comment.
do we need this check ahead of time? If we added .fetch when we look up validations per field, we'd get errors early on that would make it clear which keys are unknown
There was a problem hiding this comment.
This is to help catch unsupported usage, so it's better that this error occur as early as possible in the development cycle. If you can point me to a mechanism for disabling this check specifically for prod, then I'd be open to adding that.
app/services/form_response.rb
Outdated
| pii_keys.each do |key| | ||
| hash[:pii_like_keypaths] ||= [] | ||
| hash[:pii_like_keypaths].append([:error_details, key]) if error_details.has_key?(key) | ||
| hash[:errors] = hash[:errors].except(key) if hash[:errors].has_key?(key) | ||
| end |
There was a problem hiding this comment.
The goal for pii_like_keypaths was that it's passed in at the analytics.track_event callsite, is the reason we're doing this here because for these 2 forms, the analytics happens "automatically" inside of the FSM?
There was a problem hiding this comment.
Yes, the FSM decouples the form from the analytics so we don't directly control how the errors are logged.
There was a problem hiding this comment.
Ah I just found how we work around this in other places, we add it to the extra part of the FormResponse:
Can we try that approach instead?
There was a problem hiding this comment.
This is a case where we should avoid logging the error message, which could in some cases expose a person's name. The same approach doesn't seem acceptable here.
There was a problem hiding this comment.
If the goal is to not log them, can we remove them in the form before instantiating the FormResponse? FormResponse is to capture and transport data specifically to our logs
There was a problem hiding this comment.
Like in this spot:
we could still submit the form, but then post-process that FormResponse to omit errors we don't want to log
There was a problem hiding this comment.
e.g. create a version of the Errors object with the transliteration errors filtered out when creating FormResponse in these classes?
There was a problem hiding this comment.
Ok, that seems doable. Thanks!
There was a problem hiding this comment.
Updated to remove the errors potentially containing PII from the returned FormResponse. It looks like the errors are still displaying as expected, and they are not being logged.
app/services/usps_in_person_proofing/transliterable_validator_helper.rb
Outdated
Show resolved
Hide resolved
app/services/usps_in_person_proofing/transliterable_validator_helper.rb
Outdated
Show resolved
Hide resolved
app/services/usps_in_person_proofing/transliterable_validator_helper.rb
Outdated
Show resolved
Hide resolved
| message: (proc do |invalid_chars| | ||
| I18n.t( | ||
| 'in_person_proofing.form.state_id.errors.unsupported_chars', | ||
| char_list: invalid_chars.join(', '), | ||
| ) | ||
| end) |
There was a problem hiding this comment.
I think if we switch this to "stabby lambda" syntax we may not need the extra wrapping parens anymore, so I just went and pushed that in 5b20738
- Real ActiveModel::Errors instance - Model fields all defined in one spot - spy on real validator.transliterator instead of stubbing
zachmargolis
left a comment
There was a problem hiding this comment.
LGTM
a few notes:
- I went ahead and pushed some syntactic/stubbing cleanups myself.
- I wish we had unit tests for the
FormAddressValidator/FormStateIdValidator(or at least the forms they're included in) so we don't have to go all the way to feature specs, but that's a bigger change than this PR
| unsupported_chars: 'Our system cannot read the following characters: | ||
| %{char_list}. Please try again using substitutes for those | ||
| characters.' |
There was a problem hiding this comment.
I feel like the copy is a little misleading, clearly the system can read the characters if we can render them back... but I'm guessing this copy already went through UX, and this is not the hill I die on
|
This looks good to me! |
…USPS submission (#7938) * LG-7832: Validate State ID and Address are transliterable to a valid USPS submission changelog: Improvements, In-Person Proofing, Validate State ID and Address are transliterable to a valid USPS submission Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com> * LG-7832: Make test updates based on PR feedback * Update spec/services/usps_in_person_proofing/enrollment_helper_spec.rb Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com> * Update app/services/usps_in_person_proofing/enrollment_helper.rb Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com> * LG-7832: Remove incorrect usage of .class * LG-7832: Feature should only be enabled by default in dev environments * Update app/services/idv/steps/in_person/address_step.rb Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com> * Update app/services/idv/steps/in_person/state_id_step.rb Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com> * LG-7832: Use case no longer requires support for HashWithIndifferentAccess * LG-7832: Clean up translation usage * LG-7832: Update test * LG-7832: Update test * LG-7832: Simplify unsupported character extraction from transliterated string * LG-7832: Clarify transliteration result documentation * LG-7832: Refactor helper logic into validator classes * Switch to ->() lambda syntax to remove extra parens * Change one more proc syntax to "stabby lambda" * un-stub the TransliterableValidator spec as much as possible - Real ActiveModel::Errors instance - Model fields all defined in one spot - spy on real validator.transliterator instead of stubbing --------- Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com> Co-authored-by: Zach Margolis <zachary.margolis@gsa.gov>
🎫 Ticket
🛠 Summary of changes
usps_ipp_transliteration_enabled:pii: truetypewill still be logged)pii_like_fieldswill be updated to contain the field name📜 Testing Plan
Provide a checklist of steps to confirm the changes.
👀 Screenshots
Desktop (State ID):
Desktop (Address):
Desktop (Verify):
Mobile (State ID):
Mobile (Address):
Mobile (Verify):