From 11eb4f3eeb7ba8b5b5a10e8a1e7ea29170fdfe42 Mon Sep 17 00:00:00 2001 From: stevenjcumming <134282106+stevenjcumming@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:04:22 -0500 Subject: [PATCH 1/5] Move Hardcoded Settings to vets-api - Part 2 (#19605) * move hardcoded named-env settings to vets-api * remove unused setting * remove unused setting --- config/settings/production.yml | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/config/settings/production.yml b/config/settings/production.yml index 6546f69e0a5..bf4692f5afa 100644 --- a/config/settings/production.yml +++ b/config/settings/production.yml @@ -42,3 +42,51 @@ google_analytics_cvu: type: service_account hca: ca: [] +lighthouse: + benefits_intake: + path: /services/vba_documents + use_mocks: false + version: v1 + veteran_verification: + form526: + use_mocks: false +maintenance: + services: + bgs: P5Q2OCZ +modules_appeals_api: + legacy_appeals_enabled: true + schema_dir: config/schemas +mvi: + pii_logging: false +session_cookie: + secure: true +sidekiq_admin_panel: false +sidekiq: + github_organization: department-of-veterans-affairs +va_profile: + contact_information: + cache_enabled: true + enabled: true + mock: false + timeout: 30 + demographics: + cache_enabled: false + enabled: true + mock: false + timeout: 30 + military_personnel: + cache_enabled: false + enabled: true + mock: false + timeout: 30 + veteran_status: + mock: false +vba_documents: + enable_validate_document_endpoint: true + s3: + enabled: true + slack: + daily_notification_hour: 7 + in_flight_notification_hung_time_in_days: 14 + renotification_in_minutes: 1440 + update_stalled_notification_in_minutes: 180 From 9a4c3887fc2f76217bf92f8bce714ae32a7ab258 Mon Sep 17 00:00:00 2001 From: Don Shin <99479640+cloudmagic80@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:19:02 -0600 Subject: [PATCH 2/5] reverse flipper (#19627) --- config/features.yml | 3 - .../ivc_champva/v1/uploads_controller.rb | 79 +++++----------- .../ivc_champva/v1/forms/uploads_spec.rb | 94 +++++++++---------- 3 files changed, 72 insertions(+), 104 deletions(-) diff --git a/config/features.yml b/config/features.yml index fda615484b7..000e0139df0 100644 --- a/config/features.yml +++ b/config/features.yml @@ -166,9 +166,6 @@ features: champva_unique_temp_file_names: actor_type: user description: Enables unique temp file names for CHAMPVA PDF files - champva_file_recreate: - actor_type: user - description: Enhances file creation reliability by adding retry functionality in the vets-api tmp folder champva_failure_email_job_enabled: actor_type: user description: Enables sending failure notification emails for IVC CHAMPVA form submissions that lack a Pega status diff --git a/modules/ivc_champva/app/controllers/ivc_champva/v1/uploads_controller.rb b/modules/ivc_champva/app/controllers/ivc_champva/v1/uploads_controller.rb index 4b8f4a0291a..fbc5a31a77f 100644 --- a/modules/ivc_champva/app/controllers/ivc_champva/v1/uploads_controller.rb +++ b/modules/ivc_champva/app/controllers/ivc_champva/v1/uploads_controller.rb @@ -15,50 +15,25 @@ class UploadsController < ApplicationController '10-7959A' => 'vha_10_7959a' }.freeze - if Flipper.enabled?(:champva_file_recreate, @user) - def submit - Datadog::Tracing.trace('Start IVC File Submission') do - form_id = get_form_id - Datadog::Tracing.active_trace&.set_tag('form_id', form_id) - parsed_form_data = JSON.parse(params.to_json) - statuses, error_message = handle_file_uploads(form_id, parsed_form_data) + def submit + Datadog::Tracing.trace('Start IVC File Submission') do + form_id = get_form_id + Datadog::Tracing.active_trace&.set_tag('form_id', form_id) + parsed_form_data = JSON.parse(params.to_json) + statuses, error_message = handle_file_uploads(form_id, parsed_form_data) - response = build_json(Array(statuses), error_message) + response = build_json(Array(statuses), error_message) - if @current_user && response[:status] == 200 - InProgressForm.form_for_user(params[:form_number], @current_user)&.destroy! - end - - render json: response[:json], status: response[:status] - end - rescue => e - Rails.logger.error "Error: #{e.message}" - Rails.logger.error e.backtrace.join("\n") - render json: { error_message: "Error: #{e.message}" }, status: :internal_server_error - end - else - def submit - Datadog::Tracing.trace('Start IVC File Submission') do - form_id = get_form_id - Datadog::Tracing.active_trace&.set_tag('form_id', form_id) - parsed_form_data = JSON.parse(params.to_json) - file_paths, metadata = get_file_paths_and_metadata(parsed_form_data) - statuses, error_message = FileUploader.new(form_id, metadata, file_paths, true).handle_uploads - response = build_json(Array(statuses), error_message) - - if @current_user && response[:status] == 200 - InProgressForm.form_for_user(params[:form_number], - @current_user)&.destroy! - end - - render json: response[:json], status: response[:status] - rescue => e - Rails.logger.error "Error: #{e.message}" - Rails.logger.error e.backtrace.join("\n") - render json: { error_message: "Error: #{e.message}" }, - status: :internal_server_error + if @current_user && response[:status] == 200 + InProgressForm.form_for_user(params[:form_number], @current_user)&.destroy! end + + render json: response[:json], status: response[:status] end + rescue => e + Rails.logger.error "Error: #{e.message}" + Rails.logger.error e.backtrace.join("\n") + render json: { error_message: "Error: #{e.message}" }, status: :internal_server_error end def submit_supporting_documents @@ -74,22 +49,20 @@ def submit_supporting_documents private - if Flipper.enabled?(:champva_file_recreate, @user) - def handle_file_uploads(form_id, parsed_form_data) + def handle_file_uploads(form_id, parsed_form_data) + file_paths, metadata = get_file_paths_and_metadata(parsed_form_data) + statuses, error_message = FileUploader.new(form_id, metadata, file_paths, true).handle_uploads + statuses = Array(statuses) + + # Retry attempt if specific error message is found + if statuses.any? do |status| + status.is_a?(String) && status.include?('No such file or directory @ rb_sysopen') + end file_paths, metadata = get_file_paths_and_metadata(parsed_form_data) statuses, error_message = FileUploader.new(form_id, metadata, file_paths, true).handle_uploads - statuses = Array(statuses) - - # Retry attempt if specific error message is found - if statuses.any? do |status| - status.is_a?(String) && status.include?('No such file or directory @ rb_sysopen') - end - file_paths, metadata = get_file_paths_and_metadata(parsed_form_data) - statuses, error_message = FileUploader.new(form_id, metadata, file_paths, true).handle_uploads - end - - [statuses, error_message] end + + [statuses, error_message] end def get_attachment_ids_and_form(parsed_form_data) diff --git a/modules/ivc_champva/spec/requests/ivc_champva/v1/forms/uploads_spec.rb b/modules/ivc_champva/spec/requests/ivc_champva/v1/forms/uploads_spec.rb index 1d738bb868d..c8db6b456e4 100644 --- a/modules/ivc_champva/spec/requests/ivc_champva/v1/forms/uploads_spec.rb +++ b/modules/ivc_champva/spec/requests/ivc_champva/v1/forms/uploads_spec.rb @@ -186,64 +186,62 @@ end end - if Flipper.enabled?(:champva_file_recreate, @user) - describe '#handle_file_uploads' do - let(:controller) { IvcChampva::V1::UploadsController.new } - - forms.each do |form_file| - form_id = form_file.gsub('vha_', '').gsub('.json', '').upcase - form_numbers_and_classes[form_id] - - context "with form #{form_id}" do - let(:form_id) { form_id } - let(:parsed_form_data) do - JSON.parse(Rails.root.join('modules', 'ivc_champva', 'spec', 'fixtures', 'form_json', form_file).read) - end - let(:file_paths) { ['/path/to/file1.pdf', '/path/to/file2.pdf'] } - let(:metadata) { { 'attachment_ids' => %w[id1 id2] } } - let(:file_uploader) { instance_double(IvcChampva::FileUploader) } + describe '#handle_file_uploads' do + let(:controller) { IvcChampva::V1::UploadsController.new } + + forms.each do |form_file| + form_id = form_file.gsub('vha_', '').gsub('.json', '').upcase + form_numbers_and_classes[form_id] + + context "with form #{form_id}" do + let(:form_id) { form_id } + let(:parsed_form_data) do + JSON.parse(Rails.root.join('modules', 'ivc_champva', 'spec', 'fixtures', 'form_json', form_file).read) + end + let(:file_paths) { ['/path/to/file1.pdf', '/path/to/file2.pdf'] } + let(:metadata) { { 'attachment_ids' => %w[id1 id2] } } + let(:file_uploader) { instance_double(IvcChampva::FileUploader) } + + before do + allow(controller).to receive(:get_file_paths_and_metadata).and_return([file_paths, metadata]) + allow(IvcChampva::FileUploader).to receive(:new).and_return(file_uploader) + end + context 'when file uploads succeed' do before do - allow(controller).to receive(:get_file_paths_and_metadata).and_return([file_paths, metadata]) - allow(IvcChampva::FileUploader).to receive(:new).and_return(file_uploader) + allow(file_uploader).to receive(:handle_uploads).and_return([[200], nil]) end - context 'when file uploads succeed' do - before do - allow(file_uploader).to receive(:handle_uploads).and_return([[200], nil]) - end + it 'returns success statuses and no error message' do + statuses, error_message = controller.send(:handle_file_uploads, form_id, parsed_form_data) + expect(statuses).to eq([200]) + expect(error_message).to be_nil + end + end - it 'returns success statuses and no error message' do - statuses, error_message = controller.send(:handle_file_uploads, form_id, parsed_form_data) - expect(statuses).to eq([200]) - expect(error_message).to be_nil - end + context 'when file uploads fail with specific error message' do + before do + allow(file_uploader).to receive(:handle_uploads).and_return([['No such file or directory @ rb_sysopen'], + 'File not found']) end - context 'when file uploads fail with specific error message' do - before do - allow(file_uploader).to receive(:handle_uploads).and_return([['No such file or directory @ rb_sysopen'], - 'File not found']) - end - - it 'retries the file uploads and returns the final statuses and error message' do - allow(file_uploader).to receive(:handle_uploads).and_return([[200], nil]) - statuses, error_message = controller.send(:handle_file_uploads, form_id, parsed_form_data) - expect(statuses).to eq([200]) - expect(error_message).to be_nil - end + it 'retries the file uploads and returns the final statuses and error message' do + allow(file_uploader).to receive(:handle_uploads).and_return([[200], nil]) + statuses, error_message = controller.send(:handle_file_uploads, form_id, parsed_form_data) + expect(statuses).to eq([200]) + expect(error_message).to be_nil end + end - context 'when file uploads fail with other errors' do - before do - allow(file_uploader).to receive(:handle_uploads).and_return([[400], 'Upload failed']) - end + context 'when file uploads fail with other errors' do + before do + allow(file_uploader).to receive(:handle_uploads).and_return([[400], 'Upload failed']) + end - it 'returns the error statuses and error message' do - statuses, error_message = controller.send(:handle_file_uploads, form_id, parsed_form_data) - expect(statuses).to eq([400]) - expect(error_message).to eq('Upload failed') - end + it 'returns the error statuses and error message' do + statuses, error_message = controller.send(:handle_file_uploads, form_id, parsed_form_data) + expect(statuses).to eq([400]) + expect(error_message).to eq('Upload failed') end end end From 4b8a7d807b58eb04f8ef56af8f6fb6a857f427a7 Mon Sep 17 00:00:00 2001 From: Aurora <19178435+aurora-a-k-a-lightning@users.noreply.github.com> Date: Wed, 27 Nov 2024 08:26:16 -0800 Subject: [PATCH 3/5] dbex/97956-separation-location-string: temporary - turn separation loccation code into string for saved claim (#19632) * dbex/97956-separation-location-string: temporary - turn separation location code into string for saved claim * dbex/97956-separation-location-string: temporary - turn separation location code into string for saved claim * dbex/97956-separation-location-string: temporary - turn separation location code into string for saved claim * dbex/97956-separation-location-string: temporary - turn separation location code into string for saved claim * dbex/97956-separation-location-string: enter flipper flag: disability_compensation_temp_separation_location_code_string * dbex/97956-separation-location-string: enter flipper flag: disability_compensation_temp_separation_location_code_string * dbex/97956-separation-location-string: enter flipper flag: disability_compensation_temp_separation_location_code_string * dbex/97956-separation-location-string: enter flipper flag: disability_compensation_temp_separation_location_code_string * dbex/97956-separation-location-string: enter flipper flag: disability_compensation_temp_separation_location_code_string --- ...disability_compensation_forms_controller.rb | 18 ++++++++++++++++++ config/features.yml | 3 +++ 2 files changed, 21 insertions(+) diff --git a/app/controllers/v0/disability_compensation_forms_controller.rb b/app/controllers/v0/disability_compensation_forms_controller.rb index 09c0814e4e2..c0bdaa6b2e5 100644 --- a/app/controllers/v0/disability_compensation_forms_controller.rb +++ b/app/controllers/v0/disability_compensation_forms_controller.rb @@ -52,6 +52,9 @@ def suggested_conditions end def submit_all_claim + temp_separation_location_fix if Flipper.enabled?(:disability_compensation_temp_separation_location_code_string, + @current_user) + saved_claim = SavedClaim::DisabilityCompensation::Form526AllClaim.from_hash(form_content) saved_claim.save ? log_success(saved_claim) : log_failure(saved_claim) submission = create_submission(saved_claim) @@ -172,5 +175,20 @@ def missing_disabilities?(submission) end false end + + # TEMPORARY + # Turn separation location into string + # 11/18/2024 BRD EVSS -> Lighthouse migration caused separation location to turn into an integer, + # while SavedClaim (vets-json-schema) is expecting a string + def temp_separation_location_fix + if form_content.is_a?(Hash) && form_content['form526'].is_a?(Hash) + separation_location_code = form_content.dig('form526', 'serviceInformation', 'separationLocation') + unless separation_location_code.nil? + form_content['form526']['serviceInformation']['separationLocation']['separationLocationCode'] = + separation_location_code.to_s + end + end + end + # END TEMPORARY end end diff --git a/config/features.yml b/config/features.yml index 000e0139df0..b57df2f8acb 100644 --- a/config/features.yml +++ b/config/features.yml @@ -527,6 +527,9 @@ features: actor_type: user description: enables sending flashes to BGS for disability_compensation submissions. enable_in_development: true + disability_compensation_temp_separation_location_code_string: + actor_type: user + description: enables forcing separation location code to be a string in submit_all_claim endpoint. disability_compensation_form4142_supplemental: actor_type: user description: Use Lighthouse API to submit supplemental Form 21-4142 from Form 526EZ submissions From 9741f97f359bcd402c92adbe081017d9a6997db6 Mon Sep 17 00:00:00 2001 From: Aurora <19178435+aurora-a-k-a-lightning@users.noreply.github.com> Date: Wed, 27 Nov 2024 08:28:21 -0800 Subject: [PATCH 4/5] dbex/brd migration: turn separation location code into a string (#19589) - we were sending an integer - front end saves as an integer - saved_claim validation is expecting a string --- lib/disability_compensation/responses/intake_sites_response.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/disability_compensation/responses/intake_sites_response.rb b/lib/disability_compensation/responses/intake_sites_response.rb index 3828d5cddc0..b944cb731c1 100644 --- a/lib/disability_compensation/responses/intake_sites_response.rb +++ b/lib/disability_compensation/responses/intake_sites_response.rb @@ -6,7 +6,7 @@ class SeparationLocation include ActiveModel::Serialization include Virtus.model - attribute :code, Integer + attribute :code, String attribute :description, String end From e1e0a43f7701c1db75f32ac8894dd17aa1bbcc43 Mon Sep 17 00:00:00 2001 From: Adam Whitlock <8332986+adamwhitlock1@users.noreply.github.com> Date: Wed, 27 Nov 2024 09:30:43 -0700 Subject: [PATCH 5/5] add aedp_VADX feature toggle (#19621) * add aedp_VADX feature toggle * fix camel casing lower case --- config/features.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/features.yml b/config/features.yml index b57df2f8acb..8964dd1d390 100644 --- a/config/features.yml +++ b/config/features.yml @@ -23,6 +23,10 @@ features: actor_type: user description: Enables the endpoints of the accredited representative portal enable_in_development: true + aedp_vadx: + actor_type: user + description: Enables the VADX experimental features in the AEDP application + enable_in_development: true all_claims_add_disabilities_enhancement: actor_type: user description: Enables enhancement to the 21-526EZ "Add Disabilities" page being implemented by the Conditions Team.