Skip to content

Commit

Permalink
Merge branch 'master' into API-40862-dynamic-email-report-preview
Browse files Browse the repository at this point in the history
merges master
  • Loading branch information
stiehlrod committed Oct 8, 2024
2 parents 70f38c3 + 8944f7a commit 11f3635
Show file tree
Hide file tree
Showing 127 changed files with 4,166 additions and 625 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ app/uploaders/uploader_virus_scan.rb @department-of-veterans-affairs/va-api-engi
app/uploaders/validate_pdf.rb @department-of-veterans-affairs/Disability-Experience @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/uploaders/vets_shrine.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/validators/token_util.rb @department-of-veterans-affairs/backend-review-group
app/uploaders/simple_forms_api/ @department-of-veterans-affairs/platform-va-product-forms @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/uploaders/veteran_facing_forms_remediation_uploader.rb @department-of-veterans-affairs/platform-va-product-forms @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/sidekiq/account_login_statistics_job.rb @department-of-veterans-affairs/octo-identity
app/sidekiq/benefits_intake_remediation_status_job.rb @department-of-veterans-affairs/platform-va-product-forms @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -645,6 +646,7 @@ app/sidekiq/lighthouse/create_intent_to_file_job.rb @department-of-veterans-affa
app/sidekiq/lighthouse/income_and_assets_intake_job.rb @department-of-veterans-affairs/pensions @department-of-veterans-affairs/backend-review-group
app/sidekiq/load_average_days_for_claim_completion_job.rb @department-of-veterans-affairs/benefits-microservices @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/sidekiq/mhv @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/sidekiq/mhv/account_creator_job.rb @department-of-veterans-affairs/octo-identity
app/sidekiq/pager_duty @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/sidekiq/preneeds @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/sidekiq/schema_contract @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -978,6 +980,7 @@ lib/sidekiq/semantic_logging.rb @department-of-veterans-affairs/backend-review-g
lib/sidekiq/set_request_attributes.rb @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/va-api-engineers
lib/sidekiq/set_request_id.rb @department-of-veterans-affairs/backend-review-group @department-of-veterans-affairs/va-api-engineers
lib/sign_in @department-of-veterans-affairs/octo-identity
lib/simple_forms_api/ @department-of-veterans-affairs/platform-va-product-forms @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
lib/simple_forms_api_submission @department-of-veterans-affairs/platform-va-product-forms @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
lib/slack @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
lib/sm @department-of-veterans-affairs/vfs-mhv-secure-messaging @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -1341,6 +1344,7 @@ spec/sidekiq/kms_key_rotation @department-of-veterans-affairs/va-api-engineers @
spec/sidekiq/lighthouse @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/sidekiq/load_average_days_for_claim_completion_job_spec.rb @department-of-veterans-affairs/benefits-microservices @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/sidekiq/mhv @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/sidekiq/mhv/account_creator_job_spec.rb @department-of-veterans-affairs/octo-identity
spec/sidekiq/pager_duty @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/sidekiq/preneeds @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/sidekiq/schema_contract @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ GIT

GIT
remote: https://github.com/department-of-veterans-affairs/vets-json-schema
revision: 998cfd9d48db75a5533e33785d6523933f7e9b36
revision: be610f6623ef1fac432e5616372d4a5eadb93773
branch: master
specs:
vets_json_schema (24.2.9)
vets_json_schema (24.4.0)
multi_json (~> 1.0)
script_utils (= 0.0.4)

