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

[Document Upload Failure] Email veteran on Form 0781/Form 0781a upload retry exhaustion #18206

Merged

Conversation

NB28VT
Copy link
Contributor

@NB28VT NB28VT commented Aug 27, 2024

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

  • (If introducing a flipper, what is the success criteria being targeted?)

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

  • New code is covered by unit tests

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation) N/A
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected N/A
  • I added a screenshot of the developed feature N/A

NB28VT added 2 commits August 27, 2024 08:48
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
Copy link

1 Warning
⚠️ This PR changes 222 LoC (not counting whitespace/newlines).

In order to ensure each PR receives the proper attention it deserves, we recommend not exceeding
200. Expect some delays getting reviews.

File Summary

Files

  • app/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email.rb (+83/-0)

  • app/sidekiq/evss/disability_compensation_form/submit_form0781.rb (+3/-0)

  • config/features.yml (+4/-0)

  • config/settings.yml (+1/-0)

  • spec/sidekiq/evss/disability_compensation_form/form0781_document_upload_failure_email_spec.rb (+96/-0)

  • spec/sidekiq/evss/disability_compensation_form/submit_form0781_spec.rb (+35/-0)

    Note: We exclude files matching the following when considering PR size:

    *.csv, *.json, *.tsv, *.txt, *.md, Gemfile.lock, app/swagger, modules/mobile/docs, spec/fixtures/, spec/support/vcr_cassettes/, modules/mobile/spec/support/vcr_cassettes/, db/seeds, modules/vaos/app/docs, modules/meb_api/app/docs, modules/appeals_api/app/swagger/, *.bru, *.pdf
    

Big PRs are difficult to review, often become stale, and cause delays.

Generated by 🚫 Danger


module EVSS
module DisabilityCompensationForm
class Form0781DocumentUploadFailureEmail < Job

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)

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

@va-vfs-bot va-vfs-bot temporarily deployed to 80042-disability-benefits-nb-0781-notify-veteran-of-failure/main/main August 27, 2024 17:18 Inactive
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)
Copy link
Contributor

@SamStuckey SamStuckey Aug 27, 2024

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

Copy link
Contributor Author

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
Copy link

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

@va-vfs-bot va-vfs-bot temporarily deployed to 80042-disability-benefits-nb-0781-notify-veteran-of-failure/main/main September 3, 2024 19:24 Inactive
submission_id: form526_submission_id,
pre_exhaustion_failure: {
error_class:,
error_message:
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah i see.

Copy link
Contributor

@tommasina-va tommasina-va left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tests! 🚢

@NB28VT NB28VT marked this pull request as ready for review September 4, 2024 15:31
@NB28VT NB28VT requested review from a team as code owners September 4, 2024 15:31
Copy link
Contributor

@freeheeling freeheeling left a 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.

@NB28VT NB28VT requested a review from freeheeling September 5, 2024 16:12
Copy link
Contributor

@freeheeling freeheeling left a 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.

Copy link

github-actions bot commented Sep 9, 2024

Backend-review-group approval confirmed.

@NB28VT NB28VT merged commit 8a60715 into master Sep 9, 2024
23 checks passed
@NB28VT NB28VT deleted the 80042-disability-benefits-nb-0781-notify-veteran-of-failure branch September 9, 2024 14:13
gabezurita added a commit that referenced this pull request Sep 9, 2024
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants