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

[CST] - Create cron job to send emails for failed uploads (updated pr) #19956

Draft
wants to merge 13 commits into
base: feature/updated-es-error-handling
Choose a base branch
from

Conversation

pmclaren19
Copy link
Contributor

@pmclaren19 pmclaren19 commented Dec 18, 2024

Summary

  • Added va_notify_email_queued and va_notify_email_not_queued as scopes to the evidence submission model
  • Removed the failure_notification call from evss/document_upload.rb and made it so when sidekiq retries fail we add the upload to the evidence submission table with a status of FAILED
  • Updated and added tests around this in evss/document_upload_spec.rb
  • Created a benefits-documents folder in app/sidekiq/lighthouse
  • Removed the failure_notification call from lighthouse/document_upload.rb and made it so when sidekiq retries fail we add the upload to the evidence submission table with a status of FAILED and changed path to lighthouse/benefits_documents/document_upload.rb
  • Updated and added tests around this in lighthouse/document_upload_spec.rb
  • Created failure_notification_email_job.rb that runs as a job and updates records with a FAILED status to send an email and then updates them to have a va_notify_id and va_notify_date
  • Created tests in failure_notification_email_job_spec.rb
  • Deleted evss/failure_notification.rb since it is no longer used and is replaced with failure_notification_email_job.rb
  • Deleted evss/failure_notification_spec.rb since it is no longer used
  • Deleted lighthouse/failure_notification.rb since it is no longer used and is replaced with failure_notification_email_job.rb
  • Deleted lighthouse/failure_notification_spec.rb since it is no longer used
  • Created a new db migration for the evidence submission table and added the field va_notify_date which updated the schema
  • Added failure_notification_email job to periodic_jobs.rb
  • Added factory to benefits_documents for evidence submissions that is used in failure_notification_email_job_spec.rb
  • Added new files to CODEOWNERS file

Related issue(s)

Testing done

  • New code is covered by unit tests
  • Describe what the old behavior was prior to the change
  • Describe the steps required to verify your changes are working as expected. Exclusively stating 'Specs run' is NOT acceptable as appropriate testing
  • If this work is behind a flipper:
    • Tests need to be written for both the flipper on and flipper off scenarios. Docs.
    • What is the testing plan for rolling out the feature?

Screenshots

Note: Optional

What areas of the site does it impact?

(Describe what parts of the site are impacted andifcode touched other areas)

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)
  • 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
  • I added a screenshot of the developed feature

Requested Feedback