Expand Down Expand Up @@ -718,7 +718,7 @@ GEM
ostruct (0.6.0)
ox (2.14.18)
parallel (1.26.3)
parallel_tests (4.7.1)
parallel_tests (4.7.2)
parallel
parser (3.3.5.0)
ast (~> 2.4.1)
Expand Down Expand Up @@ -978,7 +978,7 @@ GEM
rake (>= 10.0)
semantic_logger (4.16.0)
concurrent-ruby (~> 1.0)
sentry-ruby (5.19.0)
sentry-ruby (5.21.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
shellany (0.0.1)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v0/profile/service_histories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_military_info
handle_errors!(response.episodes)
report_results(response.episodes)

service_history_json = JSON.parse(response.episodes.to_json, symbolize_names: true)
service_history_json = JSON.parse(response.to_json, symbolize_names: true)
options = { is_collection: false }

render json: ServiceHistorySerializer.new(service_history_json, options), status: response.status
Expand Down
2 changes: 1 addition & 1 deletion app/models/form_profiles/va_21p530v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ def prefill

def convert_to_iso2(country_code)
code = IsoCountryCodes.find(country_code)
code.alpha2
code.alpha3
end
end
4 changes: 3 additions & 1 deletion app/models/form_profiles/va_526ez.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class Form526Prefill
include Virtus.model

attribute :started_form_version, String
attribute :sync_modern_0781_flow, Boolean
end
end

Expand Down Expand Up @@ -168,7 +169,8 @@ def initialize_form526_prefill
VA526ez::Form526Prefill.new(
# any form that has a startedFormVersion (whether it is '2019' or '2022') will go through the Toxic Exposure flow
# '2022' means the Toxic Exposure 1.0 flag.
started_form_version: Flipper.enabled?(:disability_526_toxic_exposure, user) ? '2022' : nil
started_form_version: Flipper.enabled?(:disability_526_toxic_exposure, user) ? '2022' : nil,
sync_modern_0781_flow: Flipper.enabled?(:disability_compensation_sync_modern_0781_flow, user)
)
end

Expand Down
4 changes: 0 additions & 4 deletions app/models/form_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ def with_form_types(form_types)
end
end

def form_data
super || '{}'
end

def latest_pending_attempt
form_submission_attempts.where(aasm_state: 'pending').order(created_at: :asc).last
end
Expand Down
6 changes: 4 additions & 2 deletions app/models/form_submission_attempt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ def log_status_change
private

def enqueue_result_email(notification_type)
raw_form_data = form_submission.form_data || '{}'
form_data = JSON.parse(raw_form_data)
config = {
form_data: JSON.parse(form_submission.form_data),
form_data:,
form_number: form_submission.form_type,
confirmation_number: form_submission.benefits_intake_uuid,
date_submitted: created_at.strftime('%B %d, %Y'),
Expand All @@ -95,7 +97,7 @@ def enqueue_result_email(notification_type)
end

def time_to_send
now = Time.zone.now
now = Time.now.in_time_zone('Eastern Time (US & Canada)')
if now.hour < HOUR_TO_SEND_NOTIFICATIONS
now.change(hour: HOUR_TO_SEND_NOTIFICATIONS,
min: 0)
Expand Down
6 changes: 5 additions & 1 deletion app/serializers/service_history_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class ServiceHistorySerializer
set_id { '' }

attributes :service_history do |object|
object
object[:episodes]
end

attributes :vet_status_eligibility do |object|
object[:vet_status_eligibility]
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class NewStatementNotificationJob
end

sidekiq_retries_exhausted do |_msg, ex|
StatsD.increment("#{STATSD_KEY_PREFIX}.failure")
StatsD.increment("#{STATSD_KEY_PREFIX}.failure") # remove when we get more data into the retries_exhausted below
StatsD.increment("#{STATSD_KEY_PREFIX}.retries_exhausted")
Rails.logger.error <<~LOG
NewStatementNotificationJob retries exhausted:
Exception: #{ex.class} - #{ex.message}
Expand Down
12 changes: 11 additions & 1 deletion app/sidekiq/copay_notifications/parse_new_statements_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ class ParseNewStatementsJob
JOB_INTERVAL = Settings.mcp.notifications.job_interval
# number of jobs to perform at next interval
BATCH_SIZE = Settings.mcp.notifications.batch_size
STATSD_KEY_PREFIX = 'api.copay_notifications.json_file'

sidekiq_retries_exhausted do |_msg, ex|
StatsD.increment("#{STATSD_KEY_PREFIX}.retries_exhausted")
Rails.logger.error <<~LOG
CopayNotifications::ParseNewStatementsJob retries exhausted:
Exception: #{ex.class} - #{ex.message}
Backtrace: #{ex.backtrace.join("\n")}
LOG
end

def perform(statements_json_byte)
StatsD.increment('api.copay_notifications.json_file.total')
StatsD.increment("#{STATSD_KEY_PREFIX}.total")
# Decode and parse large json file (~60-90k objects)
statements_json = Oj.load(Base64.decode64(statements_json_byte))
unique_statements = statements_json.uniq { |statement| statement['veteranIdentifier'] }
Expand Down
18 changes: 18 additions & 0 deletions app/sidekiq/mhv/account_creator_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

require 'mhv/user_account/creator'

module MHV
class AccountCreatorJob
include Sidekiq::Job

sidekiq_options retry: false

def perform(id)
user_verification = UserVerification.find(id)
MHV::UserAccount::Creator.new(user_verification:, break_cache: true).perform
rescue ActiveRecord::RecordNotFound
Rails.logger.error("MHV AccountCreatorJob failed: UserVerification not found for id #{id}")
end
end
end
7 changes: 7 additions & 0 deletions app/swagger/swagger/requests/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,13 @@ class Profile
property :character_of_discharge_code, type: :string, example: 'DVN', description: 'The abbreviated code used to reference the status of a Servicemember upon termination of an episode'
end
end
property :vet_status_eligibility do
key :type, :object
items do
property :confirmed, type: :boolean
property :message, type: :array
end
end
end
end
end
Expand Down
16 changes: 14 additions & 2 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ features:
actor_type: user
description: enable to test the backup submission path. DO NOT TOGGLE THIS FLAG UNLESS YOU ARE A MEMBER OF DISABILITY BENEFITS EXPERIENCE TEAM.
enable_in_development: true
disability_compensation_sync_modern_0781_flow:
actor_type: user
description: enables a new form flow for 0781 and 0781a in the 526 submission workflow
enable_in_development: true
education_reports_cleanup:
actor_type: user
description: Updates to the daily education reports to remove old data that isn't needed in the new fiscal year
Expand Down Expand Up @@ -790,6 +794,10 @@ features:
actor_type: user
description: Enable/disable dependent claimant support for POA requests
enable_in_development: true
lighthouse_claims_api_v2_poa_va_notify:
actor_type: user
description: Enable/disable the VA ntofication emails in V2 POA
enable_in_development: false
lighthouse_claims_v2_poa_requests_skip_bgs:
actor_type: user
description: Enable/disable skipping BGS calls for POA Requests
Expand Down Expand Up @@ -1038,9 +1046,9 @@ features:
profile_show_quick_submit_notification_setting:
actor_type: user
description: Show/Hide the quick submit section of notification settings in profile
profile_show_proof_of_veteran_status:
profile_show_proof_of_veteran_status_eligible:
actor_type: user
description: Show/Hide the proof of veteran status page and links
description: Include/exclude the proof of veteran status eligibility in service_history response
profile_use_experimental:
description: Use experimental features for Profile application - Do not remove
enable_in_development: true
Expand Down Expand Up @@ -1307,6 +1315,10 @@ features:
actor_type: user
enable_in_development: true
description: Toggle for tickets with the label vaos-v2-next will be behind this flag
va_online_scheduling_vaos_alternate_route:
actor_type: user
enable_in_development: false
description: Toggle for the vaos module to use an alternate vaos-service route
va_online_scheduling_clinic_filter:
actor_type: user
enable_in_development: true
Expand Down
3 changes: 2 additions & 1 deletion config/form_profile_mappings/21-526EZ.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ bankAccountType: [payment_information, account_type]
bankAccountNumber: [payment_information, account_number]
bankRoutingNumber: [payment_information, routing_number]
bankName: [payment_information, bank_name]
startedFormVersion: [prefill_526, started_form_version]
startedFormVersion: [prefill_526, started_form_version]
syncModern0781Flow: [prefill_526, sync_modern_0781_flow]
6 changes: 6 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,12 @@ claims_api:
use_mocks: false
poa_v2:
disable_jobs: false
vanotify:
representative_template_id: ~
service_organization_template_id: ~
services:
lighthouse:
api_key: ~

connected_apps_api:
connected_apps:
Expand Down
9 changes: 8 additions & 1 deletion config/settings/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,14 @@ claims_api:
client_id: fakekeyvaluehere
secret_key: path/to/fake/key.pem
aud_claim_url: https://fakeurlhere/fake/path/here

vanotify:
client_url: https://fakeurl/with/path/here
representative_template_id: xxxxxx-zzzz-aaaa-bbbb-cccccccc
service_organization_template_id: xxxxxx-zzzz-aaaa-bbbb-cccccccc
services:
lighthouse:
api_key: fake-xxxxxx-zzzz-aaaa-bbbb-cccccccc-xxxxxx-zzzz-aaaa-bbbb-cccccccc

ask_va:
crm_api:
auth_url: https://login.microsoftonline.us
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,66 @@ def validate_upload_document(evss_claim_document)
#
# @return [Faraday::Response] The EVSS::DocumentsService API calls are implemented with Faraday
def submit_upload_document(evss_claim_document, file_body)
log_upload_attempt

client = EVSS::DocumentsService.new(@form526_submission.auth_headers)
client.upload(file_body, evss_claim_document)

StatsD.increment("#{@statsd_metric_prefix}.#{STATSD_PROVIDER_METRIC}.#{STATSD_SUCCESS_METRIC}")
# EVSS::DocumentsService uploads throw a EVSS::ErrorMiddleware::EVSSError if they fail
# If no exception is raised, log a success response
log_upload_success
rescue EVSS::ErrorMiddleware::EVSSError => e
# If exception is raised, log and re-raise the error
log_upload_failure
raise e
end

def log_upload_failure(error_class, error_message)
StatsD.increment("#{@statsd_metric_prefix}.#{STATSD_PROVIDER_METRIC}.#{STATSD_FAILED_METRIC}")

# To call in the sidekiq_retries_exhausted block of the including job
# This is meant to log an upload attempt that was retried and eventually given up on,
# so we can investigate the failure in Datadog
#
# @param uploading_job_class [String] the job where we are uploading the EVSSClaimDocument
# (e.g. UploadBDDInstructions)
# @param error_class [String] the Error class of the exception that exhausted the upload job
# @param error_message [String] the message in the exception that exhausted the upload job
def log_uploading_job_failure(uploading_job_class, error_class, error_message)
Rails.logger.error(
'EVSSSupplementalDocumentUploadProvider upload failure',
"#{uploading_job_class} EVSSSupplementalDocumentUploadProvider Failure",
{
class: 'EVSSSupplementalDocumentUploadProvider',
**base_logging_info,
uploading_job_class:,
error_class:,
error_message:
}
)

StatsD.increment("#{@statsd_metric_prefix}.#{STATSD_PROVIDER_METRIC}.#{STASTD_UPLOAD_JOB_FAILED_METRIC}")
end

private

def base_logging_info
{
class: 'EVSSSupplementalDocumentUploadProvider',
submission_id: @form526_submission.submitted_claim_id,
user_uuid: @form526_submission.user_uuid,
va_document_type_code: @va_document_type,
primary_form: 'Form526'
}
end

def log_upload_attempt
Rails.logger.info('EVSSSupplementalDocumentUploadProvider upload attempted', base_logging_info)
StatsD.increment("#{@statsd_metric_prefix}.#{STATSD_PROVIDER_METRIC}.#{STATSD_ATTEMPT_METRIC}")
end

def log_upload_success
Rails.logger.info('EVSSSupplementalDocumentUploadProvider upload successful', base_logging_info)
StatsD.increment("#{@statsd_metric_prefix}.#{STATSD_PROVIDER_METRIC}.#{STATSD_SUCCESS_METRIC}")
end

def log_upload_failure
Rails.logger.error('EVSSSupplementalDocumentUploadProvider upload failed', base_logging_info)
StatsD.increment("#{@statsd_metric_prefix}.#{STATSD_PROVIDER_METRIC}.#{STATSD_FAILED_METRIC}")
end
end
Loading

0 comments on commit 11f3635

Please sign in to comment.