Skip to content

Commit

Permalink
Merge branch 'master' into were-gonna-fix-this
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunburdick committed Dec 17, 2024
2 parents 839da2b + ef3c028 commit 6ad382f
Show file tree
Hide file tree
Showing 206 changed files with 13,966 additions and 20,167 deletions.
24 changes: 15 additions & 9 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/build_atlas_codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
destination_repo: 'department-of-veterans-affairs/platform-atlas'
destination_folder: '/lib/codeowners/vets-api'
destination_branch: 'master'
user_email: '[email protected]'
user_email: '[email protected]'
user_name: 'va-vsp-bot'
commit_message: 'Auto update Atlas with Vets-API CODEOWNERS'
2 changes: 1 addition & 1 deletion .github/workflows/deploy-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ jobs:
add: "*"
cwd: vsp-infra-application-manifests/apps
author_name: va-vsp-bot
author_email: [email protected]
author_email: [email protected]
message: "Release ${{ needs.prepare-values.outputs.environments }} for ${{inputs.ecr_repository}} : ${{ inputs.commit_sha }}."
1 change: 1 addition & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ Lint/MissingSuper:
- 'modules/va_notify/lib/va_notify/service.rb'
- 'modules/vaos/app/services/vaos/session_service.rb'
- 'modules/veteran/app/models/veteran/user.rb'
- 'lib/vye/dgib/service.rb'

# Offense count: 5
Lint/NoReturnInBeginEndBlocks:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ gem 'aws-sdk-s3', '~> 1'
gem 'aws-sdk-sns', '~> 1'
gem 'betamocks', git: 'https://github.com/department-of-veterans-affairs/betamocks', branch: 'master'
gem 'bgs_ext', git: 'https://github.com/department-of-veterans-affairs/bgs-ext.git', require: 'bgs', ref: '350e45ae69'
gem 'blind_index'
gem 'blueprinter'
gem 'bootsnap', require: false
gem 'breakers'
Expand Down Expand Up @@ -206,6 +207,7 @@ group :development, :test do
gem 'byebug', platforms: :ruby # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'danger'
gem 'database_cleaner'
gem 'debug'
gem 'factory_bot_rails'
gem 'faker'
# CAUTION: faraday_curl may not provide all headers used in the actual faraday request. Be cautious if using this to
Expand Down
18 changes: 14 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ PATH
remote: modules
specs:
accredited_representative_portal (0.1.0)
blind_index
appeals_api (0.0.1)
jsonapi-serializer (>= 2.2.0)
sidekiq
Expand Down Expand Up @@ -240,11 +241,12 @@ GEM
base64
gyoku (>= 0.4.0)
nokogiri
argon2-kdf (0.2.0)
ast (2.4.2)
attr_extras (7.1.0)
awesome_print (1.9.2)
aws-eventstream (1.3.0)
aws-partitions (1.1019.0)
aws-partitions (1.1022.0)
aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
Expand All @@ -253,7 +255,7 @@ GEM
aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.173.0)
aws-sdk-s3 (1.176.1)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand All @@ -273,6 +275,9 @@ GEM
bigdecimal (3.1.8)
bigdecimal (3.1.8-java)
bindex (0.8.1)
blind_index (2.6.1)
activesupport (>= 7)
argon2-kdf (>= 0.2)
blueprinter (1.1.2)
bootsnap (1.18.4)
msgpack (~> 1.2)
Expand Down Expand Up @@ -308,7 +313,7 @@ GEM
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
colored2 (3.1.2)
combine_pdf (1.0.26)
combine_pdf (1.0.29)
matrix
ruby-rc4 (>= 0.1.5)
committee (5.4.0)
Expand Down Expand Up @@ -370,6 +375,9 @@ GEM
libddwaf (~> 1.14.0.0.0)
msgpack
debase-ruby_core_source (3.3.1)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
declarative (0.0.20)
deep_merge (1.2.2)
descendants_tracker (0.0.4)
Expand Down Expand Up @@ -964,7 +972,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.2.0)
rubocop-rspec (3.3.0)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
Expand Down Expand Up @@ -1150,6 +1158,7 @@ DEPENDENCIES
banners!
betamocks!
bgs_ext!
blind_index
blueprinter
bootsnap
brakeman
Expand All @@ -1175,6 +1184,7 @@ DEPENDENCIES
date_validator
ddtrace
debts_api!
debug
decision_reviews!
dhp_connected_devices!
dogstatsd-ruby (= 5.6.3)
Expand Down
11 changes: 1 addition & 10 deletions app/controllers/v0/burial_claims_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def show
def create
PensionBurial::TagSentry.tag_sentry

claim = create_claim
claim = claim_class.new(form: filtered_params[:form])
monitor.track_create_attempt(claim, current_user)

