Skip to content

Commit

Permalink
Merge branch 'master' into sjc-clamav-container
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjcumming authored Apr 17, 2024
2 parents 9fb4d62 + 4d200de commit aa2d155
Show file tree
Hide file tree
Showing 381 changed files with 9,299 additions and 12,948 deletions.
41 changes: 31 additions & 10 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .github/scripts/check_codeowners.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ HEAD_SHA=$(git rev-parse HEAD)
BASE_SHA=$(git rev-parse origin/master)

# Get the list of changed files between the base and head commits
IFS=$'\n' # Change IFS to split only on newlines
CHANGED_FILES=$(git diff --name-only --diff-filter=AMR ${BASE_SHA}...${HEAD_SHA})
echo "Changed files: $CHANGED_FILES"

Expand All @@ -37,7 +38,7 @@ check_in_codeowners() {
return 1
}

for FILE in "${CHANGED_FILES}"; do
for FILE in ${CHANGED_FILES}; do
# Ignore files starting with a dot
if [[ $FILE == .* ]]; then
echo "Ignoring file $FILE"
Expand All @@ -53,3 +54,4 @@ for FILE in "${CHANGED_FILES}"; do
done

echo "All changed files or their parent directories have a CODEOWNERS entry."
IFS=$' \t\n' # Reset IFS after the loop
2 changes: 2 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'ostruct'