(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

@pmclaren19 pmclaren19 self-assigned this Dec 18, 2024
@pmclaren19 pmclaren19 requested review from a team as code owners December 18, 2024 21:15
@pmclaren19 pmclaren19 requested a review from jperk51 December 18, 2024 21:15
@pmclaren19 pmclaren19 marked this pull request as draft December 18, 2024 21:15
Copy link

Error: A file (or its parent directories) was deleted but its reference still exists in CODEOWNERS. Please update the .github/CODEOWNERS file and delete the entry for the Offending file: app/sidekiq/evss/failure_notification.rb

Copy link

github-actions bot commented Dec 18, 2024

2 Errors
🚫 This PR changes 1031 LoC (not counting whitespace/newlines).

In order to ensure each PR receives the proper attention it deserves, those exceeding
500 will not be reviewed, nor will they be allowed to merge. Please break this PR up into
smaller ones.

If you have reason to believe that this PR should be granted an exception, please see the
Submitting pull requests for approval - FAQ.

File Summary

Files

  • .github/CODEOWNERS (+34/-2)

  • app/models/evidence_submission.rb (+14/-0)

  • app/services/evss_claim_service.rb (+13/-0)

  • app/sidekiq/evss/document_upload.rb (+22/-15)

  • app/sidekiq/evss/failure_notification.rb (+0/-28)

  • app/sidekiq/lighthouse/benefits_documents/document_upload.rb (+116/-0)

  • app/sidekiq/lighthouse/benefits_documents/failure_notification_email_job.rb (+52/-0)

  • app/sidekiq/lighthouse/document_upload.rb (+0/-68)

  • app/sidekiq/lighthouse/failure_notification.rb (+0/-28)

  • db/migrate/20241217210622_create_evidence_submissions.rb (+20/-0)

  • db/schema.rb (+20/-2)

  • lib/lighthouse/benefits_documents/constants.rb (+9/-0)

  • lib/lighthouse/benefits_documents/service.rb (+17/-15)

  • lib/periodic_jobs.rb (+1/-0)

  • modules/mobile/spec/requests/mobile/v0/claim/documents_spec.rb (+3/-0)

  • modules/mobile/spec/requests/mobile/v0/claim/legacy_documents_spec.rb (+8/-5)

  • spec/factories/lighthouse/benefits_documents/evidence_submission.rb (+47/-0)

  • spec/lib/lighthouse/benefits_documents/service_spec.rb (+3/-0)

  • spec/requests/v0/evss_claims/documents_spec.rb (+6/-1)

  • spec/services/evss_claim_service_spec.rb (+11/-0)

  • spec/sidekiq/evss/document_upload_spec.rb (+57/-58)

  • spec/sidekiq/evss/failure_notification_spec.rb (+0/-43)

  • spec/sidekiq/lighthouse/benefits_documents/document_upload_spec.rb (+122/-0)

  • spec/sidekiq/lighthouse/benefits_documents/failure_notification_email_job_spec.rb (+90/-0)

  • spec/sidekiq/lighthouse/document_upload_spec.rb (+0/-58)

  • spec/sidekiq/lighthouse/failure_notification_spec.rb (+0/-43)

    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.

🚫

Modified files in db/migrate or db/schema.rb changes should be the only files checked into this PR.

File Summary

DB File(s)

  • db/migrate/20241217210622_create_evidence_submissions.rb

  • db/schema.rb

    App File(s)

    • .github/CODEOWNERS
  • app/models/evidence_submission.rb

  • app/services/evss_claim_service.rb

  • app/sidekiq/evss/document_upload.rb

  • app/sidekiq/evss/failure_notification.rb

  • app/sidekiq/lighthouse/benefits_documents/document_upload.rb

  • app/sidekiq/lighthouse/benefits_documents/failure_notification_email_job.rb

  • app/sidekiq/lighthouse/document_upload.rb

  • app/sidekiq/lighthouse/failure_notification.rb

  • lib/lighthouse/benefits_documents/constants.rb

  • lib/lighthouse/benefits_documents/service.rb

  • lib/periodic_jobs.rb

  • modules/mobile/spec/requests/mobile/v0/claim/documents_spec.rb

  • modules/mobile/spec/requests/mobile/v0/claim/legacy_documents_spec.rb

  • spec/factories/lighthouse/benefits_documents/evidence_submission.rb

  • spec/lib/lighthouse/benefits_documents/service_spec.rb

  • spec/requests/v0/evss_claims/documents_spec.rb

  • spec/services/evss_claim_service_spec.rb

  • spec/sidekiq/evss/document_upload_spec.rb

  • spec/sidekiq/evss/failure_notification_spec.rb

  • spec/sidekiq/lighthouse/benefits_documents/document_upload_spec.rb

  • spec/sidekiq/lighthouse/benefits_documents/failure_notification_email_job_spec.rb

  • spec/sidekiq/lighthouse/document_upload_spec.rb

  • spec/sidekiq/lighthouse/failure_notification_spec.rb

Application code must always be backwards compatible with the DB,
both before and after migrations have been run. For more info:

Generated by 🚫 Danger

@pmclaren19 pmclaren19 changed the base branch from master to feature/updated-es-error-handling December 18, 2024 21:21
@va-vfs-bot va-vfs-bot temporarily deployed to 93329-Create-Cron-Job-To-Send-Emails-For-Failed-Uploads-2/main/main December 18, 2024 21:30 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 93329-Create-Cron-Job-To-Send-Emails-For-Failed-Uploads-2/main/main December 20, 2024 15:32 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 93329-Create-Cron-Job-To-Send-Emails-For-Failed-Uploads-2/main/main December 20, 2024 23:08 Inactive
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.

2 participants