in_progress_form = current_user ? InProgressForm.form_for_user(claim.form_id, current_user) : nil
Expand Down Expand Up @@ -61,15 +61,6 @@ def claim_class
SavedClaim::Burial
end

def create_claim
if Flipper.enabled?(:va_burial_v2)
form = filtered_params[:form]
claim_class.new(form:, formV2: form.present? ? JSON.parse(form)['formV2'] : nil)
else
claim_class.new(form: filtered_params[:form])
end
end

def process_and_upload_to_lighthouse(in_progress_form, claim)
claim.process_attachments!

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v0/claim_documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create

def klass
case form_id
when '21P-527EZ', '21P-530', '21P-530V2'
when '21P-527EZ', '21P-530EZ'
PensionBurial::TagSentry.tag_sentry
PersistentAttachments::PensionBurial
when '21-686C', '686C-674'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def separation_locations
:all_users,
:get_separation_locations
) do
provider = Flipper.enabled?(:disability_compensation_staging_lighthouse_brd) ? :lighthouse_staging : nil
api_provider = ApiProviderFactory.call(
type: ApiProviderFactory::FACTORIES[:brd],
provider: nil,
provider:,
options: {},
current_user: @current_user,
feature_toggle: ApiProviderFactory::FEATURE_TOGGLE_BRD
Expand Down
5 changes: 2 additions & 3 deletions app/models/form_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FormProfile
22-5495 22-0993 22-0994 FEEDBACK-TOOL 22-10203 22-1990S 22-1990EZ],
evss: ['21-526EZ'],
hca: %w[1010ez 10-10EZR],
pension_burial: %w[21P-530 21P-527EZ 21P-530V2],
pension_burial: %w[21P-530EZ 21P-527EZ],
dependents: ['686C-674'],
decision_review: %w[20-0995 20-0996 10182],
mdot: ['MDOT'],
Expand Down Expand Up @@ -126,8 +126,7 @@ class FormProfile
'22-5490' => ::FormProfiles::VA5490,
'22-5490E' => ::FormProfiles::VA5490e,
'22-5495' => ::FormProfiles::VA5495,
'21P-530' => ::FormProfiles::VA21p530,
'21P-530V2' => ::FormProfiles::VA21p530v2,
'21P-530EZ' => ::FormProfiles::VA21p530ez,
'21-686C' => ::FormProfiles::VA21686c,
'686C-674' => ::FormProfiles::VA686c674,
'40-10007' => ::FormProfiles::VA4010007,
Expand Down
33 changes: 0 additions & 33 deletions app/models/form_profiles/va_21p530.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'iso_country_codes'

class FormProfiles::VA21p530v2 < FormProfile
class FormProfiles::VA21p530ez < FormProfile
def metadata
{
version: 0,
Expand Down
2 changes: 1 addition & 1 deletion app/models/in_progress_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def days_till_expires

def default_expires_after
case form_id
when '21-526EZ', '21P-527EZ', '21P-530V2'
when '21-526EZ', '21P-527EZ', '21P-530EZ'
1.year
else
60.days
Expand Down
2 changes: 1 addition & 1 deletion app/models/saved_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SavedClaim < ApplicationRecord
# create a uuid for this second (used in the confirmation number) and store
# the form type based on the constant found in the subclass.
after_initialize do
self.form_id = self.class::FORM.upcase unless instance_of?(::SavedClaim::Burial)
self.form_id = self.class::FORM.upcase
end

def self.add_form_and_validation(form_id)
Expand Down
13 changes: 1 addition & 12 deletions app/models/saved_claim/burial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@
require 'pension_burial/processing_office'

class SavedClaim::Burial < SavedClaim
FORM = '21P-530'

# attribute name is passed from the FE as a flag, maintaining camel case
attr_accessor :formV2 # rubocop:disable Naming/MethodName

after_initialize do
self.form_id = if Flipper.enabled?(:va_burial_v2)
formV2 || form_id == '21P-530V2' ? '21P-530V2' : self.class::FORM.upcase
else
self.class::FORM.upcase
end
end
FORM = '21P-530EZ'

def process_attachments!
refs = attachment_keys.map { |key| Array(open_struct_form.send(key)) }.flatten
Expand Down
7 changes: 7 additions & 0 deletions app/policies/vye_policy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

VyePolicy = Struct.new(:user, :user_info) do
def access?
user.present?
end
end
2 changes: 1 addition & 1 deletion app/sidekiq/benefits_intake_status_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def monitor_failure(form_id, saved_claim_id, bi_uuid)
}
call_location = caller_locations.first

if %w[21P-530V2 21P-530].include?(form_id)
if %w[21P-530EZ].include?(form_id)
claim = SavedClaim::Burial.find(saved_claim_id)
if claim
Burials::NotificationEmail.new(claim.id).deliver(:error)
Expand Down
13 changes: 3 additions & 10 deletions app/sidekiq/evss/document_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'ddtrace'
require 'timeout'
require 'logging/third_party_transaction'
require 'evss/failure_notification'