module VSPDanger
HEAD_SHA = `git rev-parse --abbrev-ref HEAD`.chomp.freeze
BASE_SHA = 'origin/master'
Expand Down
30 changes: 15 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,17 @@ GEM
attr_extras (7.1.0)
awesome_print (1.9.2)
aws-eventstream (1.3.0)
aws-partitions (1.903.0)
aws-sdk-core (3.191.5)
aws-partitions (1.914.0)
aws-sdk-core (3.192.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.78.0)
aws-sdk-kms (1.79.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.146.1)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-s3 (1.147.0)
aws-sdk-core (~> 3, >= 3.192.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sdk-sns (1.72.0)
Expand Down Expand Up @@ -431,7 +431,7 @@ GEM
multipart-post (~> 2)
faraday-net_http (3.1.0)
net-http
faraday-retry (2.2.0)
faraday-retry (2.2.1)
faraday (~> 2.0)
faraday-typhoeus (1.1.0)
faraday (~> 2.0)
Expand Down Expand Up @@ -474,7 +474,7 @@ GEM
rack (>= 1.4, < 4)
rack-protection (>= 1.5.3, <= 4.0.0)
sanitize (< 7)
foreman (0.87.2)
foreman (0.88.1)
formatador (1.1.0)
fugit (1.9.0)
et-orbi (~> 1, >= 1.2.7)
Expand Down Expand Up @@ -571,8 +571,8 @@ GEM
iso_country_codes (0.7.8)
jar-dependencies (0.4.1)
jmespath (1.6.2)
json (2.7.1)
json (2.7.1-java)
json (2.7.2)
json (2.7.2-java)
json-schema (4.3.0)
addressable (>= 2.8)
json_schemer (2.2.1)
Expand Down Expand Up @@ -816,9 +816,9 @@ GEM
rchardet (1.8.0)
rdoc (6.6.3.1)
psych (>= 4.0.0)
redis (5.1.0)
redis-client (>= 0.17.0)
redis-client (0.20.0)
redis (5.2.0)
redis-client (>= 0.22.0)
redis-client (0.22.1)
connection_pool
redis-namespace (1.11.0)
redis (>= 4)
Expand Down Expand Up @@ -877,7 +877,7 @@ GEM
rspec-support (~> 3.13)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-sidekiq (4.1.0)
rspec-sidekiq (4.2.0)
rspec-core (~> 3.0)
rspec-expectations (~> 3.0)
rspec-mocks (~> 3.0)
Expand All @@ -893,7 +893,7 @@ GEM
rswag-ui (2.13.0)
actionpack (>= 3.1, < 7.2)
railties (>= 3.1, < 7.2)
rubocop (1.63.1)
rubocop (1.63.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -955,7 +955,7 @@ GEM
rake (>= 10.0)
semantic_logger (4.15.0)
concurrent-ruby (~> 1.0)
sentry-ruby (5.17.2)
sentry-ruby (5.17.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
shellany (0.0.1)
Expand Down
15 changes: 15 additions & 0 deletions app/controllers/v0/average_days_for_claim_completion_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module V0
class AverageDaysForClaimCompletionController < ApplicationController
service_tag 'average-days-to-completion'
skip_before_action :authenticate, only: :index

def index
rtn = AverageDaysForClaimCompletion.order('created_at DESC').first
render json: {
average_days: rtn.present? ? rtn.average_days : -1.0
}
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def create
raise Common::Exceptions::ValidationErrors, claim
end

CentralMail::SubmitCareerCounselingJob.perform_async(claim.id, @current_user&.uuid)
Lighthouse::SubmitCareerCounselingJob.perform_async(claim.id, @current_user&.uuid)

Rails.logger.info "ClaimID=#{claim.confirmation_number} Form=#{claim.class::FORM}"
clear_saved_form(claim.form_id)
Expand Down
36 changes: 24 additions & 12 deletions app/controllers/v0/health_care_applications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'hca/service'
require 'bgs/service'
require 'pdf_fill/filler'
require 'lighthouse/facilities/v1/client'

module V0
class HealthCareApplicationsController < ApplicationController
Expand All @@ -11,7 +12,7 @@ class HealthCareApplicationsController < ApplicationController
service_tag 'healthcare-application'
FORM_ID = '1010ez'

skip_before_action(:authenticate, only: %i[create show enrollment_status healthcheck download_pdf])
skip_before_action(:authenticate, only: %i[create show enrollment_status healthcheck facilities])

before_action :record_submission_attempt, only: :create
before_action :load_user, only: %i[create enrollment_status]
Expand Down Expand Up @@ -68,12 +69,8 @@ def healthcheck
render(json: HCA::Service.new.health_check)
end

def download_pdf
source_file_path = PdfFill::Filler.fill_form(health_care_application, SecureRandom.uuid, sign: false)
file_contents = File.read(source_file_path)
File.delete(source_file_path)

send_data file_contents, filename: file_name_for_pdf, type: 'application/pdf', disposition: 'attachment'
def facilities
render(json: lighthouse_facilities_service.get_facilities(lighthouse_facilities_params))
end

private
Expand All @@ -82,11 +79,26 @@ def health_care_application
@health_care_application ||= HealthCareApplication.new(params.permit(:form))
end

def file_name_for_pdf
veteran_name = health_care_application.parsed_form.try(:[], 'veteranFullName')
first_name = veteran_name.try(:[], 'first') || 'First'
last_name = veteran_name.try(:[], 'last') || 'Last'
"10-10EZ_#{first_name}_#{last_name}.pdf"
def lighthouse_facilities_service
@lighthouse_facilities_service ||= Lighthouse::Facilities::V1::Client.new
end

def lighthouse_facilities_params
params.permit(
:zip,
:state,
:lat,
:long,
:radius,
:bbox,
:visn,
:type,
:services,
:mobile,
:page,
:per_page,
facilityIds: []
)
end

def record_submission_attempt
Expand Down
13 changes: 12 additions & 1 deletion app/controllers/v0/profile/direct_deposits_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class DirectDepositsController < ApplicationController
error = { status: exception.status_code, body: exception.errors.first }
response = Lighthouse::DirectDeposit::ErrorParser.parse(error)

# temporary - will be removed after direct deposit merge is complete
update_error_code_prefix(response) if single_form_enabled?

render status: response.status, json: response.body
end

Expand All @@ -41,6 +44,14 @@ def update

private

def single_form_enabled?
Flipper.enabled?(:profile_show_direct_deposit_single_form, @current_user)
end

def update_error_code_prefix(response)
response.code = response.code.sub('cnp.payment', 'direct.deposit')
end

def client
@client ||= DirectDeposit::Client.new(@current_user.icn)
end
Expand Down Expand Up @@ -77,7 +88,7 @@ def control_info_params
end

def send_confirmation_email
VANotifyDdEmailJob.send_to_emails(current_user.all_emails, 'comp_and_pen')
VANotifyDdEmailJob.send_to_emails(current_user.all_emails)
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/models/average_days_for_claim_completion.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class AverageDaysForClaimCompletion < ApplicationRecord
end
2 changes: 1 addition & 1 deletion app/models/personal_information_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class PersonalInformationLog < ApplicationRecord
scope :last_week, -> { where('created_at >= :date', date: 1.week.ago) }

has_kms_key
has_encrypted :data, migrating: true, type: :json, key: :kms_key, **lockbox_options
has_encrypted :data, type: :json, key: :kms_key, **lockbox_options

validates :error_class, presence: true
end
8 changes: 6 additions & 2 deletions app/models/saved_claim/education_career_counseling_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def regional_office
[]
end

def send_to_central_mail!
def send_to_benefits_intake!
form_copy = parsed_form

if form_copy['veteranSocialSecurityNumber'].blank?
Expand All @@ -27,7 +27,11 @@ def process_attachments!
files = PersistentAttachment.where(guid: refs.map(&:confirmationCode))
files.find_each { |f| f.update(saved_claim_id: id) }

CentralMail::SubmitSavedClaimJob.new.perform(id)
if Flipper.enabled?(:ecc_benefits_intake_submission)
Lighthouse::SubmitBenefitsIntakeClaim.new.perform(id)
else
CentralMail::SubmitSavedClaimJob.new.perform(id)
end
end

def business_line
Expand Down
13 changes: 6 additions & 7 deletions app/services/claim_fast_tracking/max_rating_annotator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ def self.annotate_disabilities(rated_disabilities_response)
return rated_disabilities_response if diagnostic_codes.empty?

ratings = get_ratings(diagnostic_codes)
if ratings.present?
ratings.each do |rating|
rated_disability = rated_disabilities_response.rated_disabilities.find do |disability|
disability.diagnostic_code == rating['diagnostic_code']
end
rated_disability.maximum_rating_percentage = rating['max_rating'] if rated_disability.present?
end
return rated_disabilities_response unless ratings

ratings_hash = ratings.to_h { |rating| [rating['diagnostic_code'], rating['max_rating']] }
rated_disabilities_response.rated_disabilities.each do |rated_disability|
max_rating = ratings_hash[rated_disability.diagnostic_code]
rated_disability.maximum_rating_percentage = max_rating if max_rating
end
rated_disabilities_response
end
Expand Down
7 changes: 6 additions & 1 deletion app/sidekiq/education_form/templates/10203.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CH33
*START*
<%= form_identifier %>
JUN 2020
OMB Control #: 2900-0878


APPLICATION FOR EDITH NOURSE ROGERS STEM SCHOLARSHIP
Expand Down Expand Up @@ -69,8 +69,13 @@ Applicant has POA: <%= yesno(@stem_automated_decision.poa) %>
Applicant School Email Address: <%= @applicant.schoolEmailAddress %>
Applicant School ID: <%= @applicant.schoolStudentId %>

<% if @applicant.isActiveDuty -%>
As an active-duty service member, you have consulted with an Education Service
Officer (ESO) regarding your education program.
<% else -%>
Certification and Signature of Applicant
Signature of Applicant Date
<% end -%>


<%= parse_with_template_path('footer') %>
1 change: 1 addition & 0 deletions app/sidekiq/kms_key_rotation/batch_initiator_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def gids_for_model(model, max_records_per_batch)

model
.where.not('encrypted_kms_key LIKE ?', "v#{KmsEncryptedModelPatch.kms_version}:%")
.or(model.where(encrypted_kms_key: nil))
.limit(max_records_per_batch)
.pluck(model.primary_key)
.map { |id| URI::GID.build(app: GlobalID.app, model_name: model.name, model_id: id).to_s }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
# frozen_string_literal: true

module CentralMail
module Lighthouse
class SubmitCareerCounselingJob
include Sidekiq::Job
include SentryLogging
RETRY = 14

STATSD_KEY_PREFIX = 'worker.central_mail.submit_career_counseling_job'
STATSD_KEY_PREFIX = 'worker.lighthouse.submit_career_counseling_job'

sidekiq_options retry: RETRY

sidekiq_retries_exhausted do |msg, _ex|
Rails.logger.error(
"Failed all retries on CentralMail::SubmitCareerCounselingJob, last error: #{msg['error_message']}"
"Failed all retries on SubmitCareerCounselingJob, last error: #{msg['error_message']}"
)
StatsD.increment("#{STATSD_KEY_PREFIX}.exhausted")
end

def perform(claim_id, user_uuid = nil)
begin
@claim = SavedClaim.find(claim_id)
@claim.send_to_central_mail!
@claim.send_to_benefits_intake!
send_confirmation_email(user_uuid)
rescue => e
log_message_to_sentry('CentralMail::SubmitCareerCounselingJob failed, retrying...', :warn,
generate_sentry_details(e))
Rails.logger.warn('SubmitCareerCounselingJob failed, retrying...', { error_message: e.message })
raise
end
log_message_to_sentry('Successfully submitted form 25-8832', :info, { uuid: user_uuid })
Rails.logger.info('Successfully submitted form 25-8832', { uuid: user_uuid })
end

def send_confirmation_email(user_uuid)
Expand All @@ -38,8 +36,7 @@ def send_confirmation_email(user_uuid)
end

if email.blank?
log_message_to_sentry('No email to send confirmation regarding submitted form 25-8832', :info,
{ uuid: user_uuid })
Rails.logger.info("No email to send confirmation regarding submitted form 25-8832 for uuid: #{user_uuid}")
return
end

Expand Down
3 changes: 1 addition & 2 deletions app/sidekiq/terms_of_use/sign_up_service_updater_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module TermsOfUse
class SignUpServiceUpdaterJob
include Sidekiq::Job

sidekiq_options unique_for: 2.days
sidekiq_options retry: 15 # 2.1 days using exponential backoff
sidekiq_options retry: 5 # ~17 mins

sidekiq_retries_exhausted do |job, exception|
Rails.logger.warn(
Expand Down
Loading

0 comments on commit aa2d155

Please sign in to comment.