-
Notifications
You must be signed in to change notification settings - Fork 66
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
[Document Upload Failure] Email veteran on Form 0781/Form 0781a upload retry exhaustion #18206
[Document Upload Failure] Email veteran on Form 0781/Form 0781a upload retry exhaustion #18206
Conversation
We want to send a notification mailer to a veteran if we have a problem uploading their Form 0781 or Form 0781a; the mailer will provide them instructions on how to download and fill out the form physically and mail it in.
Kicks off a notificaiton mailer job when SubmitForm0781 fails enough it exhausts its retries
Generated by 🚫 Danger |
|
||
module EVSS | ||
module DisabilityCompensationForm | ||
class Form0781DocumentUploadFailureEmail < Job |
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.
Assumes too much for instance variable '@notify_client' - InstanceVariableAssumption
raise e | ||
end | ||
|
||
def perform(form526_submission_id) |
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.
Has approx 10 statements - TooManyStatements
form526_submission = Form526Submission.find(form526_submission_id) | ||
|
||
with_tracking('Form0781DocumentUploadFailureEmail', form526_submission.saved_claim_id, form526_submission_id) do | ||
@notify_client ||= VaNotify::Service.new(Settings.vanotify.services.benefits_disability.api_key) |
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.
memoizing doesn't do anything here. the ||=
is for when you have a method that memoizes for you. I would just make it a normal variable and remove the ||
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 good catch, yeah my bad copy pasted this from older mailers I should have taken a closer look. Fixed in 0cf0817
def perform(form526_submission_id) | ||
form526_submission = Form526Submission.find(form526_submission_id) | ||
|
||
with_tracking('Form0781DocumentUploadFailureEmail', form526_submission.saved_claim_id, form526_submission_id) 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.
Refers to 'form526_submission' more than self (maybe move it to another class?) - FeatureEnvy
submission_id: form526_submission_id, | ||
pre_exhaustion_failure: { | ||
error_class:, | ||
error_message: |
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.
are error_class
and error_message
defined?
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.
Yes, on lines 15 and 16: the rescue is within the block so should have access to those local variables, unless did you catch me missing a Ruby quirk here you're hinting 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.
ah i see.
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.
Nice tests! 🚢
spec/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email_spec.rb
Show resolved
Hide resolved
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.
Questions concerning Flipper enablement in specs.
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.
LGTM. May need to re-run failed checks.
…eteran-of-failure
Backend-review-group approval confirmed. |
* master: case9 logic fixed (#18362) API-39748-add-index-to-error-collection-messages (#18333) Use random value in Simple Forms PDF stamping file paths (#18361) Add `find_dependents_by_ptcpnt_id` to local bgs (#18303) remove request_ping defs (#18353) API-38827-update-validations-intl-postal-code (#18323) [Document Upload Failure] Email veteran on Form 0781/Form 0781a upload retry exhaustion (#18206) add feature flags for meb and 5490 (#18328) Handle 500 responses from VA Profile v3 Service for v0/profile/contacts endpoint (#18192) Resolve MethodLength Rubocop Disables - Part 3 (#18331) Resolve MethodLength Rubocop Disables - Part BGS::Form674 (#18326)
Summary
Enqueues a new veteran mailer whenever a SubmitForm0781 job fails and exhausts its retries. The mailer will instruct the veteran on how to print and fill forms out manually as a workaround. Also includes logging for monitoring the release and detecting any issues with the mailer going out.
This is pretty much the exact same implementation as was done for Form 4142 failures #16998
SubmitForm0781 runs after a Form 526 has been submitted, and attempts to upload a Form 0781 and/or a Form 0781a if the veteran filled out information on a PTSD condition or PTSD for assault. One or the other upload could fail, but the physical form will cover both cases.
NOTE it is very unlikely this email will ever go out, as we don't have a record of these forms failing to upload.
*This work is behind a feature toggle (flipper): YES,
form526_send_0781_failure_notification
(Which team do you work for, does your team own the maintenance of this component?)
Disability Benefits Experience
This will only act as a killswitch if there is a problem with the mailer.
Related issue(s)
department-of-veterans-affairs/va.gov-team#80042
Testing done
Acceptance criteria