class EVSS::DocumentUpload
include Sidekiq::Job
Expand Down Expand Up @@ -52,13 +53,9 @@ class EVSS::DocumentUpload
date_submitted = format_issue_instant_for_mailers(msg['created_at'])
date_failed = format_issue_instant_for_mailers(msg['failed_at'])

notify_client.send_email(
recipient_identifier: { id_value: icn, id_type: 'ICN' },
template_id: MAILER_TEMPLATE_ID,
personalisation: { first_name:, filename:, date_submitted:, date_failed: }
)
EVSS::FailureNotification.perform_async(icn, first_name, filename, date_submitted, date_failed)

::Rails.logger.info('EVSS::DocumentUpload exhaustion handler email sent')
::Rails.logger.info('EVSS::DocumentUpload exhaustion handler email queued')
StatsD.increment('silent_failure_avoided_no_confirmation', tags: DD_ZSF_TAGS)
rescue => e
::Rails.logger.error('EVSS::DocumentUpload exhaustion handler email error',
Expand Down Expand Up @@ -101,10 +98,6 @@ def self.format_issue_instant_for_mailers(issue_instant)
timestamp.strftime('%B %-d, %Y %-l:%M %P %Z').sub(/([ap])m/, '\1.m.')
end

def self.notify_client
VaNotify::Service.new(NOTIFY_SETTINGS.api_key)
end

private

def validate_document!
Expand Down
38 changes: 38 additions & 0 deletions app/sidekiq/evss/failure_notification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

class EVSS::FailureNotification
include Sidekiq::Job
include SentryLogging

NOTIFY_SETTINGS = Settings.vanotify.services.benefits_management_tools
MAILER_TEMPLATE_ID = NOTIFY_SETTINGS.template_id.evidence_submission_failure_email

# retry for one day
sidekiq_options retry: 14, queue: 'low'
# Set minimum retry time to ~1 hour
sidekiq_retry_in do |count, _exception|
rand(3600..3660) if count < 9
end

sidekiq_retries_exhausted do
::Rails.logger.info('EVSS::FailureNotification email could not be sent')
end

def notify_client
VaNotify::Service.new(NOTIFY_SETTINGS.api_key)
end

def perform(icn, first_name, filename, date_submitted, date_failed)
notify_client.send_email(
recipient_identifier: { id_value: icn, id_type: 'ICN' },
template_id: MAILER_TEMPLATE_ID,
personalisation: { first_name:, filename:, date_submitted:, date_failed: }
)

::Rails.logger.info('EVSS::FailureNotification email sent')
rescue => e
::Rails.logger.error('EVSS::FailureNotification email error',
{ message: e.message })
log_exception_to_sentry(e)
end
end
15 changes: 10 additions & 5 deletions app/sidekiq/form1010cg/submission_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ class SubmissionJob
StatsD.increment("#{STATSD_KEY_PREFIX}failed_no_retries_left", tags: ["claim_id:#{msg['args'][0]}"])
StatsD.increment('silent_failure_avoided_no_confirmation', tags: DD_ZSF_TAGS)

if Flipper.enabled?(:caregiver_use_va_notify_on_submission_failure)
claim = SavedClaim::CaregiversAssistanceClaim.find(msg['args'][0])
send_failure_email(claim.parsed_form) if claim.parsed_form.dig('veteran', 'email')
end
claim = SavedClaim::CaregiversAssistanceClaim.find(msg['args'][0])
send_failure_email(claim)
end

def retry_limits_for_notification
Expand All @@ -51,14 +49,21 @@ def perform(claim_id)
end
rescue CARMA::Client::MuleSoftClient::RecordParseError
StatsD.increment("#{STATSD_KEY_PREFIX}record_parse_error", tags: ["claim_id:#{claim_id}"])
StatsD.increment('silent_failure_avoided_no_confirmation', tags: DD_ZSF_TAGS)

self.class.send_failure_email(claim)
rescue => e
log_exception_to_sentry(e)
StatsD.increment("#{STATSD_KEY_PREFIX}retries")

raise
end

def self.send_failure_email(parsed_form)
def self.send_failure_email(claim)
return unless Flipper.enabled?(:caregiver_use_va_notify_on_submission_failure)
return unless claim.parsed_form.dig('veteran', 'email')

parsed_form = claim.parsed_form
first_name = parsed_form.dig('veteran', 'fullName', 'first')
email = parsed_form.dig('veteran', 'email')
template_id = Settings.vanotify.services.health_apps_1010.template_id.form1010_cg_failure_email
Expand Down
Loading

0 comments on commit 6ad382f

Please sign in to comment.