From 8a44b69d5c068d086b96947b70cc4e5a42fe179f Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:06:42 -0600 Subject: [PATCH 01/10] Force output form to have '2019' as startedFormVersion --- .../data_translation_all_claim.rb | 15 ++++-- .../data_translation_all_claim_spec.rb | 48 +++++++++++++++++++ 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/lib/evss/disability_compensation_form/data_translation_all_claim.rb b/lib/evss/disability_compensation_form/data_translation_all_claim.rb index 559d126e07e..c442cfd0c8f 100644 --- a/lib/evss/disability_compensation_form/data_translation_all_claim.rb +++ b/lib/evss/disability_compensation_form/data_translation_all_claim.rb @@ -59,11 +59,7 @@ def translate output_form['overflowText'] = overflow_text output_form['bddQualified'] = bdd_qualified? output_form['claimSubmissionSource'] = 'VA.gov' - # any form that has a startedFormVersion (whether it is '2019' or '2022') - # will go through the Toxic Exposure flow - output_form['startedFormVersion'] = input_form['startedFormVersion'] || nil output_form.compact! - output_form.update(translate_banking_info) output_form.update(translate_service_pay) output_form.update(translate_service_info) @@ -72,7 +68,8 @@ def translate output_form.update(translate_disabilities) # any form that has a startedFormVersion (whether it is '2019' or '2022') # will go through the Toxic Exposure flow - output_form.update(add_toxic_exposure) if output_form['startedFormVersion'] + output_form.update(translate_started_form_version) + output_form.update(add_toxic_exposure) @translated_form end @@ -226,6 +223,14 @@ def direct_deposit(type, account_number, routing_number, bank_name) } end + ### + # Started Form Version + ### + def translate_started_form_version + # fixes bug where some InProgressForms were missing startedFormVersion (necessary for Toxic Exposure flow) + { 'startedFormVersion' => input_form['startedFormVersion'] || '2019' } + end + ### # Service pay ### diff --git a/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb b/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb index 4c2c4b1be59..907f7124f73 100644 --- a/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb +++ b/spec/lib/evss/disability_compensation_form/data_translation_all_claim_spec.rb @@ -1831,6 +1831,54 @@ end end + describe '#translateStartedFormVersion' do + context 'no startedFormVersion on input form' do + let(:form_content) do + { + 'form526' => {} + } + end + + it 'adds in startedFormVersion when it was missing' do + expect(subject.send(:translate_started_form_version)).to eq({ + 'startedFormVersion' => '2019' + }) + end + end + + context 'startedFormVersion is 2022' do + let(:form_content) do + { + 'form526' => { + 'startedFormVersion' => '2022' + } + } + end + + it 'adds in startedFormVersion when it was missing' do + expect(subject.send(:translate_started_form_version)).to eq({ + 'startedFormVersion' => '2022' + }) + end + end + + context 'startedFormVersion is 2019' do + let(:form_content) do + { + 'form526' => { + 'startedFormVersion' => '2019' + } + } + end + + it 'fills in 2019 startedFormVersion' do + expect(subject.send(:translate_started_form_version)).to eq({ + 'startedFormVersion' => '2019' + }) + end + end + end + describe '#add_toxic_exposure' do let(:form_content) do { From 66912c14232f180319723071ea6c581be286d435 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Mon, 23 Dec 2024 16:27:49 -0600 Subject: [PATCH 02/10] no ego amigo, this doesn't fix that bug. --- .../disability_compensation_form/data_translation_all_claim.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/evss/disability_compensation_form/data_translation_all_claim.rb b/lib/evss/disability_compensation_form/data_translation_all_claim.rb index c442cfd0c8f..7319ef63cf4 100644 --- a/lib/evss/disability_compensation_form/data_translation_all_claim.rb +++ b/lib/evss/disability_compensation_form/data_translation_all_claim.rb @@ -227,7 +227,6 @@ def direct_deposit(type, account_number, routing_number, bank_name) # Started Form Version ### def translate_started_form_version - # fixes bug where some InProgressForms were missing startedFormVersion (necessary for Toxic Exposure flow) { 'startedFormVersion' => input_form['startedFormVersion'] || '2019' } end From 3d250b42f69aeb532dafdeb8c6e5c85e5b10464b Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Mon, 23 Dec 2024 16:28:21 -0600 Subject: [PATCH 03/10] never supply nil for started_form_version --- app/models/form_profiles/va_526ez.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/form_profiles/va_526ez.rb b/app/models/form_profiles/va_526ez.rb index f412bf6bfae..b0b30a1bc90 100644 --- a/app/models/form_profiles/va_526ez.rb +++ b/app/models/form_profiles/va_526ez.rb @@ -167,9 +167,10 @@ def prefill_base_class_methods 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 + # any new form should have a '2022' startedFormVersion in order to go through the Toxic Exposure flow + # but we never want this field to be nil in order to catch any # '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' : '2019', sync_modern_0781_flow: Flipper.enabled?(:disability_compensation_sync_modern_0781_flow, user) ) end From 540118158c0038b9239e99bc09ab7d80206b3d46 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:26:22 -0600 Subject: [PATCH 04/10] Add logging to check how many times we have to set startedFormVersion for existing IPF --- .../v0/disability_compensation_in_progress_forms_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb b/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb index 08acc1a67d1..7e73a7f501d 100644 --- a/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb +++ b/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb @@ -44,6 +44,7 @@ def data_and_metadata_with_updated_rated_disabilities # moving forward, we don't want to change the version if it is already there if Flipper.enabled?(:disability_526_toxic_exposure_ipf, @current_user) && parsed_form_data['startedFormVersion'].blank? + log_started_form_version(parsed_form_data, 'existing IPF missing startedFormVersion') parsed_form_data['startedFormVersion'] = '2019' end From 7b131f6d59ae5fe4820f0f2848b1689f02efdd72 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:40:48 -0600 Subject: [PATCH 05/10] Update spec --- spec/requests/v0/disability_compensation_form_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/requests/v0/disability_compensation_form_spec.rb b/spec/requests/v0/disability_compensation_form_spec.rb index 4da1e24bc80..ecca8d386e6 100644 --- a/spec/requests/v0/disability_compensation_form_spec.rb +++ b/spec/requests/v0/disability_compensation_form_spec.rb @@ -265,7 +265,7 @@ def test_error(cassette_path, status, headers) expect(response).to match_response_schema('submit_disability_form') expect(Form526Submission.count).to eq(1) form = Form526Submission.last.form - expect(form.dig('form526', 'form526', 'startedFormVersion')).to eq(nil) + expect(form.dig('form526', 'form526', 'startedFormVersion')).to eq('2019') end end From 1225c0b7838c2dc89004fe0e4a51b0c7237aa8fd Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:06:34 -0600 Subject: [PATCH 06/10] Refactor out setting SFV --- ..._compensation_in_progress_forms_controller.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb b/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb index 7e73a7f501d..215725b2cd6 100644 --- a/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb +++ b/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb @@ -42,18 +42,22 @@ def data_and_metadata_with_updated_rated_disabilities # for Toxic Exposure 1.1 - add indicator to In Progress Forms # moving forward, we don't want to change the version if it is already there - if Flipper.enabled?(:disability_526_toxic_exposure_ipf, - @current_user) && parsed_form_data['startedFormVersion'].blank? - log_started_form_version(parsed_form_data, 'existing IPF missing startedFormVersion') - parsed_form_data['startedFormVersion'] = '2019' - end - + parsed_form_data = set_started_form_version(parsed_form_data) { formData: parsed_form_data, metadata: } end + def set_started_form_version(data) + if Flipper.enabled?(:disability_526_toxic_exposure_ipf, + @current_user) && data['startedFormVersion'].blank? + log_started_form_version(data, 'existing IPF missing startedFormVersion') + data['startedFormVersion'] = '2019' + end + data + end + def rated_disabilities_evss @rated_disabilities_evss ||= FormProfiles::VA526ez.for(form_id:, user: @current_user) .initialize_rated_disabilities_information From 53394cf3cc2fdc24ccfd019dbe89ded2e00b2010 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Thu, 2 Jan 2025 16:27:21 -0600 Subject: [PATCH 07/10] Rubocop --- .../v0/disability_compensation_in_progress_forms_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb b/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb index 215725b2cd6..3a5ba6eb37a 100644 --- a/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb +++ b/app/controllers/v0/disability_compensation_in_progress_forms_controller.rb @@ -51,7 +51,7 @@ def data_and_metadata_with_updated_rated_disabilities def set_started_form_version(data) if Flipper.enabled?(:disability_526_toxic_exposure_ipf, - @current_user) && data['startedFormVersion'].blank? + @current_user) && data['startedFormVersion'].blank? log_started_form_version(data, 'existing IPF missing startedFormVersion') data['startedFormVersion'] = '2019' end From 96c15dfdb13196109269ee826bdba7fc34214ad2 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:09:29 -0600 Subject: [PATCH 08/10] Update spec --- ...sability_compensation_in_progress_forms_controller_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/requests/v0/disability_compensation_in_progress_forms_controller_spec.rb b/spec/requests/v0/disability_compensation_in_progress_forms_controller_spec.rb index fcc7d832514..f0050c9a1a2 100644 --- a/spec/requests/v0/disability_compensation_in_progress_forms_controller_spec.rb +++ b/spec/requests/v0/disability_compensation_in_progress_forms_controller_spec.rb @@ -148,10 +148,10 @@ expect(json_response['formData']['startedFormVersion']).to eq('2022') end - it 'omits adding startedFormVersion when corresponding flag is not enabled for user' do + it 'adds default startedFormVersion when corresponding flag is not enabled for user' do get v0_disability_compensation_in_progress_form_url(form_id), params: nil json_response = JSON.parse(response.body) - expect(json_response['formData']['startedFormVersion']).to eq(nil) + expect(json_response['formData']['startedFormVersion']).to eq('2019') end end From 6542af04068e5cad6abd71b9a559ff0a26b2c321 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:19:09 -0600 Subject: [PATCH 09/10] update codeowners --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 65d46e7489d..c7fd15ea610 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1716,6 +1716,7 @@ spec/requests/swagger_spec.rb @department-of-veterans-affairs/va-api-engineers @ spec/requests/v0/messaging/health/recipients_spec.rb @department-of-veterans-affairs/vfs-mhv-secure-messaging @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/requests/v0/upload_supporting_evidence_spec.rb @department-of-veterans-affairs/Disability-Experience @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/requests/v0/user_spec.rb @department-of-veterans-affairs/octo-identity +spec/requests/v0/disability_compensation_in_progress_forms_controller_spec.rb @department-of-veterans-affairs/Disability-Experience @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/requests/v0/disability_compensation_in_progress_forms_controller_request_spec.rb @department-of-veterans-affairs/Disability-Experience @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/requests/v0/evss_claims/documents_spec.rb @department-of-veterans-affairs/benefits-management-tools-be @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group spec/requests/v0/form1010cg @department-of-veterans-affairs/vfs-10-10 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group From 997604f1882361b0ed99c1d8d2b7d550f06a88c4 Mon Sep 17 00:00:00 2001 From: Tommasina Miller <144388524+tommasina-va@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:25:52 -0600 Subject: [PATCH 10/10] Remove comments --- app/models/form_profiles/va_526ez.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/models/form_profiles/va_526ez.rb b/app/models/form_profiles/va_526ez.rb index b0b30a1bc90..a379856ba47 100644 --- a/app/models/form_profiles/va_526ez.rb +++ b/app/models/form_profiles/va_526ez.rb @@ -167,9 +167,6 @@ def prefill_base_class_methods def initialize_form526_prefill VA526ez::Form526Prefill.new( - # any new form should have a '2022' startedFormVersion in order to go through the Toxic Exposure flow - # but we never want this field to be nil in order to catch any - # '2022' means the Toxic Exposure 1.0 flag. started_form_version: Flipper.enabled?(:disability_526_toxic_exposure, user) ? '2022' : '2019', sync_modern_0781_flow: Flipper.enabled?(:disability_compensation_sync_modern_0781_flow, user) )