Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) #21614

Conversation

@jcroteau jcroteau marked this pull request as ready for review May 10, 2024 14:03
@sbashamoni sbashamoni merged commit a5b63e3 into release/FY24Q3.2.0 May 10, 2024
31 checks passed
jcroteau added a commit that referenced this pull request May 17, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
mchbidwell pushed a commit that referenced this pull request May 20, 2024
* added saftey opperator and removed outdated date check

* removed leftover method that was breaking and unused.

* removed legacy appeal date check for MST on special issue list

* updated mst and pact badges to check decisions in flight (if any) then appeal model.

* removed bypass for special issue list for pact toggle for AMA.

* updated rake and seed comments

* allowed special issues page tracking for AMA MST issues when pact is enabled

* remove code changes causing cancel to progress forward

* Update scheduled jobs key and move job to different folder

* Update job to set user manually and pass in updated_by

* moved method definition validate_claim_code into ClaimLabelChange class

* fixed spacing issue

* msteele/APPEALS-45182 Fix transcription_files relationships on Hearings/LegacyHearings (#21492)

* APPEALS-45182 Reinforce has_many relationships

* APPEALS-45182 Add missing comma

* Resolve lint issue

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* fixed linting error

* fixed linting issue

* draft pr

* Hotfix/APPEALS-45218 (#21503)

* APPEALS-45218 reverted webex config arguments

* APPEALS-45218 reverted webex config arguments

* APPEALS-25218 Update WebexService to remove config in favor of individual arguments

* APPEALS-45218 Format comment

---------

Co-authored-by: msteele <Marc.Steele@va.gov>

* Wmedders21/appeals 44873 (#21469)

* add rubyzip gem

* Test: Hearings::ZipAndUploadTranscriptionFilesJob

* Feature: Hearings::ZipAndUploadTranscriptionFilesJob

* Add zip subfolder to tmp/transcription_files

* Move new gem to proper alphabetical position in list

* revert gem file changes

* update gem file with feature branch

* refactor #perform method parameters

* update parameter name

* Piedram/appeals 44897 (#21519)

* Create new Workflow transcription_packages: Step One

* add some changes

* Modified the parameters for ZipAndUploadTranscriptionFilesJob

* Modified spec test

* Update transcription_packages.rb

* remove extra blank line

---------

Co-authored-by: piedram <maite.piedrayera@va.gov>

* Wmedders21/appeals 44874 (#21512)

* add rubyzip gem

* Test: Hearings::ZipAndUploadTranscriptionFilesJob

* Feature: Hearings::ZipAndUploadTranscriptionFilesJob

* Add zip subfolder to tmp/transcription_files

* Move new gem to proper alphabetical position in list

* revert gem file changes

* update gem file with feature branch

* refactor #perform method parameters

* update parameter name

* add zip extension to valid file types

* Test: transcription file creation and upload to s3

* Hearings::ZipAndUploadTranscriptionFilesJob updates db and uploads to s3

* resolve merge conflict

* APPEALS-44876 Work order job file (#21504)

* APPEALS-44876 Work order job file

* Updated filename with work order name

* Refactored create table method and updated spec

---------

Co-authored-by: Jim Foley <james.foley4@va.gov>

* Completing AC for ticketing for styling and error portion of page. Now doing feature test

* B_reed/hotfix_APPEALS-45285 (#21531)

* APPEALS-45285 Bug Fix

* APPEALS-45285 update pexip_service_spec

* APPEALS-45285 remove white space

* Hotfix/APPEALS-45218-v2 (#21522)

* APPEALS-45218 reverted webex config arguments

* APPEALS-45218 reverted webex config arguments

* APPEALS-45218 added query argument to webex conference link

* APPEALS-45218: webex recordings endpoint correction

* APPEALS-45218 adjusted arguments during inititalizing of refresh tokens

* APPEALS-45218 fixed rspec

* APPEALS-45218: added error catching on webex service response

* APPEALS-45218: remove tested code

* APPEALS-45218 Go back to leveraging HTTPI response inherited methods

---------

Co-authored-by: Ariana Konhilas <konhilas_ariana@bah.com>
Co-authored-by: msteele <Marc.Steele@va.gov>

* added ability for user to search by css id

* added feature tests for using search bar

* reverted changes in package.json

* removed added file

* removed linting error

* msteele/APPEALS-45349 (#21539)

* APPEALS-45349 Check for error on HTTPI object, then create Webex response object and fail with specific error

* APPEALS-45349 Flip conditionals

* APPEALS-45349 Fix linting errors

* searchable by 2 characters instead of 1

* hotfix/APPEALS-45399-45401-45472 (#21555)

* APPEALS-45399-45401 Update fetch webex list and details to retrieve apikey from cred stash

* APPEALS-45399-45401 Remove CGI escape from fetch webex list job

* APPEALS-445399-45401 Update spec files for webex list and details job

* APPEALS-45399-45401 Include error handling for transcription issue mailer failed delivery

* Revert "APPEALS-45399-45401 Include error handling for transcription issue mailer failed delivery"

This reverts commit d9ce585.

* ccc

* gggg

* gggg

* Create new Workflow transcription_packages: Step Two (#21570)

* Add call function to the new job, and modified spec files

* call the jobs

* feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) (#21614)

* 🔀 Squash merge jcroteau/APPEALS-44188-fix-deprecation-warning-class-level-methods-will-no-longer-inherit-scoping

* 🔀 Squash merge jcroteau/APPEALS-44282-fix-deprecation-not-conditions-will-no-longer-behave-as-nor

* Work order file upload to AWS s3 (#21582)

* Work order file upload to AWS s3

* refactor code for upload to AWS

* refactor code for instance variables

* Revert "refactor code for instance variables"

This reverts commit b61c72a.

* code refactor for work order file

* APPEALS-44877 refactor for work order

* APPEALS-44310: add notification for unexpected task trees and update tests (#21474)

* add notification for unexpected task trees and update tests

* add slack notification to distribution errors, set default slack url in SlackService

* add tests for distributions to validate handling of errors in the ama_statistics method

* fix bad check for allowable tasks

* fix tests which were expecting a url as arg to new slack service

* fix codeclimate warning

* APPEALS-45199: Update Quality Review selection probabilities #21518

* APPEALS-44423: Remove therubyracer and jshint gems (#21443)

* APPEALS-42941 copied over Matt's work (#21624)

* APPEALS-43190 (#21448)

* APPEALS-43190 initial migration file

* APPEALS-43190 add seed data

* APPEALS-43190 add magic comment

* APPEALS-43190 move seed command

* APPEALS-43190 add bang!

* APPEALS-43190 update migration file

* APPEALS-43190 attribute name fix and updates

* APPEALS-43190 fix seed attribute

* APPEALS-43190 stubbed more seed data

* APPEALS-43190 remove seed comment

* APPEALS-43190 remove comment

* APPEALS-43190 add magic comment

* APPEALS-43190 update comments

* Wmedders21/appeals 44875 (#21605)

* Add retry logic for upload failure

* fix indentation rubocop warning

* Refactor zip job

* remove blank line

---------

Co-authored-by: Jim Foley <james.foley4@va.gov>

* akonhilas/APPEALS-43193 (#21581)

* APPEALS-43193: Add new columns and indexes to transcriptions table

* APPEALS-43193: Add new columns and indexes to transcriptions table

* APPEALS-43193: move index to own file

* APPEALS-43193: Update transcription contractor id to bigint

* APPEALS-43193: bigint

* APPEALS-43193: add fk after trancription_contractors table added

* lint error resolution (#21631)

* hotfix/APPEALS-45472 (#21562)

* APPEALS-45472 Refactor error handling for transcription

* APPEALS-45472 Include missing provider in error details for fetch recording list job and update comment for mailer

* Hotfix/APPEALS-45818 (#21632)

* APPEALS-45818: parsing fix, remove topic param, fix response

* APPEALS-45818: revert list and details job back to original state, update tests

---------

Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-44878 refactor for retry and upon success kickoff  zip file job (#21652)

* APPEALS-44878 refactor for retry and upon success kickoff  zip file job

* APPEALS-44878 refactor code

* APPEALS-44878 refactor xls path

* lint error fix

* msteele/APPEALS-45285-v2 Fix delete_conference in PexipService (#21634)

* APPEALS-45285 update ExternalApi::PexipService#delete_conference to accept virtual_hearing as the only argument

* APPEALS-45285 Update spec to use virtual_hearing

* APPEALS-45285 Linting fixes

* Piedram/appeals 45696 (#21655)

* Create new Workflow Error handling transcription_packages: Step Three related to appeals-31793

* MOdified spec file

* fix lint error

* APPEALS-45696 refactor for work_order_params

---------

Co-authored-by: Kamala Madamanchi <kamala.madamanchi@va.gov>
Co-authored-by: Jim Foley <james.foley4@va.gov>

* hotfix/APPEALS-45828 (#21625)

* APPEALS-45828 Include call to create webex conference links in base hearing update form

* APPEALS-45828 Update details feature spec to expect webex link creation on conversion from virtual

* Fix needing to reload to display co host link on details page

* Fix incorrect method name

* Remove temporary rendering of default pexip link for webex hearings after conversion

* APPEALS-45828 Fix hearing mailer spec context issues and null check for BAD_VIRTUAL_LINK_TEXT

* APPEALS-45828 Remove file name argument from fetch details job spec

* APPEALS-45828 Fail on bad hearing link if link nil or legacy link

* APPEALS-45828 Sanitize url string

* APPEALS-45828 Undo url sanitize

* Remove unused styles after merge

* Fix lint warnings

---------

Co-authored-by: HunJerBAH <Jeremy.Hunton@va.gov>
Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com>
Co-authored-by: msteele <Marc.Steele@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: IsaiahBar <isaiah.barnett@va.gov>
Co-authored-by: minhazur9 <65432922+minhazur9@users.noreply.github.com>
Co-authored-by: Will Medders <93014155+wmedders21@users.noreply.github.com>
Co-authored-by: Jim Foley <james.foley4@va.gov>
Co-authored-by: piedram <maite.piedrayera@va.gov>
Co-authored-by: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com>
Co-authored-by: breedbah <123968373+breedbah@users.noreply.github.com>
Co-authored-by: Ariana Konhilas <konhilas_ariana@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Jeff Marks <106996298+jefftmarks@users.noreply.github.com>
Co-authored-by: piedram <110848569+piedram@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com>
Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com>
Co-authored-by: Ariana Konhilas <109693628+konhilas-ariana@users.noreply.github.com>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Kamala Madamanchi <kamala.madamanchi@va.gov>
minhazur9 added a commit that referenced this pull request May 23, 2024
…-affairs/caseflow into min/APPEALS-43140

* 'min/APPEALS-43140' of github.com:department-of-veterans-affairs/caseflow: (57 commits)
  APPEALS-45503 created table for transcription_packages (#21685)
  Wmedders21/appeals 43231 (#21670)
  Remove unused styles after merge
  hotfix/APPEALS-45828 (#21625)
  Piedram/appeals 45696 (#21655)
  msteele/APPEALS-45285-v2 Fix delete_conference in PexipService (#21634)
  APPEALS-44878 refactor for retry and upon success kickoff  zip file job (#21652)
  Hotfix/APPEALS-45818 (#21632)
  hotfix/APPEALS-45472 (#21562)
  lint error resolution (#21631)
  APPEALS-42941 copied over Matt's work (#21624)
  APPEALS-44423: Remove therubyracer and jshint gems (#21443)
  APPEALS-45199: Update Quality Review selection probabilities #21518
  APPEALS-44310: add notification for unexpected task trees and update tests (#21474)
  feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) (#21614)
  Added a customizable per page task limitation attribute to QueueTab that is used by task_pager to allow an adjustable maximum number of tasks per tab. (#21594)
  gggg
  gggg
  ccc
  hotfix/APPEALS-45399-45401-45472 (#21555)
  ...
Rnmarshall93 pushed a commit that referenced this pull request Jun 3, 2024
…e) (#21614)

* 🔀 Squash merge jcroteau/APPEALS-44188-fix-deprecation-warning-class-level-methods-will-no-longer-inherit-scoping

* 🔀 Squash merge jcroteau/APPEALS-44282-fix-deprecation-not-conditions-will-no-longer-behave-as-nor
mchbidwell pushed a commit that referenced this pull request Jun 14, 2024
* added saftey opperator and removed outdated date check

* removed leftover method that was breaking and unused.

* removed legacy appeal date check for MST on special issue list

* updated mst and pact badges to check decisions in flight (if any) then appeal model.

* removed bypass for special issue list for pact toggle for AMA.

* updated rake and seed comments

* allowed special issues page tracking for AMA MST issues when pact is enabled

* remove code changes causing cancel to progress forward

* moved method definition validate_claim_code into ClaimLabelChange class

* fixed spacing issue

* fixed linting error

* fixed linting issue

* draft pr

* Completing AC for ticketing for styling and error portion of page. Now doing feature test

* added ability for user to search by css id

* added feature tests for using search bar

* reverted changes in package.json

* removed added file

* removed linting error

* searchable by 2 characters instead of 1

* ccc

* gggg

* gggg

* feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) (#21614)

* 🔀 Squash merge jcroteau/APPEALS-44188-fix-deprecation-warning-class-level-methods-will-no-longer-inherit-scoping

* 🔀 Squash merge jcroteau/APPEALS-44282-fix-deprecation-not-conditions-will-no-longer-behave-as-nor

* APPEALS-44310: add notification for unexpected task trees and update tests (#21474)

* add notification for unexpected task trees and update tests

* add slack notification to distribution errors, set default slack url in SlackService

* add tests for distributions to validate handling of errors in the ama_statistics method

* fix bad check for allowable tasks

* fix tests which were expecting a url as arg to new slack service

* fix codeclimate warning

* APPEALS-45199: Update Quality Review selection probabilities #21518

* APPEALS-44423: Remove therubyracer and jshint gems (#21443)

* APPEALS-42941 copied over Matt's work (#21624)

* lint error resolution (#21631)

* Feature/appeals 46208.rc (#21746)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Ricky/appeals-43523 (#21345)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Added Download Ineligible Judge List

* APPEALS-43116 add sentry error capture to push priority job and updated specs (#21369)

* Updated query to include css_id and updated id fetch

* Updates button styling, fixed csv to have all values but judge name

* Updated id to sattyid values, and added name data to column

* fixed linting error

* Updated logic to account for inactive users in both caseflow and vacols

* Updated button component and cleaned up code

* Updated handling of ids in situation where sattyid is unavailable in record

* Updated to have individual columns for caseflow id and satty id

* APPEALS-43117 Add QA Users for testing (#21580)

* APPEALS-43117 Add QA Users for testing

* Fix rspecs

---------

Co-authored-by: Christopher Detlef <>

* APPEALS-42266 Remove CaseDistributionLevers seed config in Rails helper and update required spec files

* APPEALS-42266 fixing a couple of linting issues

* APPEALS-43523 reverted the legacy tasks controller (#21713)

* APPEALS-43523 reverted the legacy tasks controller

* APPEALS-43523 reverted the erorrs concern too

* Update legacy_tasks_controller_spec.rb

* reverted raven call

* APPEALS-46208 fixed code climate warning about a bad naming convention.

* APPEALS-46208 fixed indentation

---------

Co-authored-by: 631068 <rickybmanus@gmail.com>
Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com>
Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com>
Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com>
Co-authored-by: kristeja <krishnateja.golla@va.gov>

* APPEALS-44148: Add ruby CE API Gem (#21520)

* hotfix/APPEALS-46182 (#21709)

* Added tests and added logic to account for sct distribution

* Added more tests and changed logic

* Adding comments

* Fixing logic for SCT

* Update test and logic

* Fixing tests

* Update docket switch mail task to match corrected logic

* Fixing logic

* Cleaning up refactor

* Worked with the amazing ALex and we figured it out!

* Fixing linting issue

* Fix linting issues

* Skipping flaky tests

* Skipping another flaky test

---------

Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* MattT/APPEALS-46383: Upgrade aws-sdk gem to v3.2 (#21748)

* Upgrade aws-sdk gem to v3.2

* Update caseflow-commons hash

* Apply new hash update

* Skip flaky test

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Update gemfile and gemfile.lock to point to new bgs version (#21749)

* Update gemfile and gemfile.lock to point to new bgs version

* Skipping flake specs in review_spec.rb file

* Revert "APPEALS-44148: Add ruby CE API Gem (#21520)" (#21762)

This reverts commit 3a393d1.

* Update ruby-bgs gemfile and gemfile.lock to new version (#21761)

* Update MAC_INTEL.md

Update Oracle client link

* Resolved merge conflicts

* Call patch with updateContractor

* Progress with linking EditModal to Edit Contractor link

* Updated Edit contractor link details

* Edit Modal working with link and persisting changes

* Add rendering test to check for Edit contractor modal

* Fix styling and update copy

* Fix linting issues

* Update snapshot and fix linting issue

---------

Co-authored-by: HunJerBAH <Jeremy.Hunton@va.gov>
Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: IsaiahBar <isaiah.barnett@va.gov>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com>
Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: 631068 <rickybmanus@gmail.com>
Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com>
Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com>
Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com>
Co-authored-by: kristeja <krishnateja.golla@va.gov>
Co-authored-by: youfoundmanesh <129548081+youfoundmanesh@users.noreply.github.com>
Co-authored-by: Alex Ferencz VA <156860944+aferencz1987VA@users.noreply.github.com>
Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Alec Spottswood <ajspottswood@gmail.com>
mchbidwell pushed a commit that referenced this pull request Jul 2, 2024
* added saftey opperator and removed outdated date check

* removed leftover method that was breaking and unused.

* removed legacy appeal date check for MST on special issue list

* updated mst and pact badges to check decisions in flight (if any) then appeal model.

* removed bypass for special issue list for pact toggle for AMA.

* updated rake and seed comments

* allowed special issues page tracking for AMA MST issues when pact is enabled

* remove code changes causing cancel to progress forward

* moved method definition validate_claim_code into ClaimLabelChange class

* fixed spacing issue

* fixed linting error

* fixed linting issue

* draft pr

* Completing AC for ticketing for styling and error portion of page. Now doing feature test

* added ability for user to search by css id

* added feature tests for using search bar

* reverted changes in package.json

* removed added file

* removed linting error

* searchable by 2 characters instead of 1

* ccc

* gggg

* gggg

* feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) (#21614)

* 🔀 Squash merge jcroteau/APPEALS-44188-fix-deprecation-warning-class-level-methods-will-no-longer-inherit-scoping

* 🔀 Squash merge jcroteau/APPEALS-44282-fix-deprecation-not-conditions-will-no-longer-behave-as-nor

* APPEALS-44310: add notification for unexpected task trees and update tests (#21474)

* add notification for unexpected task trees and update tests

* add slack notification to distribution errors, set default slack url in SlackService

* add tests for distributions to validate handling of errors in the ama_statistics method

* fix bad check for allowable tasks

* fix tests which were expecting a url as arg to new slack service

* fix codeclimate warning

* APPEALS-45199: Update Quality Review selection probabilities #21518

* APPEALS-44423: Remove therubyracer and jshint gems (#21443)

* APPEALS-42941 copied over Matt's work (#21624)

* lint error resolution (#21631)

* Feature/appeals 46208.rc (#21746)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Ricky/appeals-43523 (#21345)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Added Download Ineligible Judge List

* APPEALS-43116 add sentry error capture to push priority job and updated specs (#21369)

* Updated query to include css_id and updated id fetch

* Updates button styling, fixed csv to have all values but judge name

* Updated id to sattyid values, and added name data to column

* fixed linting error

* Updated logic to account for inactive users in both caseflow and vacols

* Updated button component and cleaned up code

* Updated handling of ids in situation where sattyid is unavailable in record

* Updated to have individual columns for caseflow id and satty id

* APPEALS-43117 Add QA Users for testing (#21580)

* APPEALS-43117 Add QA Users for testing

* Fix rspecs

---------

Co-authored-by: Christopher Detlef <>

* APPEALS-42266 Remove CaseDistributionLevers seed config in Rails helper and update required spec files

* APPEALS-42266 fixing a couple of linting issues

* APPEALS-43523 reverted the legacy tasks controller (#21713)

* APPEALS-43523 reverted the legacy tasks controller

* APPEALS-43523 reverted the erorrs concern too

* Update legacy_tasks_controller_spec.rb

* reverted raven call

* APPEALS-46208 fixed code climate warning about a bad naming convention.

* APPEALS-46208 fixed indentation

---------

Co-authored-by: 631068 <rickybmanus@gmail.com>
Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com>
Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com>
Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com>
Co-authored-by: kristeja <krishnateja.golla@va.gov>

* APPEALS-44148: Add ruby CE API Gem (#21520)

* hotfix/APPEALS-46182 (#21709)

* Added tests and added logic to account for sct distribution

* Added more tests and changed logic

* Adding comments

* Fixing logic for SCT

* Update test and logic

* Fixing tests

* Update docket switch mail task to match corrected logic

* Fixing logic

* Cleaning up refactor

* Worked with the amazing ALex and we figured it out!

* Fixing linting issue

* Fix linting issues

* Skipping flaky tests

* Skipping another flaky test

---------

Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* MattT/APPEALS-46383: Upgrade aws-sdk gem to v3.2 (#21748)

* Upgrade aws-sdk gem to v3.2

* Update caseflow-commons hash

* Apply new hash update

* Skip flaky test

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Update gemfile and gemfile.lock to point to new bgs version (#21749)

* Update gemfile and gemfile.lock to point to new bgs version

* Skipping flake specs in review_spec.rb file

* Revert "APPEALS-44148: Add ruby CE API Gem (#21520)" (#21762)

This reverts commit 3a393d1f3f40b35b5063c2b7d0f1508ef5a61bb7.

* Update ruby-bgs gemfile and gemfile.lock to new version (#21761)

* Update MAC_INTEL.md

Update Oracle client link

* Resolved merge conflicts

* APPEALS-44496 Fix Factory (#21770)

* APPEALS-44496 Fix Factory

* updated falky test

---------

Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* fix(va facilities): update per page param (#21754)

* Hotfix/appeals 44033:Fix Judge and Attorney tasks in the QualityReview workflow are being erroneously cancelled  (#21786)

* Adjusts the send_to_hearings_branch method to exclude JudgeQualityReviews when cancelling all Judge tasks and subtasks
rebase

* adjusts spacing and adds back deleted test

* Remove unnecessary schema changes and adds an exclamation mark to account for method that changes data

* add exclamation to handle_judge_tasks

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* Hotfix/appeals 45150 (#21627)

* Added distribution task with children status change on split appeal test

* Added tests and commented out pry session in appeal

* Changed split appeal test to test for both defects

* Added  conditional logic to status_is_valid_on_create in task model

* looking for defect

* Reverted changes to finalize split appeal method added condtional logic to schedule hearing tasks model

* Removed debugger and commented out lines

* Added erroneously removed lines of code and added spacing

* Fix linting errors

* Added conditional logic for appeal split process

---------

Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* hotfix/APPEALS-36313-V2 (#21782)

* avoid IHP task creation with an open pre-docket task

* Fix linting errors on RSpec

* Skip flaky BGS Share Error test

* comment failed test case

---------

Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>

* APPEALS-47106 Caseflow Swagger (#21847)

* Add Rswag and convert existing API documentation (#21778)

* add rswag

* Update Gemfile.lock

* Setup yaml UI

* remove and reroute old swagger files

* update format and servers values

* Update route_docs_controller.rb

* Update cmp_controller.rb

* cmp endpoint yaml

* cmp endpoint to return 501

* CMP endpoint swagger flies

* update swagger files

* adjust server order, add auth token

* cmp parameter name change

* add comments

* Update users_controller.rb

* unit tests and linting

* lint fixes

* Update swagger_helper.rb

* skip flakey tests

* Update appeal_notifications_page_spec.rb

* Hotfix/appeals 36313 v2 (#21858)

* avoid IHP task creation with an open pre-docket task

* Fix linting errors on RSpec

* Skip flaky BGS Share Error test

* comment failed test case

* Add predocket coverage for IHP task creation when POA is updated

* adjust predocketed from active status to open to include on_hold status

* Remove commented out data staging for bgs POA rspec test

---------

Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>

* feature/appeals-43220 (#21862)

* Adding 403 and 404 functionality to Reader.

* Adding icon to button.

* Fixing linting issues.

* Using the Link component and moving href into constant

* fix linter issues

---------

Co-authored-by: Brian Bommarito <brian@bommarito.me>

* feature/appeals-39842 (#21864)

* anusha/appeals-45976 (#21738)

* Change address format

* added rspec tests to cover hotfix

* testing for inclusion of expected values (addressLine1, etc.)

* rspec test -- wip

* still WIP

* Fix address tests.

* updated fakes

* Update internationalPostalCode

* appeals controller spec update

* http request changed and test

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Lauren Berry <berry_lauren@bah.com>

* lauren/APPEALS-39842 (#21739)

* Add scroll metrics start time fix and update metric message

* Add metrics attributes json in PdfPage constructor and add isPageVisible metric attribute

* Fix scroll message spacing

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* noelle/appeals-39842 (#21740)

* Remove UUID from attrs sent_to metrics.

* Remove UUID from spec

* remove uuid from update_appellant job

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>

* fix failing tests

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Lauren Berry <berry_lauren@bah.com>
Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* APPEALS-44916: Case Distribution Affinity Calculations (#21666)

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fix migration for null affinity start date column

* fixes, added tests

* more test updates

* add return in job if no query results, tests for no query results

* add test for after_save hook adding dist task instructions

* set start dist job to queue affinity job after running

* fix update job and start dist job spec

* queue affinity update job from push job

* code clarity

* fix judge in seed file

* remove comment, fix hearing factory, disable some seeds for testing

* add more tests

* test refactor

* update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory

* disable new seed on reset

* update seed file with vet names, add another seed category

* fix distirbuted case factory?

* actually fix GHA runs

* lint, test fixes

* change constants in new job

* APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611)

* swap distribution queries from distribution_task to appeal_affinities

* update seed files to use appeal affinities instead of distribution task

* clean up seed file method names

* add missing Timecop.return in ama affinity case seed

* fix name of a method in a seed file

* remove references to distribution task in distribution scopes

* fix push priority job tests

* fix naming of args in one of the seed files

* fix user seed, fix date format in distribution task instructions

* fix tests for date format update

* Calvin/APPEALS-44957-rake-affinity (#21577)

* grabbed receipt dates from distributed cases

* refactored for functionality + added method to grab appeals that match

* using receipt date, get all related appeals

* added update/creation plus cleaned prior imple.

* gets most recent distributed case receipt_date

* skips if receipt_date is nil for performance

* if appeal affinity is nil, it will now be updated

* created spec file

* fixed non ready appeals

* updated query to match new AC

* removing comment

* testing for each docket

* updated spec file

* added new tests to rspec

* updated start date to receipt date instead of Time.now

* fixed date/time rspec errors

* added rails logger to know when rake task has finished

* added tag for rails log

* removed nonpriority dockets for direct_review and evidence_submission

* fixed lint issue

* fixed flaky spec test

* limits distributed cases query to within the last week

* APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660)

* add affinity start date to explain page

* add feature test to verify dates display

* update rake task and spec (#21731)

* APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730)

* add aod hearing cases to ama affinity cases seed

* fix lever spec

* APPEALS-45148: Hook to clear saved affinity date (#21623)

* initial imp. idea

* AC1: check for affinity_start_date on assignment

* AC2/3: update affinity start date  w/ instr.

* updates to naming, instructions, and hook logic

* updates after review

* rspec coverage and addtional condition

* removed unused identifier

* removed reduntant 'self's

* added update on actual AA record

* updated to save aa record and addtional rspec

* added change to assignment on no record test

* check for assignment

* addd update to 'on_hold' status

* public method to handle legacy affinity appeals

* added .reload to :with_affinity_appeal

* added .reload to :ready_for_distribution

* updates to pass explain_spec

* switched boolean values

* typo

* readujsted order on :create for affinity appeal

* removed after(:create)

* testing rspec by readding after :create

* reloading in assertation

* addressing lint errors

* fix seeds/users_spec

* add case dist lever to new tests (#21776)

* remove unnecessarily included module from job (#21827)

* APPEALS-47211: Improve Performance of Distribution Queries (#21840)

* rework ready_for_distribution scope

* fix non-hearing docket distribution bug

* restart tests

---------

Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>
Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>

* APPEALS-46540: Reduce time to deploy demo environments (#21791)

* APPEALS-42710: Modify local/demo seed data so that not all seed files need to be run when resetting/deploying (#21743)

* refactor users to use factories and create singletons

* code quality, reduce counts

* refactor substitutions

* refactor veterans health administration seed

* refactor MTV

* move education orgs to users seed

* move intake users to users seed, comment non-required seed files

* add veterans seed file from Sean's branch

* fix errors

* add hearing prep role to judges

* add optional seed file

* add optional seed file and button to run it in demo

* lint, specs

* remove priority dist from optional, test fix

* fix tests

* Disable repeated conditional in Test::UsersController

* feature/APPEALS-43597 RC (#21860)

* APPEALS-36759 Add sms_response_content and sms_response_time notifications table

* APPEALS-37003 First pass at job refactor

* APPEALS-37003 Add comments and update kwargs for va notify service

* APPEALS-37003 Update spec files

* APPEALS-37003 Update spec

* APPEALS-37003 Ensure user in job and create email_enabled method

* APPEALS-37003 Remove question mark

* Limit max retry attempts to 5

* Add ? to boolen return methods

* jcohen/APPEALS-43706 (#21444)

* APPEALS-43706 macros added to each model file for the polymorphic relationship to be setup.

* APPEALS-43706 migration made and yet to be run.

* APPEALS-43706 migrations ran and expected columns and indexes are in table.

* Fix some spec failures unrelated to this branch

* Limit schema diff

* Add a missing tab

* Fix more unrelated failures. Also prevent ACD lever seeds from overwriting spec output

* Fix last unrelated failure.

* APPEALS-43706 linting issues in va_notify_service fixed.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* [APPEALS-43598] Quarterly Notification Job refactoring (#21505)

* Quarterly Notification Job refactoring

* APPEALS-43598 Fix lint issues for QuarterlyNotificationsJob refactor

* APPEALS-43598 Fix db schema.rb file

* APPEALS-43598 Fix schema.rb file

* APPEALS-43598 Refactoring QuarterlyNotificationsJob for readability

* APPEALS-43598 Refactoring QuarterlyNotificationsJob and removing extra methods

* [APPEALS-43598] Update method name

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-44007: Eliminate Transmission of Notifications to Deceased Veterans (#21481)

* APPEALS-44007: Writing tests to ensure adding the 'failure due to deceased' information is properly set and added to the db

* updates to pr

* pushing changes for tonight

* updating spec file to handle enabling and disabling feature flags

* Update format_message_status

* Lint roll

* fixing conflicts

* Updates to send notification spec

* Fix one of the legacy test cases

* Remove accidental push

* Fix remaining test

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-45235: Remove Temporary PDF Files From tmp Directory After All eFolder Upload Attempts (#21557)

* Cleanup files after uploading to VBMS

* Only delete file if it exists

* Resolve linter issue

* Update specs

* Trigger CodeClimate

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Add appeal alias for notifiable

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications (#21575)

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications

* fixing some errors

* updating factory

* updating tests

* updating tests and factory

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-43596 Adding JobMessageDeletionMiddleware to delete SQS messages for certain jobs

* APPEALS-43596 Adding tests

* APPEALS-43596 Fix codeclimate

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables (#21596)

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables

* pushing changes

* updating tests

* rubocop

* rubocop'n

* deleting repeat constants

* removing file in favor of EVENT_TYPE_FILTERS.json

* removing instances of using VA_NOTIFY_TEMPLATE_NAMES and using EVENT_TYPE_FILTERS instead

* replacing all instances of strings with constants

* fixing bug

* rubocop'n

* rubocop'n

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Clean notification_events after notification report specs finish (#21662)

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-43725: Extract `notify_appellant` Call from `QuaterlyNotificationsJob` to Decrease Runtime (#21643)

* Group notification types as scopes

* Add new job

* Fix typo

* Add back batching

* Batch send messages

* Multithread job queueing

* Reconfigure bulk enqueueing to utilize send_notifications.fifo queue

* Update the comment on QuaterlyNotificationsJob#perform

to adhere to the RDoc standard

* Use constants for template name

* Provide a more descriptive var name

* Remove unused env var

* Fix linting issues

* Prevent error from being thrown early in init job

* Add RDoc comments to appeal_state

* Add rdoc comment to init job

* Add another rdoc comment to the init job

* Use a more specific error class whenever an appeal

cannot be located within the init job

* Add a more specific error to CaseflowJob#enqueue_batch_of_jobs

* Add test for SendNotificationJob.queue_name_suffix

* Update QuarterlyNotificationsJob tests

* Update appeal_state_spec.rb to cover new scopes

* Add spec file for NotificationInitializationJob

* Add CaseflowJob specs

* Add CaseflowJob specs

* Address rubocop issue (by ignoring it)

* Kicking off CodeClimate

* Fix some lint issues

* Freeze constant

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Move spec file to proper location

* APPEALS-43599 (#21696)

* APPEALS-43599 Refactoring SendNotificationJob

* APPEALS-43599 Remove comments

* APPEALS-43599 Suppress code smells from reek

* APPEALS-43599 Suppress code smells from reek

* jcohen/APPEALS-43727 (#21589)

* APPEALS-43727 Branch created. Extracted all the 'when' conditions in the case statement within appellant_notification.rb update_appeal_state method.

* APPEALS-43727 appellant_notification_service is created, logic from crowded method in appellant_notificaion.rb placed in newly created file, allowing redability.

* APPEALS-43727 added logic to appeal_state.rb, appellant_notification.rb updated with less logic, readable code through well named methods.

* APPEALS-43727 commit before merge from teammates work

* APPEALS-43727 removed freeze method on default status hash in appeal_state.rb. removed some rubocop disabling in appellant_notificaion.rb

* APPEALS-43727 extracted more logic from the appellant_notification module and placed it into the appeal_state class. Also got rid of rubocop declarations in app_notif and app_state as well. finally removed feature_toggle calls in appell_notif.

* APPEALS-43727 tests passing, code works

* APPEALS-43727 adding tests to appeal_state_spec to test functionality

* APPEALS-43727 rspec tests in appeal_state.

* APPEALS-43727 tests pass.

* Fixing code climate duplicate code issue

* fixing case statement

* code climate things

* rubocop

* APPEALS-43727 work completed.

* APPEALS-43727 PR comments applied. tests not in a working state.

* APPEALS-43727 PR comments applied. appeal_state_spec in working state.

* APPEALS-43727 PR comments applied. appellant_notification_spec.rb all green.

* Adjust spacing of comments in appeal_state.rb

* Utilize #external_id method over ternary

* Swap or conditional for blank?

* Fix another whitespace gap

* APPEALS-43727 PR comments applied. again after reset.

* APPEALS-43727 PR comments applied. flipped conditionals in appeal_state.rb

* Update app/models/concerns/appeal_concern.rb

* APPEALS-43727 code/test edits

* APPEALS-43727 bulk_task_reasssignment_spec reverted to orginal state, with the exception of an expectation that was on line 98

* APPEALS-43727 lint fix

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-46179 (#21712)

* APPEALS-46179 Create JobExecutionTimes table

* APPEALS-46179 Add comment

* APPEALS-46179 Update schema

* APPEALS-46193 (#21753)

* APPEALS-46193 Add record to JobExecutionTime table when job is performed

* APPEALS-46193 Updating JobExecutionTimes table with an upsert query

* APPEALS-46193 Ignore JobExecutionTimes for certain jobs

* APPEALS-46193 Update ignore_job_execution_time? method

* APPEALS-46193 Adding tests

* Fix lint issues

* Update AWS dependencies

* Rollback gem reduction due to UAT issue

* Alter queue priority

* Forward error in SendNotificationJob

* Allow for notification audit records to remain in ProdTest

* Fix spec

* Fix typo in test fixture's name

* Fix lint infraction related to re-raising exceptions

* Address duplication CC error

* Reenable-privacy-mail-notifications (#21859)

* Add conditional for FOIA and Privacy Act mail

task to receives 'Privacy Act Pending' notifications

* Update spec

* Adjust some specs

* Add missing param

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Remove byebug from spec

* Revert queue adjustment

* Remove unused method

---------

Co-authored-by: Jeff Marks <jeff.t.marks@gmail.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com>
Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Prerna Devulapalli <prerna.devulapalli@va.gov>

* feature/appeals-39842.1 (#21871)

* Fix PdfFile test

* Delete client/app/readerprototype/components/ReaderDocument.jsx (#21870)

Delete empty ReaderDocument file

* Fix lint issue in PdfFile (#21873)

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Revert "APPEALS-44916: Case Distribution Affinity Calculations (#21666)" (#21888)

* Revert "APPEALS-44916: Case Distribution Affinity Calculations (#21666)"

This reverts commit 7aa04e6713759c3212820a78aa6500863dd7f91a.

* fix users seed spec

* Revert "feature/APPEALS-43597 RC (#21860)" (#21895)

This reverts commit df60ddb567c3e02556e85ba37d555768d3a0de7e.

* Revert "APPEALS-47106 Caseflow Swagger (#21847)" (#21901)

This reverts commit c3bc5012618d614c3d017ae0f260a91c6d4aebec.

* sbashamoni/APPEALS-43724 Node 16 version upgrade changes (#21966) (#21975)

* Update node verstion to 16 in git workflow

* Update node verstion to 16 in nvm and dockerfile for demo

* Update node version in yarn.lock and package.json and .nvmrc file

* Update node's version path to node16 in docker-bin/env.sh

* Update and upgrade to node16 in client

* More updates to yarn.lock and package.json

* Fix tests by Adam Shaw

* Upadate snapshot for ScheduleVeteran.test.js.snap

* Doing some code clean up

* Doiing some more clean up

* Add and remove spaces to match master

* One more space to take care of

* One more space to take care of again

* One more space to take care of again

---------

Co-authored-by: ramon-chavez <Ramon.Chavez@va.gov>

* APPEALS-47277 remove Vegas office (#21876)

* APPEALS-47277 remove Vagas office

* Removed Texas ID from other files and updated tests

* Snapshot update

---------

Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* hotfix/APPEALS-22403 (#21942)

* add identifier for filenumber or ssn in filenumber search

* linting

* codeclimate linting

* update match call to return boolean

---------

Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* APPEALS-46907: Update to Determination of Gen Pop Legacy Cases (#21986)

* Isaiah/merge 46910 (#21983)

* removed BFHINES checks and modified tests

* removed lingering bfhines test

* modified test

* most recent updates on tests for passing status

* removed refs to cavc updates

* Skip flaky test ro_viewhearsched_spec

---------

Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>

* APPEALS-44916: Case Distribution Affinity Calculations (#21899)

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fix migration for null affinity start date column

* fixes, added tests

* more test updates

* add return in job if no query results, tests for no query results

* add test for after_save hook adding dist task instructions

* set start dist job to queue affinity job after running

* fix update job and start dist job spec

* queue affinity update job from push job

* code clarity

* fix judge in seed file

* remove comment, fix hearing factory, disable some seeds for testing

* add more tests

* test refactor

* update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory

* disable new seed on reset

* update seed file with vet names, add another seed category

* fix distirbuted case factory?

* actually fix GHA runs

* lint, test fixes

* change constants in new job

* APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611)

* swap distribution queries from distribution_task to appeal_affinities

* update seed files to use appeal affinities instead of distribution task

* clean up seed file method names

* add missing Timecop.return in ama affinity case seed

* fix name of a method in a seed file

* remove references to distribution task in distribution scopes

* fix push priority job tests

* fix naming of args in one of the seed files

* fix user seed, fix date format in distribution task instructions

* fix tests for date format update

* Calvin/APPEALS-44957-rake-affinity (#21577)

* grabbed receipt dates from distributed cases

* refactored for functionality + added method to grab appeals that match

* using receipt date, get all related appeals

* added update/creation plus cleaned prior imple.

* gets most recent distributed case receipt_date

* skips if receipt_date is nil for performance

* if appeal affinity is nil, it will now be updated

* created spec file

* fixed non ready appeals

* updated query to match new AC

* removing comment

* testing for each docket

* updated spec file

* added new tests to rspec

* updated start date to receipt date instead of Time.now

* fixed date/time rspec errors

* added rails logger to know when rake task has finished

* added tag for rails log

* removed nonpriority dockets for direct_review and evidence_submission

* fixed lint issue

* fixed flaky spec test

* limits distributed cases query to within the last week

* APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660)

* add affinity start date to explain page

* add feature test to verify dates display

* update rake task and spec (#21731)

* APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730)

* add aod hearing cases to ama affinity cases seed

* fix lever spec

* APPEALS-45148: Hook to clear saved affinity date (#21623)

* initial imp. idea

* AC1: check for affinity_start_date on assignment

* AC2/3: update affinity start date  w/ instr.

* updates to naming, instructions, and hook logic

* updates after review

* rspec coverage and addtional condition

* removed unused identifier

* removed reduntant 'self's

* added update on actual AA record

* updated to save aa record and addtional rspec

* added change to assignment on no record test

* check for assignment

* addd update to 'on_hold' status

* public method to handle legacy affinity appeals

* added .reload to :with_affinity_appeal

* added .reload to :ready_for_distribution

* updates to pass explain_spec

* switched boolean values

* typo

* readujsted order on :create for affinity appeal

* removed after(:create)

* testing rspec by readding after :create

* reloading in assertation

* addressing lint errors

* fix seeds/users_spec

* add case dist lever to new tests (#21776)

* remove unnecessarily included module from job (#21827)

* APPEALS-47211: Improve Performance of Distribution Queries (#21840)

* rework ready_for_distribution scope

* fix non-hearing docket distribution bug

* restart tests

* added null checks for appeal affinity in distribution queries, update tests (#21893)

* add check for appeal being active to distribution and associated slack message (#21902)

* Update users_spec.rb

---------

Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>
Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>

* hotfix/APPEALS-45177: TaskTable Default Sorting Fix (#21772)

* Updated the TaskTable component to use the defaultSort property instead of the defaultSortIdx property for queue table since that property is not used anywhere. Added a default sorting hash to the UnassignedCasesPage component and now pass that down to TaskTable. Removed references to defaultSortIdx.

* Added the type column default sort to the AssignedCasesPage widget as well.

* Added a parenthesis for clarity around a boolean. Moved the defaultSortingHash out into a constants file.

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* APPEALS-47106 Caseflow Swagger (#21993)

* Add Rswag and convert existing API documentation (#21778)

* add rswag

* Update Gemfile.lock

* Setup yaml UI

* remove and reroute old swagger files

* update format and servers values

* Update route_docs_controller.rb

* Update cmp_controller.rb

* cmp endpoint yaml

* cmp endpoint to return 501

* CMP endpoint swagger flies

* update swagger files

* adjust server order, add auth token

* cmp parameter name change

* add comments

* Update users_controller.rb

* unit tests and linting

* lint fixes

* Update swagger_helper.rb

* APPEALS-48048 Swagger Updates (#21909)

* update servers to not include a host

* remove host for server

* remove generated swaggers from definitions

* remove internal API endpoints from having generated swagger

* IDT servers fixes

* disable CMP swagger in prod and prodtest

* set authorization correctly

* fix what is required for CMP upload

* fix linting issues, update lint rake task to autocorrect for rubocop, add rubocop make command

* Update decision_reviews.yaml

* Update ama_issues.yaml

* Update vacols_issues.yaml

* Update swagger.yaml

* fix check failures

* Update docs_controller_spec.rb

* fix unit tests

* Update fetch_all_active_legacy_appeals_job_spec.rb

* Update rswag_ui.rb

* Update lint.rake

* Update decision_reviews_spec.rb

* Update fetch_all_active_legacy_appeals_job_spec.rb

* Update veterans_controller_spec.rb

* feature/APPEALS-43597 RC1.5.1 (#21996)

* APPEALS-36759 Add sms_response_content and sms_response_time notifications table

* APPEALS-37003 First pass at job refactor

* APPEALS-37003 Add comments and update kwargs for va notify service

* APPEALS-37003 Update spec files

* APPEALS-37003 Update spec

* APPEALS-37003 Ensure user in job and create email_enabled method

* APPEALS-37003 Remove question mark

* Limit max retry attempts to 5

* Add ? to boolen return methods

* jcohen/APPEALS-43706 (#21444)

* APPEALS-43706 macros added to each model file for the polymorphic relationship to be setup.

* APPEALS-43706 migration made and yet to be run.

* APPEALS-43706 migrations ran and expected columns and indexes are in table.

* Fix some spec failures unrelated to this branch

* Limit schema diff

* Add a missing tab

* Fix more unrelated failures. Also prevent ACD lever seeds from overwriting spec output

* Fix last unrelated failure.

* APPEALS-43706 linting issues in va_notify_service fixed.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* [APPEALS-43598] Quarterly Notification Job refactoring (#21505)

* Quarterly Notification Job refactoring

* APPEALS-43598 Fix lint issues for QuarterlyNotificationsJob refactor

* APPEALS-43598 Fix db schema.rb file

* APPEALS-43598 Fix schema.rb file

* APPEALS-43598 Refactoring QuarterlyNotificationsJob for readability

* APPEALS-43598 Refactoring QuarterlyNotificationsJob and removing extra methods

* [APPEALS-43598] Update method name

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-44007: Eliminate Transmission of Notifications to Deceased Veterans (#21481)

* APPEALS-44007: Writing tests to ensure adding the 'failure due to deceased' information is properly set and added to the db

* updates to pr

* pushing changes for tonight

* updating spec file to handle enabling and disabling feature flags

* Update format_message_status

* Lint roll

* fixing conflicts

* Updates to send notification spec

* Fix one of the legacy test cases

* Remove accidental push

* Fix remaining test

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-45235: Remove Temporary PDF Files From tmp Directory After All eFolder Upload Attempts (#21557)

* Cleanup files after uploading to VBMS

* Only delete file if it exists

* Resolve linter issue

* Update specs

* Trigger CodeClimate

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Add appeal alias for notifiable

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications (#21575)

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications

* fixing some errors

* updating factory

* updating tests

* updating tests and factory

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-43596 Adding JobMessageDeletionMiddleware to delete SQS messages for certain jobs

* APPEALS-43596 Adding tests

* APPEALS-43596 Fix codeclimate

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables (#21596)

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables

* pushing changes

* updating tests

* rubocop

* rubocop'n

* deleting repeat constants

* removing file in favor of EVENT_TYPE_FILTERS.json

* removing instances of using VA_NOTIFY_TEMPLATE_NAMES and using EVENT_TYPE_FILTERS instead

* replacing all instances of strings with constants

* fixing bug

* rubocop'n

* rubocop'n

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Clean notification_events after notification report specs finish (#21662)

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-43725: Extract `notify_appellant` Call from `QuaterlyNotificationsJob` to Decrease Runtime (#21643)

* Group notification types as scopes

* Add new job

* Fix typo

* Add back batching

* Batch send messages

* Multithread job queueing

* Reconfigure bulk enqueueing to utilize send_notifications.fifo queue

* Update the comment on QuaterlyNotificationsJob#perform

to adhere to the RDoc standard

* Use constants for template name

* Provide a more descriptive var name

* Remove unused env var

* Fix linting issues

* Prevent error from being thrown early in init job

* Add RDoc comments to appeal_state

* Add rdoc comment to init job

* Add another rdoc comment to the init job

* Use a more specific error class whenever an appeal

cannot be located within the init job

* Add a more specific error to CaseflowJob#enqueue_batch_of_jobs

* Add test for SendNotificationJob.queue_name_suffix

* Update QuarterlyNotificationsJob tests

* Update appeal_state_spec.rb to cover new scopes

* Add spec file for NotificationInitializationJob

* Add CaseflowJob specs

* Add CaseflowJob specs

* Address rubocop issue (by ignoring it)

* Kicking off CodeClimate

* Fix some lint issues

* Freeze constant

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Move spec file to proper location

* APPEALS-43599 (#21696)

* APPEALS-43599 Refactoring SendNotificationJob

* APPEALS-43599 Remove comments

* APPEALS-43599 Suppress code smells from reek

* APPEALS-43599 Suppress code smells from reek

* jcohen/APPEALS-43727 (#21589)

* APPEALS-43727 Branch created. Extracted all the 'when' conditions in the case statement within appellant_notification.rb update_appeal_state method.

* APPEALS-43727 appellant_notification_service is created, logic from crowded method in appellant_notificaion.rb placed in newly created file, allowing redability.

* APPEALS-43727 added logic to appeal_state.rb, appellant_notification.rb updated with less logic, readable code through well named methods.

* APPEALS-43727 commit before merge from teammates work

* APPEALS-43727 removed freeze method on default status hash in appeal_state.rb. removed some rubocop disabling in appellant_notificaion.rb

* APPEALS-43727 extracted more logic from the appellant_notification module and placed it into the appeal_state class. Also got rid of rubocop declarations in app_notif and app_state as well. finally removed feature_toggle calls in appell_notif.

* APPEALS-43727 tests passing, code works

* APPEALS-43727 adding tests to appeal_state_spec to test functionality

* APPEALS-43727 rspec tests in appeal_state.

* APPEALS-43727 tests pass.

* Fixing code climate duplicate code issue

* fixing case statement

* code climate things

* rubocop

* APPEALS-43727 work completed.

* APPEALS-43727 PR comments applied. tests not in a working state.

* APPEALS-43727 PR comments applied. appeal_state_spec in working state.

* APPEALS-43727 PR comments applied. appellant_notification_spec.rb all green.

* Adjust spacing of comments in appeal_state.rb

* Utilize #external_id method over ternary

* Swap or conditional for blank?

* Fix another whitespace gap

* APPEALS-43727 PR comments applied. again after reset.

* APPEALS-43727 PR comments applied. flipped conditionals in appeal_state.rb

* Update app/models/concerns/appeal_concern.rb

* APPEALS-43727 code/test edits

* APPEALS-43727 bulk_task_reasssignment_spec reverted to orginal state, with the exception of an expectation that was on line 98

* APPEALS-43727 lint fix

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-46179 (#21712)

* APPEALS-46179 Create JobExecutionTimes table

* APPEALS-46179 Add comment

* APPEALS-46179 Update schema

* APPEALS-46193 (#21753)

* APPEALS-46193 Add record to JobExecutionTime table when job is performed

* APPEALS-46193 Updating JobExecutionTimes table with an upsert query

* APPEALS-46193 Ignore JobExecutionTimes for certain jobs

* APPEALS-46193 Update ignore_job_execution_time? method

* APPEALS-46193 Adding tests

* Fix lint issues

* Update AWS dependencies

* Rollback gem reduction due to UAT issue

* Alter queue priority

* Forward error in SendNotificationJob

* Allow for notification audit records to remain in ProdTest

* Fix spec

* Fix typo in test fixture's name

* Fix lint infraction related to re-raising exceptions

* Address duplication CC error

* Reenable-privacy-mail-notifications (#21859)

* Add conditional for FOIA and Privacy Act mail

task to receives 'Privacy Act Pending' notifications

* Update spec

* Adjust some specs

* Add missing param

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Remove byebug from spec

* Revert queue tweak

* Remove duplicate method

* APPEALS-47382: Refactor Job Behavior Filtering Boolean Methods (#21898)

* initial commit

* refactoring methods to have constants instead of methods

* adding comments back in

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>
Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* APPEALS-48342: Prevent Intentional Retries of SendNotificationJobs in ProdTest from Causing Duplicate Notification Table Entries (#21927)

* initial commit

* rubocop'n

* rubcop'n

* fixing tests

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Resolve missed conflict

* MattT/APPEALS-48514 (#21959)

* Prototype of privacy act fix

* Leave privacy act states intact upon decision mailed

* Remove unused param

* Attempt updating specs to cover new behavior

* Fix attr name typo

* Add missing bang

* Skip reek issue

The issue has been deemed to be minor enough to not warrant having to reinvent everything for now.

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Fix quarterly specs by add in necessary hearings

* Adjust spacing/ordering of gems (#21978)

* MattT/APPEALS-49085 (#21960)

* Filter out appeals whose hearings have been held from hearing_scheduled scope

* Fix whitespace issues

* Fix failing specs caused by an oversight on my part

* Fix lint issue

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-49212 (#21991)

* Add module to set hearing_scheduled to false whenever hearings are marked as held

* Add module to set hearing_scheduled to false whenever hearings are marked as held

* Add step to NightlySyncsJob to sync hearing dispositions and appeal stateS

* Add comment to new method

* Use constant for disposition type

* Fix typo in accessor

* Add spec for new appeal state action

* Create user in top scope

* Expand nighlty syncs job to check all scheduled hearing disposition types.

No show was left off as we don't have a requirement around it yet.

* Add nightly sync job spec

* Add disp task spec

* Add specs targeting the hearings controller

* Add sync script

* Eager load constants

* Add distinct

* Remove appeal_docketed from being reset

* Add script to adjust ama hearing statuses

* Correct mistype

* Add appeal_type clause

* Fix specs

* Lint fixes

* Flip conditionals in specs

* Fix var name

* Fix var

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Backfill addition to script

* Add AppealState record for newly docketed LegacyAppeals (#21999)

* APPEALS-48966 Adding AppealState record for recently docketed appeals

* APPEALS-48966 Refactor code and add comments

* Delete extraneous files

* Revert to using constants value

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Fix typo

---------

Co-authored-by: Jeff Marks <jeff.t.marks@gmail.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com>
Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Prerna Devulapalli <prerna.devulapalli@va.gov>
Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* Feature/appeals 43597 release candidate (#22004)

* APPEALS-36759 Add sms_response_content and sms_response_time notifications table

* APPEALS-37003 First pass at job refactor

* APPEALS-37003 Add comments and update kwargs for va notify service

* APPEALS-37003 Update spec files

* APPEALS-37003 Update spec

* APPEALS-37003 Ensure user in job and create email_enabled method

* APPEALS-37003 Remove question mark

* Limit max retry attempts to 5

* Add ? to boolen return methods

* jcohen/APPEALS-43706 (#21444)

* APPEALS-43706 macros added to each model file for the polymorphic relationship to be setup.

* APPEALS-43706 migration made and yet to be run.

* APPEALS-43706 migrations ran and expected columns and indexes are in table.

* Fix some spec failures unrelated to this branch

* Limit schema diff

* Add a missing tab

* Fix more unrelated failures. Also prevent ACD lever seeds from overwriting spec output

* Fix last unrelated failure.

* APPEALS-43706 linting issues in va_notify_service fixed.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* [APPEALS-43598] Quarterly Notification Job refactoring (#21505)

* Quarterly Notification Job refactoring

* APPEALS-43598 Fix lint issues for QuarterlyNotificationsJob refactor

* APPEALS-43598 Fix db schema.rb file

* APPEALS-43598 Fix schema.rb file

* APPEALS-43598 Refactoring QuarterlyNotificationsJob for readability

* APPEALS-43598 Refactoring QuarterlyNotificationsJob and removing extra methods

* [APPEALS-43598] Update method name

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-44007: Eliminate Transmission of Notifications to Deceased Veterans (#21481)

* APPEALS-44007: Writing tests to ensure adding the 'failure due to deceased' information is properly set and added to the db

* updates to pr

* pushing changes for tonight

* updating spec file to handle enabling and disabling feature flags

* Update format_message_status

* Lint roll

* fixing conflicts

* Updates to send notification spec

* Fix one of the legacy test cases

* Remove accidental push

* Fix remaining test

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-45235: Remove Temporary PDF Files From tmp Directory After All eFolder Upload Attempts (#21557)

* Cleanup files after uploading to VBMS

* Only delete file if it exists

* Resolve linter issue

* Update specs

* Trigger CodeClimate

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Add appeal alias for notifiable

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications (#21575)

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications

* fixing some errors

* updating factory

* updating tests

* updating tests and factory

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-43596 Adding JobMessageDeletionMiddleware to delete SQS messages for certain jobs

* APPEALS-43596 Adding tests

* APPEALS-43596 Fix codeclimate

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables (#21596)

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables

* pushing changes

* updating tests

* rubocop

* rubocop'n

* deleting repeat constants

* removing file in favor of EVENT_TYPE_FILTERS.json

* removing instances of using VA_NOTIFY_TEMPLATE_NAMES and using EVENT_TYPE_FILTERS instead

* replacing all instances of strings with constants

* fixing bug

* rubocop'n

* rubocop'n

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Clean notification_events after notification report specs finish (#21662)

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-43725: Extract `notify_appellant` Call from `QuaterlyNotificationsJob` to Decrease Runtime (#21643)

* Group notification types as scopes

* Add new job

* Fix typo

* Add back batching

* Batch send messages

* Multithread job queueing

* Reconfigure bulk enqueueing to utilize send_notifications.fifo queue

* Update the comment on QuaterlyNotificationsJob#perform

to adhere to the RDoc standard

* Use constants for template name

* Provide a more descriptive var name

* Remove unused env var

* Fix linting issues

* Prevent error from being thrown early in init job

* Add RDoc comments to appeal_state

* Add rdoc comment to init job

* Add another rdoc comment to the init job

* Use a more specific error class whenever an appeal

cannot be located within the init job

* Add a more specific error to CaseflowJob#enqueue_batch_of_jobs

* Add test for SendNotificationJob.queue_name_suffix

* Update QuarterlyNotificationsJob tests

* Update appeal_state_spec.rb to cover new scopes

* Add spec file for NotificationInitializationJob

* Add CaseflowJob specs

* Add CaseflowJob specs

* Address rubocop issue (by ignoring it)

* Kicking off CodeClimate

* Fix some lint issues

* Freeze constant

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Move spec file to proper location

* APPEALS-43599 (#21696)

* APPEALS-43599 Refactoring SendNotificationJob

* APPEALS-43599 Remove comments

* APPEALS-43599 Suppress code smells from reek

* APPEALS-43599 Suppress code smells from reek

* jcohen/APPEALS-43727 (#21589)

* APPEALS-43727 Branch created. Extracted all the 'when' conditions in the case statement within appellant_notification.rb update_appeal_state method.

* APPEALS-43727 appellant_notification_service is created, logic from crowded method in appellant_notificaion.rb placed in newly created file, allowing redability.

* APPEALS-43727 added logic to appeal_state.rb, appellant_notification.rb updated with less logic, readable code through well named methods.

* APPEALS-43727 commit before merge from teammates work

* APPEALS-43727 removed freeze method on default status hash in appeal_state.rb. removed some rubocop disabling in appellant_notificaion.rb

* APPEALS-43727 extracted more logic from the appellant_notification module and placed it into the appeal_state class. Also got rid of rubocop declarations in app_notif and app_state as well. finally removed feature_toggle calls in appell_notif.

* APPEALS-43727 tests passing, code works

* APPEALS-43727 adding tests to appeal_state_spec to test functionality

* APPEALS-43727 rspec tests in appeal_state.

* APPEALS-43727 tests pass.

* Fixing code climate duplicate code issue

* fixing case statement

* code climate things

* rubocop

* APPEALS-43727 work completed.

* APPEALS-43727 PR comments applied. tests not in a working state.

* APPEALS-43727 PR comments applied. appeal_state_spec in working state.

* APPEALS-43727 PR comments applied. appellant_notification_spec.rb all green.

* Adjust spacing of comments in appeal_state.rb

* Utilize #external_id method over ternary

* Swap or conditional for blank?

* Fix another whitespace gap

* APPEALS-43727 PR comments applied. again after reset.

* APPEALS-43727 PR comments applied. flipped conditionals in appeal_state.rb

* Update app/models/concerns/appeal_concern.rb

* APPEALS-43727 code/test edits

* APPEALS-43727 bulk_task_reasssignment_spec reverted to orginal state, with the exception of an expectation that was on line 98

* APPEALS-43727 lint fix

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-46179 (#21712)

* APPEALS-46179 Create JobExecutionTimes table

* APPEALS-46179 Add comment

* APPEALS-46179 Update schema

* APPEALS-46193 (#21753)

* APPEALS-46193 Add record to JobExecutionTime table when job is performed

* APPEALS-46193 Updating JobExecutionTimes table with an upsert query

* APPEALS-46193 Ignore JobExecutionTimes for certain jobs

* APPEALS-46193 Update ignore_job_execution_time? method

* APPEALS-46193 Adding tests

* Fix lint issues

* Update AWS dependencies

* Rollback gem reduction due to UAT issue

* Alter queue priority

* Forward error in SendNotificationJob

* Allow for notification audit records to remain in ProdTest

* Fix spec

* Fix typo in test fixture's name

* Fix lint infraction related to re-raising exceptions

* Address duplication CC error

* Reenable-privacy-mail-notifications (#21859)

* Add conditional for FOIA and Privacy Act mail

task to receives 'Privacy Act Pending' notifications

* Update spec

* Adjust some specs

* Add missing param

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Remove byebug from spec

* Revert queue tweak

* Remove duplicate method

* APPEALS-47382: Refactor Job Behavior Filtering Boolean Methods (#21898)

* initial commit

* refactoring methods to have constants instead of methods

* adding comments back in

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>
Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* APPEALS-48342: Prevent Intentional Retries of SendNotificationJobs in ProdTest from Causing Duplicate Notification Table Entries (#21927)

* initial commit

* rubocop'n

* rubcop'n

* fixing tests

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Resolve missed conflict

* MattT/APPEALS-48514 (#21959)

* Prototype of privacy act fix

* Leave privacy act states intact upon decision mailed

* Remove unused param

* Attempt updating specs to cover new behavior

* Fix attr name typo

* Add missing bang

* Skip reek issue

The issue has been deemed to be minor enough to not warrant having to reinvent everything for now.

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Fix quarterly specs by add in necessary hearings

* Adjust spacing/ordering of gems (#21978)

* MattT/APPEALS-49085 (#21960)

* Filter out appeals whose hearings have been held from hearing_scheduled scope

* Fix whitespace issues

* Fix failing specs caused by an oversight on my part

* Fix lint issue

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-49212 (#21991)

* Add module to set hearing_scheduled to false whenever hearings are marked as held

* Add module to set hearing_scheduled to false whenever hearings are marked as held

* Add step to NightlySyncsJob to sync hearing dispositions and appeal stateS

* Add comment to new method

* Use constant for disposition type

* Fix typo in accessor

* Add spec for new appeal state action

* Create user in top scope

* Expand nighlty syncs job to check all scheduled hearing disposition types.

No show was left off as we don't have a requirement around it yet.

* Add nightly sync job spec

* Add disp task spec

* Add specs targeting the hearings controller

* Add sync script

* Eager load constants

* Add distinct

* Remove appeal_docketed from being reset

* Add script to adjust ama hearing statuses

* Correct mistype

* Add appeal_type clause

* Fix specs

* Lint fixes

* Flip conditionals in specs

* Fix var name

* Fix var

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Backfill addition to script

* Add AppealState record for newly docketed LegacyAppeals (#21999)

* APPEALS-48966 Adding AppealState record for recently docketed appeals

* APPEALS-48966 Refactor code and add comments

* Delete extraneous files

* Revert to using constants value

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Fix typo

* Fix typo

* Fix seed script

* Fix seed script

* Ensure cleanup

* Change copy for Appeal Docketed status (#22006)

* Change copy for Appeal Docketed status

* Change case

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Use status text value instead of key

---------

Co-authored-by: Jeff Marks <jeff.t.marks@gmail.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com>
Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Prerna Devulapalli <prerna.devulapalli@va.gov>
Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-44916 seed data update (#22008)

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fi…
jcroteau added a commit that referenced this pull request Jul 15, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
mchbidwell added a commit that referenced this pull request Jul 16, 2024
* APPEALS-43190 (#21448)

* APPEALS-43190 initial migration file

* APPEALS-43190 add seed data

* APPEALS-43190 add magic comment

* APPEALS-43190 move seed command

* APPEALS-43190 add bang!

* APPEALS-43190 update migration file

* APPEALS-43190 attribute name fix and updates

* APPEALS-43190 fix seed attribute

* APPEALS-43190 stubbed more seed data

* APPEALS-43190 remove seed comment

* APPEALS-43190 remove comment

* APPEALS-43190 add magic comment

* APPEALS-43190 update comments

* APPEALS-43137 (#21511)

* APPEALS-43190 initial migration file

* APPEALS-43190 add seed data

* APPEALS-43190 add magic comment

* APPEALS-43190 move seed command

* APPEALS-43190 add bang!

* APPEALS-43190 update migration file

* APPEALS-43190 attribute name fix and updates

* APPEALS-43190 fix seed attribute

* APPEALS-43190 stubbed more seed data

* APPEALS-43190 remove seed comment

* APPEALS-43190 remove comment

* APPEALS-43137 - Basic controller and route

* APPEALS-43137 - Test the new transcription settings controller

* APPEALS-43137 - Add basic route and tests for index

* APPEALS-43137 - Remove changes

* APPEALS-43137 - Fix JSON responses and error

* APPEALS-43137 - Change record to contractor

---------

Co-authored-by: breedbah <brandon.reed3@va.gov>

* APPEALS-43125 (#21550)

* APPEALS-43190 initial migration file

* APPEALS-43190 add seed data

* APPEALS-43190 add magic comment

* APPEALS-43190 move seed command

* APPEALS-43190 add bang!

* APPEALS-43190 update migration file

* APPEALS-43190 attribute name fix and updates

* APPEALS-43190 fix seed attribute

* APPEALS-43137 - Basic controller and route

* initial component folder creation and db update

* APPEALS-43190 stubbed more seed data

* APPEALS-43190 remove seed comment

* APPEALS-43190 remove comment

* APPEALS-43137 - Basic controller and route

* APPEALS-43137 - Test the new transcription settings controller

* APPEALS-43137 - Add basic route and tests for index

* Initial heading creation

* add container for transcription settings

* Remove errors

* Pushing with error - change to component style

* Updated component style - working

* Updated styling with all components present

* Add text to copy and update settings page

* Add test to check that page displays contractor content

* Clean up CSS

* Update Gemfile.lock

Added libv8 linux version back into file

---------

Co-authored-by: breedbah <brandon.reed3@va.gov>
Co-authored-by: Adam Ducker <adam.ducker@va.gov>
Co-authored-by: mchbidwell <122634362+mchbidwell@users.noreply.github.com>

* APPEALS-43138 (#21554)

* APPEALS_43138 init commit

* APPEALS-43138 update jsx

* APPEALS-43138 upudate transcription_c tests

* APPEALS-43138 add unit tests

* APPEALS - 43138 handle error

* APPEALS-43138 update snaphot

* APPEALS-43138 update snapshot details.test.js

* APPEALS-43138 lint TranscriptionSettingsContainer.jsx

* APPEALS-43138 lint TranscriptionSettings.jsx

* APPEALS-43138 update feature_helper.rb

* APPEALS-43138 update test

* APPEALS-43138 change feature_helper back

* APPEALS-43138 feature_helper

* APPEALS-43138 add delay

* APPEALS-43138 update feature helper

* APPEALS-43138 remove sleep(1)

* APPEALS-43138 add wait on dropdown

* APPEALS-43138 change back to original

* APPEALS-43138 add "wait"

* APPEALS-43138 - Testing a theory

* APPEALS-43138 add seed data to test

* APPELA-43138 update the wait in spec_helper

* APPELA-43138 - Remove test changes

---------

Co-authored-by: Adam Ducker <adam.ducker@va.gov>

* APPEALS-43195 - Create MVC for Contractors (#21628)

* APPEALS-43195 - Updated transcription setttings controller, models, tests

# Conflicts:
#	app/models/hearings/transcription_contractor.rb
#	spec/models/hearings/transcription_contractors_model_spec.rb

* APPEALS-43195 - Rename controller

* APPEALS-43195 - Sort contractors in dropdown

* Merging lastest changes from outside APPEALS-31792 (#21680)

* added saftey opperator and removed outdated date check

* removed leftover method that was breaking and unused.

* removed legacy appeal date check for MST on special issue list

* updated mst and pact badges to check decisions in flight (if any) then appeal model.

* removed bypass for special issue list for pact toggle for AMA.

* updated rake and seed comments

* allowed special issues page tracking for AMA MST issues when pact is enabled

* remove code changes causing cancel to progress forward

* Update scheduled jobs key and move job to different folder

* Update job to set user manually and pass in updated_by

* moved method definition validate_claim_code into ClaimLabelChange class

* fixed spacing issue

* msteele/APPEALS-45182 Fix transcription_files relationships on Hearings/LegacyHearings (#21492)

* APPEALS-45182 Reinforce has_many relationships

* APPEALS-45182 Add missing comma

* Resolve lint issue

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* fixed linting error

* fixed linting issue

* draft pr

* Hotfix/APPEALS-45218 (#21503)

* APPEALS-45218 reverted webex config arguments

* APPEALS-45218 reverted webex config arguments

* APPEALS-25218 Update WebexService to remove config in favor of individual arguments

* APPEALS-45218 Format comment

---------

Co-authored-by: msteele <Marc.Steele@va.gov>

* Wmedders21/appeals 44873 (#21469)

* add rubyzip gem

* Test: Hearings::ZipAndUploadTranscriptionFilesJob

* Feature: Hearings::ZipAndUploadTranscriptionFilesJob

* Add zip subfolder to tmp/transcription_files

* Move new gem to proper alphabetical position in list

* revert gem file changes

* update gem file with feature branch

* refactor #perform method parameters

* update parameter name

* Piedram/appeals 44897 (#21519)

* Create new Workflow transcription_packages: Step One

* add some changes

* Modified the parameters for ZipAndUploadTranscriptionFilesJob

* Modified spec test

* Update transcription_packages.rb

* remove extra blank line

---------

Co-authored-by: piedram <maite.piedrayera@va.gov>

* Wmedders21/appeals 44874 (#21512)

* add rubyzip gem

* Test: Hearings::ZipAndUploadTranscriptionFilesJob

* Feature: Hearings::ZipAndUploadTranscriptionFilesJob

* Add zip subfolder to tmp/transcription_files

* Move new gem to proper alphabetical position in list

* revert gem file changes

* update gem file with feature branch

* refactor #perform method parameters

* update parameter name

* add zip extension to valid file types

* Test: transcription file creation and upload to s3

* Hearings::ZipAndUploadTranscriptionFilesJob updates db and uploads to s3

* resolve merge conflict

* APPEALS-44876 Work order job file (#21504)

* APPEALS-44876 Work order job file

* Updated filename with work order name

* Refactored create table method and updated spec

---------

Co-authored-by: Jim Foley <james.foley4@va.gov>

* Completing AC for ticketing for styling and error portion of page. Now doing feature test

* B_reed/hotfix_APPEALS-45285 (#21531)

* APPEALS-45285 Bug Fix

* APPEALS-45285 update pexip_service_spec

* APPEALS-45285 remove white space

* Hotfix/APPEALS-45218-v2 (#21522)

* APPEALS-45218 reverted webex config arguments

* APPEALS-45218 reverted webex config arguments

* APPEALS-45218 added query argument to webex conference link

* APPEALS-45218: webex recordings endpoint correction

* APPEALS-45218 adjusted arguments during inititalizing of refresh tokens

* APPEALS-45218 fixed rspec

* APPEALS-45218: added error catching on webex service response

* APPEALS-45218: remove tested code

* APPEALS-45218 Go back to leveraging HTTPI response inherited methods

---------

Co-authored-by: Ariana Konhilas <konhilas_ariana@bah.com>
Co-authored-by: msteele <Marc.Steele@va.gov>

* added ability for user to search by css id

* added feature tests for using search bar

* reverted changes in package.json

* removed added file

* removed linting error

* msteele/APPEALS-45349 (#21539)

* APPEALS-45349 Check for error on HTTPI object, then create Webex response object and fail with specific error

* APPEALS-45349 Flip conditionals

* APPEALS-45349 Fix linting errors

* searchable by 2 characters instead of 1

* hotfix/APPEALS-45399-45401-45472 (#21555)

* APPEALS-45399-45401 Update fetch webex list and details to retrieve apikey from cred stash

* APPEALS-45399-45401 Remove CGI escape from fetch webex list job

* APPEALS-445399-45401 Update spec files for webex list and details job

* APPEALS-45399-45401 Include error handling for transcription issue mailer failed delivery

* Revert "APPEALS-45399-45401 Include error handling for transcription issue mailer failed delivery"

This reverts commit d9ce585c59444f9793e681e58060d71872057e4c.

* ccc

* gggg

* gggg

* Create new Workflow transcription_packages: Step Two (#21570)

* Add call function to the new job, and modified spec files

* call the jobs

* feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) (#21614)

* 🔀 Squash merge jcroteau/APPEALS-44188-fix-deprecation-warning-class-level-methods-will-no-longer-inherit-scoping

* 🔀 Squash merge jcroteau/APPEALS-44282-fix-deprecation-not-conditions-will-no-longer-behave-as-nor

* Work order file upload to AWS s3 (#21582)

* Work order file upload to AWS s3

* refactor code for upload to AWS

* refactor code for instance variables

* Revert "refactor code for instance variables"

This reverts commit b61c72a3f2e30e4003e9d4a4dc57a01dbb105443.

* code refactor for work order file

* APPEALS-44877 refactor for work order

* APPEALS-44310: add notification for unexpected task trees and update tests (#21474)

* add notification for unexpected task trees and update tests

* add slack notification to distribution errors, set default slack url in SlackService

* add tests for distributions to validate handling of errors in the ama_statistics method

* fix bad check for allowable tasks

* fix tests which were expecting a url as arg to new slack service

* fix codeclimate warning

* APPEALS-45199: Update Quality Review selection probabilities #21518

* APPEALS-44423: Remove therubyracer and jshint gems (#21443)

* APPEALS-42941 copied over Matt's work (#21624)

* APPEALS-43190 (#21448)

* APPEALS-43190 initial migration file

* APPEALS-43190 add seed data

* APPEALS-43190 add magic comment

* APPEALS-43190 move seed command

* APPEALS-43190 add bang!

* APPEALS-43190 update migration file

* APPEALS-43190 attribute name fix and updates

* APPEALS-43190 fix seed attribute

* APPEALS-43190 stubbed more seed data

* APPEALS-43190 remove seed comment

* APPEALS-43190 remove comment

* APPEALS-43190 add magic comment

* APPEALS-43190 update comments

* Wmedders21/appeals 44875 (#21605)

* Add retry logic for upload failure

* fix indentation rubocop warning

* Refactor zip job

* remove blank line

---------

Co-authored-by: Jim Foley <james.foley4@va.gov>

* akonhilas/APPEALS-43193 (#21581)

* APPEALS-43193: Add new columns and indexes to transcriptions table

* APPEALS-43193: Add new columns and indexes to transcriptions table

* APPEALS-43193: move index to own file

* APPEALS-43193: Update transcription contractor id to bigint

* APPEALS-43193: bigint

* APPEALS-43193: add fk after trancription_contractors table added

* lint error resolution (#21631)

* hotfix/APPEALS-45472 (#21562)

* APPEALS-45472 Refactor error handling for transcription

* APPEALS-45472 Include missing provider in error details for fetch recording list job and update comment for mailer

* Hotfix/APPEALS-45818 (#21632)

* APPEALS-45818: parsing fix, remove topic param, fix response

* APPEALS-45818: revert list and details job back to original state, update tests

---------

Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-44878 refactor for retry and upon success kickoff  zip file job (#21652)

* APPEALS-44878 refactor for retry and upon success kickoff  zip file job

* APPEALS-44878 refactor code

* APPEALS-44878 refactor xls path

* lint error fix

* msteele/APPEALS-45285-v2 Fix delete_conference in PexipService (#21634)

* APPEALS-45285 update ExternalApi::PexipService#delete_conference to accept virtual_hearing as the only argument

* APPEALS-45285 Update spec to use virtual_hearing

* APPEALS-45285 Linting fixes

* Piedram/appeals 45696 (#21655)

* Create new Workflow Error handling transcription_packages: Step Three related to appeals-31793

* MOdified spec file

* fix lint error

* APPEALS-45696 refactor for work_order_params

---------

Co-authored-by: Kamala Madamanchi <kamala.madamanchi@va.gov>
Co-authored-by: Jim Foley <james.foley4@va.gov>

* hotfix/APPEALS-45828 (#21625)

* APPEALS-45828 Include call to create webex conference links in base hearing update form

* APPEALS-45828 Update details feature spec to expect webex link creation on conversion from virtual

* Fix needing to reload to display co host link on details page

* Fix incorrect method name

* Remove temporary rendering of default pexip link for webex hearings after conversion

* APPEALS-45828 Fix hearing mailer spec context issues and null check for BAD_VIRTUAL_LINK_TEXT

* APPEALS-45828 Remove file name argument from fetch details job spec

* APPEALS-45828 Fail on bad hearing link if link nil or legacy link

* APPEALS-45828 Sanitize url string

* APPEALS-45828 Undo url sanitize

* Remove unused styles after merge

* Fix lint warnings

---------

Co-authored-by: HunJerBAH <Jeremy.Hunton@va.gov>
Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com>
Co-authored-by: msteele <Marc.Steele@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: IsaiahBar <isaiah.barnett@va.gov>
Co-authored-by: minhazur9 <65432922+minhazur9@users.noreply.github.com>
Co-authored-by: Will Medders <93014155+wmedders21@users.noreply.github.com>
Co-authored-by: Jim Foley <james.foley4@va.gov>
Co-authored-by: piedram <maite.piedrayera@va.gov>
Co-authored-by: Kamala Madamanchi <110078646+kamala-07@users.noreply.github.com>
Co-authored-by: breedbah <123968373+breedbah@users.noreply.github.com>
Co-authored-by: Ariana Konhilas <konhilas_ariana@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Jeff Marks <106996298+jefftmarks@users.noreply.github.com>
Co-authored-by: piedram <110848569+piedram@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com>
Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com>
Co-authored-by: Ariana Konhilas <109693628+konhilas-ariana@users.noreply.github.com>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Kamala Madamanchi <kamala.madamanchi@va.gov>

* APPEALS-43127 (#21702)

* APPEALS-43127 initial setup

* APPEALS-43127 modal is popping up and getting data

* APPEALS-43127 update tghe state

* APPEALS-43127 updated lint

* APPEALS-43127 remove unused function

* APPEALS-43127 change to searchableDropdown

* APPEALS-43127 update COPY.json

* APPEALS-43127 remove commented data

* APPEALS-43127 lint in modal

* APPEALS-43127 update COPY.json

* APPEALS-43127 update COPY.json

* APPEALS-43127 update COPY.json

* APPEALS-43172 removeContractorModal tests complete

* APPEALS-43127 update test and snapshot

* APPEALS-43127 update cancel button

* APPEALS-43127 lint

* APPEALS-43128 - Create a New Modal named "Add Contractor" (#21720)

* APPEALS-43128 - First pass at modal with form and basic validation

# Conflicts:
#	client/COPY.json
#	client/app/hearings/components/transcriptionProcessing/TranscriptionSettings.jsx

* APPEALS-43128 - Saving a contractor and displaying success

# Conflicts:
#	client/app/hearings/components/transcriptionProcessing/TranscriptionSettings.jsx

* APPEALS-43128 - Remove bad migration

* APPEALS-43128 - Update modal validation and handle error from server side

* APPEALS-43128 - Some cleanup and test writing

# Conflicts:
#	client/app/hearings/components/transcriptionProcessing/TranscriptionSettings.jsx

* APPEALS-43128 - Some minor updates to make the edit work easier when it starts

* APPEALS-43128 - Text changes for edit view to match designs

* APPEALS-43128 - Un-change a line

# Conflicts:
#	client/app/hearings/components/transcriptionProcessing/TranscriptionSettings.jsx

* APPEALS-43128 - Updates after new code was merged in

* APPEALS-43128 - Fixing jest problems

* APPEALS-43128 - Text adjustments from BA review

* APPEALS-45881 (#21787)

* Showing iterating contractors on transcription settings page

* Add changes to iteration and seed data

* Styling progress

* CSS fixes for a couple of alignment issues and some lint warnings

* Use state contractors instead of props so the list refreshes

* Updates for button area

* Forgot to update the snapshot

* Link frontend toggle switch to contractor table

---------

Co-authored-by: Adam Ducker <adam.ducker@va.gov>

* APPEALS-43129 Create a New Modal named "Edit Contractor" (#21877)

* added saftey opperator and removed outdated date check

* removed leftover method that was breaking and unused.

* removed legacy appeal date check for MST on special issue list

* updated mst and pact badges to check decisions in flight (if any) then appeal model.

* removed bypass for special issue list for pact toggle for AMA.

* updated rake and seed comments

* allowed special issues page tracking for AMA MST issues when pact is enabled

* remove code changes causing cancel to progress forward

* moved method definition validate_claim_code into ClaimLabelChange class

* fixed spacing issue

* fixed linting error

* fixed linting issue

* draft pr

* Completing AC for ticketing for styling and error portion of page. Now doing feature test

* added ability for user to search by css id

* added feature tests for using search bar

* reverted changes in package.json

* removed added file

* removed linting error

* searchable by 2 characters instead of 1

* ccc

* gggg

* gggg

* feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) (#21614)

* 🔀 Squash merge jcroteau/APPEALS-44188-fix-deprecation-warning-class-level-methods-will-no-longer-inherit-scoping

* 🔀 Squash merge jcroteau/APPEALS-44282-fix-deprecation-not-conditions-will-no-longer-behave-as-nor

* APPEALS-44310: add notification for unexpected task trees and update tests (#21474)

* add notification for unexpected task trees and update tests

* add slack notification to distribution errors, set default slack url in SlackService

* add tests for distributions to validate handling of errors in the ama_statistics method

* fix bad check for allowable tasks

* fix tests which were expecting a url as arg to new slack service

* fix codeclimate warning

* APPEALS-45199: Update Quality Review selection probabilities #21518

* APPEALS-44423: Remove therubyracer and jshint gems (#21443)

* APPEALS-42941 copied over Matt's work (#21624)

* lint error resolution (#21631)

* Feature/appeals 46208.rc (#21746)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Ricky/appeals-43523 (#21345)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Added Download Ineligible Judge List

* APPEALS-43116 add sentry error capture to push priority job and updated specs (#21369)

* Updated query to include css_id and updated id fetch

* Updates button styling, fixed csv to have all values but judge name

* Updated id to sattyid values, and added name data to column

* fixed linting error

* Updated logic to account for inactive users in both caseflow and vacols

* Updated button component and cleaned up code

* Updated handling of ids in situation where sattyid is unavailable in record

* Updated to have individual columns for caseflow id and satty id

* APPEALS-43117 Add QA Users for testing (#21580)

* APPEALS-43117 Add QA Users for testing

* Fix rspecs

---------

Co-authored-by: Christopher Detlef <>

* APPEALS-42266 Remove CaseDistributionLevers seed config in Rails helper and update required spec files

* APPEALS-42266 fixing a couple of linting issues

* APPEALS-43523 reverted the legacy tasks controller (#21713)

* APPEALS-43523 reverted the legacy tasks controller

* APPEALS-43523 reverted the erorrs concern too

* Update legacy_tasks_controller_spec.rb

* reverted raven call

* APPEALS-46208 fixed code climate warning about a bad naming convention.

* APPEALS-46208 fixed indentation

---------

Co-authored-by: 631068 <rickybmanus@gmail.com>
Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com>
Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com>
Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com>
Co-authored-by: kristeja <krishnateja.golla@va.gov>

* APPEALS-44148: Add ruby CE API Gem (#21520)

* hotfix/APPEALS-46182 (#21709)

* Added tests and added logic to account for sct distribution

* Added more tests and changed logic

* Adding comments

* Fixing logic for SCT

* Update test and logic

* Fixing tests

* Update docket switch mail task to match corrected logic

* Fixing logic

* Cleaning up refactor

* Worked with the amazing ALex and we figured it out!

* Fixing linting issue

* Fix linting issues

* Skipping flaky tests

* Skipping another flaky test

---------

Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* MattT/APPEALS-46383: Upgrade aws-sdk gem to v3.2 (#21748)

* Upgrade aws-sdk gem to v3.2

* Update caseflow-commons hash

* Apply new hash update

* Skip flaky test

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Update gemfile and gemfile.lock to point to new bgs version (#21749)

* Update gemfile and gemfile.lock to point to new bgs version

* Skipping flake specs in review_spec.rb file

* Revert "APPEALS-44148: Add ruby CE API Gem (#21520)" (#21762)

This reverts commit 3a393d1f3f40b35b5063c2b7d0f1508ef5a61bb7.

* Update ruby-bgs gemfile and gemfile.lock to new version (#21761)

* Update MAC_INTEL.md

Update Oracle client link

* Resolved merge conflicts

* Call patch with updateContractor

* Progress with linking EditModal to Edit Contractor link

* Updated Edit contractor link details

* Edit Modal working with link and persisting changes

* Add rendering test to check for Edit contractor modal

* Fix styling and update copy

* Fix linting issues

* Update snapshot and fix linting issue

---------

Co-authored-by: HunJerBAH <Jeremy.Hunton@va.gov>
Co-authored-by: HunJerBAH <99915461+HunJerBAH@users.noreply.github.com>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: IsaiahBar <isaiah.barnett@va.gov>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: cacevesva <109166981+cacevesva@users.noreply.github.com>
Co-authored-by: Amy Detwiler <133032208+amybids@users.noreply.github.com>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: 631068 <rickybmanus@gmail.com>
Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com>
Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com>
Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com>
Co-authored-by: kristeja <krishnateja.golla@va.gov>
Co-authored-by: youfoundmanesh <129548081+youfoundmanesh@users.noreply.github.com>
Co-authored-by: Alex Ferencz VA <156860944+aferencz1987VA@users.noreply.github.com>
Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Alec Spottswood <ajspottswood@gmail.com>

* APPEALS-43134 Create a New Modal named "Edit Goals" (#22022)

* added saftey opperator and removed outdated date check

* removed leftover method that was breaking and unused.

* removed legacy appeal date check for MST on special issue list

* updated mst and pact badges to check decisions in flight (if any) then appeal model.

* removed bypass for special issue list for pact toggle for AMA.

* updated rake and seed comments

* allowed special issues page tracking for AMA MST issues when pact is enabled

* remove code changes causing cancel to progress forward

* moved method definition validate_claim_code into ClaimLabelChange class

* fixed spacing issue

* fixed linting error

* fixed linting issue

* draft pr

* Completing AC for ticketing for styling and error portion of page. Now doing feature test

* added ability for user to search by css id

* added feature tests for using search bar

* reverted changes in package.json

* removed added file

* removed linting error

* searchable by 2 characters instead of 1

* ccc

* gggg

* gggg

* feature/APPEALS-44188-44282 - Deprecation fixes for Rails 6.1 (release) (#21614)

* 🔀 Squash merge jcroteau/APPEALS-44188-fix-deprecation-warning-class-level-methods-will-no-longer-inherit-scoping

* 🔀 Squash merge jcroteau/APPEALS-44282-fix-deprecation-not-conditions-will-no-longer-behave-as-nor

* APPEALS-44310: add notification for unexpected task trees and update tests (#21474)

* add notification for unexpected task trees and update tests

* add slack notification to distribution errors, set default slack url in SlackService

* add tests for distributions to validate handling of errors in the ama_statistics method

* fix bad check for allowable tasks

* fix tests which were expecting a url as arg to new slack service

* fix codeclimate warning

* APPEALS-45199: Update Quality Review selection probabilities #21518

* APPEALS-44423: Remove therubyracer and jshint gems (#21443)

* APPEALS-42941 copied over Matt's work (#21624)

* lint error resolution (#21631)

* Feature/appeals 46208.rc (#21746)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Ricky/appeals-43523 (#21345)

* Added Assignment Queue link to Switch Users test page

* Updated controller to validate role and redirect

* Updated error information

* Updated rspec tests

* Added Download Ineligible Judge List

* APPEALS-43116 add sentry error capture to push priority job and updated specs (#21369)

* Updated query to include css_id and updated id fetch

* Updates button styling, fixed csv to have all values but judge name

* Updated id to sattyid values, and added name data to column

* fixed linting error

* Updated logic to account for inactive users in both caseflow and vacols

* Updated button component and cleaned up code

* Updated handling of ids in situation where sattyid is unavailable in record

* Updated to have individual columns for caseflow id and satty id

* APPEALS-43117 Add QA Users for testing (#21580)

* APPEALS-43117 Add QA Users for testing

* Fix rspecs

---------

Co-authored-by: Christopher Detlef <>

* APPEALS-42266 Remove CaseDistributionLevers seed config in Rails helper and update required spec files

* APPEALS-42266 fixing a couple of linting issues

* APPEALS-43523 reverted the legacy tasks controller (#21713)

* APPEALS-43523 reverted the legacy tasks controller

* APPEALS-43523 reverted the erorrs concern too

* Update legacy_tasks_controller_spec.rb

* reverted raven call

* APPEALS-46208 fixed code climate warning about a bad naming convention.

* APPEALS-46208 fixed indentation

---------

Co-authored-by: 631068 <rickybmanus@gmail.com>
Co-authored-by: Blake Manus <33578594+Blake-Manus@users.noreply.github.com>
Co-authored-by: kristeja <112115264+kristeja@users.noreply.github.com>
Co-authored-by: cdetlefva <133903625+cdetlefva@users.noreply.github.com>
Co-authored-by: kristeja <krishnateja.golla@va.gov>

* APPEALS-44148: Add ruby CE API Gem (#21520)

* hotfix/APPEALS-46182 (#21709)

* Added tests and added logic to account for sct distribution

* Added more tests and changed logic

* Adding comments

* Fixing logic for SCT

* Update test and logic

* Fixing tests

* Update docket switch mail task to match corrected logic

* Fixing logic

* Cleaning up refactor

* Worked with the amazing ALex and we figured it out!

* Fixing linting issue

* Fix linting issues

* Skipping flaky tests

* Skipping another flaky test

---------

Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* MattT/APPEALS-46383: Upgrade aws-sdk gem to v3.2 (#21748)

* Upgrade aws-sdk gem to v3.2

* Update caseflow-commons hash

* Apply new hash update

* Skip flaky test

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Update gemfile and gemfile.lock to point to new bgs version (#21749)

* Update gemfile and gemfile.lock to point to new bgs version

* Skipping flake specs in review_spec.rb file

* Revert "APPEALS-44148: Add ruby CE API Gem (#21520)" (#21762)

This reverts commit 3a393d1f3f40b35b5063c2b7d0f1508ef5a61bb7.

* Update ruby-bgs gemfile and gemfile.lock to new version (#21761)

* Update MAC_INTEL.md

Update Oracle client link

* Resolved merge conflicts

* APPEALS-44496 Fix Factory (#21770)

* APPEALS-44496 Fix Factory

* updated falky test

---------

Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* fix(va facilities): update per page param (#21754)

* Hotfix/appeals 44033:Fix Judge and Attorney tasks in the QualityReview workflow are being erroneously cancelled  (#21786)

* Adjusts the send_to_hearings_branch method to exclude JudgeQualityReviews when cancelling all Judge tasks and subtasks
rebase

* adjusts spacing and adds back deleted test

* Remove unnecessary schema changes and adds an exclamation mark to account for method that changes data

* add exclamation to handle_judge_tasks

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* Hotfix/appeals 45150 (#21627)

* Added distribution task with children status change on split appeal test

* Added tests and commented out pry session in appeal

* Changed split appeal test to test for both defects

* Added  conditional logic to status_is_valid_on_create in task model

* looking for defect

* Reverted changes to finalize split appeal method added condtional logic to schedule hearing tasks model

* Removed debugger and commented out lines

* Added erroneously removed lines of code and added spacing

* Fix linting errors

* Added conditional logic for appeal split process

---------

Co-authored-by: Alexandra Ferencz <ferencz_alexandra@bah.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* hotfix/APPEALS-36313-V2 (#21782)

* avoid IHP task creation with an open pre-docket task

* Fix linting errors on RSpec

* Skip flaky BGS Share Error test

* comment failed test case

---------

Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>

* APPEALS-47106 Caseflow Swagger (#21847)

* Add Rswag and convert existing API documentation (#21778)

* add rswag

* Update Gemfile.lock

* Setup yaml UI

* remove and reroute old swagger files

* update format and servers values

* Update route_docs_controller.rb

* Update cmp_controller.rb

* cmp endpoint yaml

* cmp endpoint to return 501

* CMP endpoint swagger flies

* update swagger files

* adjust server order, add auth token

* cmp parameter name change

* add comments

* Update users_controller.rb

* unit tests and linting

* lint fixes

* Update swagger_helper.rb

* skip flakey tests

* Update appeal_notifications_page_spec.rb

* Hotfix/appeals 36313 v2 (#21858)

* avoid IHP task creation with an open pre-docket task

* Fix linting errors on RSpec

* Skip flaky BGS Share Error test

* comment failed test case

* Add predocket coverage for IHP task creation when POA is updated

* adjust predocketed from active status to open to include on_hold status

* Remove commented out data staging for bgs POA rspec test

---------

Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>

* feature/appeals-43220 (#21862)

* Adding 403 and 404 functionality to Reader.

* Adding icon to button.

* Fixing linting issues.

* Using the Link component and moving href into constant

* fix linter issues

---------

Co-authored-by: Brian Bommarito <brian@bommarito.me>

* feature/appeals-39842 (#21864)

* anusha/appeals-45976 (#21738)

* Change address format

* added rspec tests to cover hotfix

* testing for inclusion of expected values (addressLine1, etc.)

* rspec test -- wip

* still WIP

* Fix address tests.

* updated fakes

* Update internationalPostalCode

* appeals controller spec update

* http request changed and test

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Lauren Berry <berry_lauren@bah.com>

* lauren/APPEALS-39842 (#21739)

* Add scroll metrics start time fix and update metric message

* Add metrics attributes json in PdfPage constructor and add isPageVisible metric attribute

* Fix scroll message spacing

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* noelle/appeals-39842 (#21740)

* Remove UUID from attrs sent_to metrics.

* Remove UUID from spec

* remove uuid from update_appellant job

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>

* fix failing tests

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Lauren Berry <berry_lauren@bah.com>
Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* APPEALS-44916: Case Distribution Affinity Calculations (#21666)

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fix migration for null affinity start date column

* fixes, added tests

* more test updates

* add return in job if no query results, tests for no query results

* add test for after_save hook adding dist task instructions

* set start dist job to queue affinity job after running

* fix update job and start dist job spec

* queue affinity update job from push job

* code clarity

* fix judge in seed file

* remove comment, fix hearing factory, disable some seeds for testing

* add more tests

* test refactor

* update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory

* disable new seed on reset

* update seed file with vet names, add another seed category

* fix distirbuted case factory?

* actually fix GHA runs

* lint, test fixes

* change constants in new job

* APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611)

* swap distribution queries from distribution_task to appeal_affinities

* update seed files to use appeal affinities instead of distribution task

* clean up seed file method names

* add missing Timecop.return in ama affinity case seed

* fix name of a method in a seed file

* remove references to distribution task in distribution scopes

* fix push priority job tests

* fix naming of args in one of the seed files

* fix user seed, fix date format in distribution task instructions

* fix tests for date format update

* Calvin/APPEALS-44957-rake-affinity (#21577)

* grabbed receipt dates from distributed cases

* refactored for functionality + added method to grab appeals that match

* using receipt date, get all related appeals

* added update/creation plus cleaned prior imple.

* gets most recent distributed case receipt_date

* skips if receipt_date is nil for performance

* if appeal affinity is nil, it will now be updated

* created spec file

* fixed non ready appeals

* updated query to match new AC

* removing comment

* testing for each docket

* updated spec file

* added new tests to rspec

* updated start date to receipt date instead of Time.now

* fixed date/time rspec errors

* added rails logger to know when rake task has finished

* added tag for rails log

* removed nonpriority dockets for direct_review and evidence_submission

* fixed lint issue

* fixed flaky spec test

* limits distributed cases query to within the last week

* APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660)

* add affinity start date to explain page

* add feature test to verify dates display

* update rake task and spec (#21731)

* APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730)

* add aod hearing cases to ama affinity cases seed

* fix lever spec

* APPEALS-45148: Hook to clear saved affinity date (#21623)

* initial imp. idea

* AC1: check for affinity_start_date on assignment

* AC2/3: update affinity start date  w/ instr.

* updates to naming, instructions, and hook logic

* updates after review

* rspec coverage and addtional condition

* removed unused identifier

* removed reduntant 'self's

* added update on actual AA record

* updated to save aa record and addtional rspec

* added change to assignment on no record test

* check for assignment

* addd update to 'on_hold' status

* public method to handle legacy affinity appeals

* added .reload to :with_affinity_appeal

* added .reload to :ready_for_distribution

* updates to pass explain_spec

* switched boolean values

* typo

* readujsted order on :create for affinity appeal

* removed after(:create)

* testing rspec by readding after :create

* reloading in assertation

* addressing lint errors

* fix seeds/users_spec

* add case dist lever to new tests (#21776)

* remove unnecessarily included module from job (#21827)

* APPEALS-47211: Improve Performance of Distribution Queries (#21840)

* rework ready_for_distribution scope

* fix non-hearing docket distribution bug

* restart tests

---------

Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>
Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>

* APPEALS-46540: Reduce time to deploy demo environments (#21791)

* APPEALS-42710: Modify local/demo seed data so that not all seed files need to be run when resetting/deploying (#21743)

* refactor users to use factories and create singletons

* code quality, reduce counts

* refactor substitutions

* refactor veterans health administration seed

* refactor MTV

* move education orgs to users seed

* move intake users to users seed, comment non-required seed files

* add veterans seed file from Sean's branch

* fix errors

* add hearing prep role to judges

* add optional seed file

* add optional seed file and button to run it in demo

* lint, specs

* remove priority dist from optional, test fix

* fix tests

* Disable repeated conditional in Test::UsersController

* feature/APPEALS-43597 RC (#21860)

* APPEALS-36759 Add sms_response_content and sms_response_time notifications table

* APPEALS-37003 First pass at job refactor

* APPEALS-37003 Add comments and update kwargs for va notify service

* APPEALS-37003 Update spec files

* APPEALS-37003 Update spec

* APPEALS-37003 Ensure user in job and create email_enabled method

* APPEALS-37003 Remove question mark

* Limit max retry attempts to 5

* Add ? to boolen return methods

* jcohen/APPEALS-43706 (#21444)

* APPEALS-43706 macros added to each model file for the polymorphic relationship to be setup.

* APPEALS-43706 migration made and yet to be run.

* APPEALS-43706 migrations ran and expected columns and indexes are in table.

* Fix some spec failures unrelated to this branch

* Limit schema diff

* Add a missing tab

* Fix more unrelated failures. Also prevent ACD lever seeds from overwriting spec output

* Fix last unrelated failure.

* APPEALS-43706 linting issues in va_notify_service fixed.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* [APPEALS-43598] Quarterly Notification Job refactoring (#21505)

* Quarterly Notification Job refactoring

* APPEALS-43598 Fix lint issues for QuarterlyNotificationsJob refactor

* APPEALS-43598 Fix db schema.rb file

* APPEALS-43598 Fix schema.rb file

* APPEALS-43598 Refactoring QuarterlyNotificationsJob for readability

* APPEALS-43598 Refactoring QuarterlyNotificationsJob and removing extra methods

* [APPEALS-43598] Update method name

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-44007: Eliminate Transmission of Notifications to Deceased Veterans (#21481)

* APPEALS-44007: Writing tests to ensure adding the 'failure due to deceased' information is properly set and added to the db

* updates to pr

* pushing changes for tonight

* updating spec file to handle enabling and disabling feature flags

* Update format_message_status

* Lint roll

* fixing conflicts

* Updates to send notification spec

* Fix one of the legacy test cases

* Remove accidental push

* Fix remaining test

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-45235: Remove Temporary PDF Files From tmp Directory After All eFolder Upload Attempts (#21557)

* Cleanup files after uploading to VBMS

* Only delete file if it exists

* Resolve linter issue

* Update specs

* Trigger CodeClimate

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Add appeal alias for notifiable

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications (#21575)

* APPEALS-45346: Populate Polymorphic Association Columns When Creating New Notifications

* fixing some errors

* updating factory

* updating tests

* updating tests and factory

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-43596 Adding JobMessageDeletionMiddleware to delete SQS messages for certain jobs

* APPEALS-43596 Adding tests

* APPEALS-43596 Fix codeclimate

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables (#21596)

* APPEALS-43714: Refactor VANotify Modules to Not Rely on Class Variables

* pushing changes

* updating tests

* rubocop

* rubocop'n

* deleting repeat constants

* removing file in favor of EVENT_TYPE_FILTERS.json

* removing instances of using VA_NOTIFY_TEMPLATE_NAMES and using EVENT_TYPE_FILTERS instead

* replacing all instances of strings with constants

* fixing bug

* rubocop'n

* rubocop'n

* rubocop

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Clean notification_events after notification report specs finish (#21662)

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-43725: Extract `notify_appellant` Call from `QuaterlyNotificationsJob` to Decrease Runtime (#21643)

* Group notification types as scopes

* Add new job

* Fix typo

* Add back batching

* Batch send messages

* Multithread job queueing

* Reconfigure bulk enqueueing to utilize send_notifications.fifo queue

* Update the comment on QuaterlyNotificationsJob#perform

to adhere to the RDoc standard

* Use constants for template name

* Provide a more descriptive var name

* Remove unused env var

* Fix linting issues

* Prevent error from being thrown early in init job

* Add RDoc comments to appeal_state

* Add rdoc comment to init job

* Add another rdoc comment to the init job

* Use a more specific error class whenever an appeal

cannot be located within the init job

* Add a more specific error to CaseflowJob#enqueue_batch_of_jobs

* Add test for SendNotificationJob.queue_name_suffix

* Update QuarterlyNotificationsJob tests

* Update appeal_state_spec.rb to cover new scopes

* Add spec file for NotificationInitializationJob

* Add CaseflowJob specs

* Add CaseflowJob specs

* Address rubocop issue (by ignoring it)

* Kicking off CodeClimate

* Fix some lint issues

* Freeze constant

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Move spec file to proper location

* APPEALS-43599 (#21696)

* APPEALS-43599 Refactoring SendNotificationJob

* APPEALS-43599 Remove comments

* APPEALS-43599 Suppress code smells from reek

* APPEALS-43599 Suppress code smells from reek

* jcohen/APPEALS-43727 (#21589)

* APPEALS-43727 Branch created. Extracted all the 'when' conditions in the case statement within appellant_notification.rb update_appeal_state method.

* APPEALS-43727 appellant_notification_service is created, logic from crowded method in appellant_notificaion.rb placed in newly created file, allowing redability.

* APPEALS-43727 added logic to appeal_state.rb, appellant_notification.rb updated with less logic, readable code through well named methods.

* APPEALS-43727 commit before merge from teammates work

* APPEALS-43727 removed freeze method on default status hash in appeal_state.rb. removed some rubocop disabling in appellant_notificaion.rb

* APPEALS-43727 extracted more logic from the appellant_notification module and placed it into the appeal_state class. Also got rid of rubocop declarations in app_notif and app_state as well. finally removed feature_toggle calls in appell_notif.

* APPEALS-43727 tests passing, code works

* APPEALS-43727 adding tests to appeal_state_spec to test functionality

* APPEALS-43727 rspec tests in appeal_state.

* APPEALS-43727 tests pass.

* Fixing code climate duplicate code issue

* fixing case statement

* code climate things

* rubocop

* APPEALS-43727 work completed.

* APPEALS-43727 PR comments applied. tests not in a working state.

* APPEALS-43727 PR comments applied. appeal_state_spec in working state.

* APPEALS-43727 PR comments applied. appellant_notification_spec.rb all green.

* Adjust spacing of comments in appeal_state.rb

* Utilize #external_id method over ternary

* Swap or conditional for blank?

* Fix another whitespace gap

* APPEALS-43727 PR comments applied. again after reset.

* APPEALS-43727 PR comments applied. flipped conditionals in appeal_state.rb

* Update app/models/concerns/appeal_concern.rb

* APPEALS-43727 code/test edits

* APPEALS-43727 bulk_task_reasssignment_spec reverted to orginal state, with the exception of an expectation that was on line 98

* APPEALS-43727 lint fix

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-46179 (#21712)

* APPEALS-46179 Create JobExecutionTimes table

* APPEALS-46179 Add comment

* APPEALS-46179 Update schema

* APPEALS-46193 (#21753)

* APPEALS-46193 Add record to JobExecutionTime table when job is performed

* APPEALS-46193 Updating JobExecutionTimes table with an upsert query

* APPEALS-46193 Ignore JobExecutionTimes for certain jobs

* APPEALS-46193 Update ignore_job_execution_time? method

* APPEALS-46193 Adding tests

* Fix lint issues

* Update AWS dependencies

* Rollback gem reduction due to UAT issue

* Alter queue priority

* Forward error in SendNotificationJob

* Allow for notification audit records to remain in ProdTest

* Fix spec

* Fix typo in test fixture's name

* Fix lint infraction related to re-raising exceptions

* Address duplication CC error

* Reenable-privacy-mail-notifications (#21859)

* Add conditional for FOIA and Privacy Act mail

task to receives 'Privacy Act Pending' notifications

* Update spec

* Adjust some specs

* Add missing param

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Remove byebug from spec

* Revert queue adjustment

* Remove unused method

---------

Co-authored-by: Jeff Marks <jeff.t.marks@gmail.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com>
Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com>
Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Prerna Devulapalli <prerna.devulapalli@va.gov>

* feature/appeals-39842.1 (#21871)

* Fix PdfFile test

* Delete client/app/readerprototype/components/ReaderDocument.jsx (#21870)

Delete empty ReaderDocument file

* Fix lint issue in PdfFile (#21873)

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Revert "APPEALS-44916: Case Distribution Affinity Calculations (#21666)" (#21888)

* Revert "APPEALS-44916: Case Distribution Affinity Calculations (#21666)"

This reverts commit 7aa04e6713759c3212820a78aa6500863dd7f91a.

* fix users seed spec

* Revert "feature/APPEALS-43597 RC (#21860)" (#21895)

This reverts commit df60ddb567c3e02556e85ba37d555768d3a0de7e.

* Revert "APPEALS-47106 Caseflow Swagger (#21847)" (#21901)

This reverts commit c3bc5012618d614c3d017ae0f260a91c6d4aebec.

* sbashamoni/APPEALS-43724 Node 16 version upgrade changes (#21966) (#21975)

* Update node verstion to 16 in git workflow

* Update node verstion to 16 in nvm and dockerfile for demo

* Update node version in yarn.lock and package.json and .nvmrc file

* Update node's version path to node16 in docker-bin/env.sh

* Update and upgrade to node16 in client

* More updates to yarn.lock and package.json

* Fix tests by Adam Shaw

* Upadate snapshot for ScheduleVeteran.test.js.snap

* Doing some code clean up

* Doiing some more clean up

* Add and remove spaces to match master

* One more space to take care of

* One more space to take care of again

* One more space to take care of again

---------

Co-authored-by: ramon-chavez <Ramon.Chavez@va.gov>

* APPEALS-47277 remove Vegas office (#21876)

* APPEALS-47277 remove Vagas office

* Removed Texas ID from other files and updated tests

* Snapshot update

---------

Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* hotfix/APPEALS-22403 (#21942)

* add identifier for filenumber or ssn in filenumber search

* linting

* codeclimate linting

* update match call to return boolean

---------

Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>

* APPEALS-46907: Update to Determination of Gen Pop Legacy Cases (#21986)

* Isaiah/merge 46910 (#21983)

* removed BFHINES checks and modified tests

* removed lingering bfhines test

* modified test

* most recent updates on tests for passing status

* removed refs to cavc updates

* Skip flaky test ro_viewhearsched_spec

---------

Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>

* APPEALS-44916: Case Distribution Affinity Calculations (#21899)

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fix migration for null affinity start date column

* fixes, added tests

* more test updates

* add return in job if no query results, tests for no query results

* add test for after_save hook adding dist task instructions

* set start dist job to queue affinity job after running

* fix update job and start dist job spec

* queue affinity update job from push job

* code clarity

* fix judge in seed file

* remove comment, fix hearing factory, disable some seeds for testing

* add more tests

* test refactor

* update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory

* disable new seed on reset

* update seed file with vet names, add another seed category

* fix distirbuted case factory?

* actually fix GHA runs

* lint, test fixes

* change constants in new job

* APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611)

* swap distribution queries from distribution_task to appeal_affinities

* update seed files to use appeal affinities instead of distribution task

* clean up seed file method names

* add missing Timecop.return in ama affinity case seed

* fix name of a method in a seed file

* remove references to distribution task in distribution scopes

* fix push priority job tests

* fix naming of args in one of the seed files

* fix user seed, fix date format in distribution task instructions

* fix tests for date format update

* Calvin/APPEALS-44957-rake-affinity (#21577)

* grabbed receipt dates from distributed cases

* refactored for functionality + added method to grab appeals that match

* using receipt date, get all related appeals

* added update/creation plus cleaned prior imple.

* gets most recent distributed case receipt_date

* skips if receipt_date is nil for performance

* if appeal affinity is nil, it will now be updated

* created spec file

* fixed non ready appeals

* updated query to match new AC

* removing comment

* testing for each docket

* updated spec file

* added new tests to rspec

* updated start date to receipt date instead of Time.now

* fixed date/time rspec errors

* added rails logger to know when rake task has finished

* added tag for rails log

* removed nonpriority dockets for direct_review and evidence_submission

* fixed lint issue

* fixed flaky spec test

* limits distributed cases query to within the last week

* APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660)

* add affinity start date to explain page

* add feature test to verify dates display

* update rake task and spec (#21731)

* APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730)

* add aod hearing cases to ama affinity cases seed

* fix lever spec

* APPEALS-45148: Hook to clear saved affinity date (#21623)

* initial imp. idea

* AC1: check for affinity_start_date on assignment

* AC2/3: update affinity start date  w/ instr.

* updates to naming, instructions, and hook logic

* updates after review

* rspec coverage and addtional condition

* removed unused identifier

* removed reduntant 'self's

* added update on actual AA record

* updated to save aa record and addtional rspec

* added change to assignment on no record test

* check for assignment

* addd update to 'on_hold' status

* public method to handle legacy affinity appeals

* added .reload to :with_affinity_appeal

* added .reload to :ready_for_distribution

* updates to pass explain_spec

* switched boolean values

* typo

* readujsted order on :create for affinity appeal

* removed after(:create)

* testing rspec by readding after :create

* reloading in assertation

* addressing lint errors

* fix seeds/users_spec

* add case dist lever to new tests (#21776)

* remove unnecessarily included module from job (#21827)

* APPEALS-47211: Improve Performance of Distribution Queries (#21840)

* rework ready_for_distribution scope

* fix non-hearing docket distribution bug

* restart tests

* added null checks for appeal affinity in distribution queries, update tests (#21893)

* add check for appeal being active to distribution and associated slack message (#21902)

* Update users_spec.rb

---------

Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>
Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>

* hotfix/APPEALS-45177: TaskTable Default Sorting Fix (#21772)

* Updated the TaskTable component to use the defaultSort property instead of the defaultSortIdx property for queue table since that property is not used anywhere. Added a default sorting hash to the UnassignedCasesPage component and now pass that down to TaskTable. Removed references to defaultSortIdx.

* Added the type column default sort to the AssignedCasesPage widget as well.

* Added a parenthesis for clarity around a boolean. Moved the defaultSortingHash out into a constants file.

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* APPEALS-47106 Caseflow Swagger (#21993)

* Add Rswag and convert existing API documentation (#21778)

* add rswag

* Update Gemfile.lock

* Setup yaml UI

* remove and reroute old swagger files

* update format and servers values

* Update route_docs_controller.rb

* Update cmp_controller.rb

* cmp endpoint yaml

* cmp endpoint to return 501

* CMP endpoint swagger flies

* update swagger files

* adjust server order, add auth token

* cmp parameter name change

* add comments

* Update users_controller.rb

* unit tests and linting

* lint fixes

* Update swagger_helper.rb

* APPEALS-48048 Swagger Updates (#21909)

* update servers to not include a host

* remove host for server

* remove generated swaggers from definitions

* remove internal API endpoints from having generated swagger

* IDT servers fixes

* disable CMP swagger in prod and prodtest

* set authorization correctly

* fix what is required for CMP upload

* fix linting issues, update lint rake task to autocorrect for rubocop, add rubocop make command

* Update decision_reviews.yaml

* Update ama_issues.yaml

* Update vacols_issues.yaml

* Update swagger.yaml

* fix check failures

* Update docs_controller_spec.rb

* fix unit tests

* Update fetch_all_active_legacy_appeals_job_spec.rb

* Update rswag_ui.rb

* Update lint.rake

* Update decision_reviews_spec.rb

* Update fetch_all_active_legacy_appeals_job_spec.rb

* Update veterans_controller_spec.rb

* feature/APPEALS-43597 RC1.5.1 (#21996)

* APPEALS-36759 Add sms_response_content and sms_response_time notifications table

* APPEALS-37003 First pass at job refactor

* APPEALS-37003 Add comments and update kwargs for va notify service

* APPEALS-37003 Update spec files

* APPEALS-37003 Update spec

* APPEALS-37003 Ensure user in job and create email_enabled method

* APPEALS-37003 Remove question mark

* Limit max retry attempts to 5

* Add ? to boolen return methods

* jcohen/APPEALS-43706 (#21444)

* APPEALS-43706 macros added to each model file for the polymorphic relationship to be setup.

* APPEALS-43706 migration made and yet to be run.

* APPEALS-43706 migrations ran and expected columns and indexes are in table.

* Fix some spec failures unrelated to this branch

* Limit schema diff

* Add a missing tab

* Fix more unrelated failures. Also prevent ACD lever seeds from overwriting spec output

* Fix last unrelated failure.

* APPEALS-43706 linting issues in va_notify_service fixed.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* [APPEALS-43598] Quarterly Notification Job refactoring (#21505)

* Quarterly Notification Job refactoring

* APPEALS-43598 Fix lint issues for QuarterlyNotificationsJob refactor

* APPEALS-43598 Fix db schema.rb file

* APPEALS-43598 Fix schema.rb file

* APPEALS-43598 Refactoring QuarterlyNotificationsJob for readability

* APPEALS-43598 Refactoring QuarterlyNotificationsJob and removing extra methods

* [APPEALS-43598] Update method name

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-44007: Eliminate Transmission of Notifications to Deceased Veterans (#21481)

* APPEALS-44007: Writing tests to ensure adding the 'failure due to deceased' information is properly set and added to the db

* updates to pr

* pushing changes for tonight

* updating spec file to handle enabling and disabling feature flags

* Update format_message_status

* Lint roll

* fixing conflicts

* Updates to send notification spec

* Fix one of the legacy test cases

* Remove accidental push

* Fix remaining test

---------

Co-authored-by: Noah Hansen <nhansen@Noahs-MacBook-Pro.local>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-45235: Remove Temporary PDF Files From tmp Directory After All eFolder Upload Attempts (#21557)

* Cleanup files after uploading to VBMS

* Only delete file if it exists

*…
jcroteau added a commit that referenced this pull request Jul 26, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
sbashamoni pushed a commit that referenced this pull request Jul 26, 2024
…d supporting PRs) (#22315)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove SSL redirect exemptions

It turns out that HSTS is being enforced at the `va.gov` domain level,
so exempting these routes at the Rails middleware level is futile.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.
jcroteau added a commit that referenced this pull request Jul 31, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
jcroteau added a commit that referenced this pull request Aug 1, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
jcroteau added a commit that referenced this pull request Aug 2, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
jcroteau added a commit that referenced this pull request Aug 13, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
jcroteau added a commit that referenced this pull request Aug 13, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
jcroteau added a commit that referenced this pull request Aug 16, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
jcroteau added a commit that referenced this pull request Aug 27, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
sbashamoni pushed a commit that referenced this pull request Aug 27, 2024
…2622)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.
jcroteau added a commit that referenced this pull request Sep 6, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
sbashamoni pushed a commit that referenced this pull request Sep 7, 2024
…t) (#22751)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.
jcroteau added a commit that referenced this pull request Sep 10, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
sbashamoni pushed a commit that referenced this pull request Sep 10, 2024
…lease) (#22776)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.
sbashamoni added a commit that referenced this pull request Sep 12, 2024
* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

---------

Co-authored-by: Jeremy Croteau <jeremiah.croteau@va.gov>
jcroteau added a commit that referenced this pull request Sep 12, 2024
This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614
sbashamoni pushed a commit that referenced this pull request Sep 12, 2024
…lease) (#22813)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.
sbashamoni pushed a commit that referenced this pull request Sep 13, 2024
…lease) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.
laurenyj pushed a commit that referenced this pull request Sep 13, 2024
…lease) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.
ThorntonMatthew added a commit that referenced this pull request Sep 16, 2024
commit 92df8ff
Merge: 6f2e676 e34da00
Author: William Medders <medders_william@bah.com>
Date:   Fri Sep 13 15:47:56 2024 -0500

    Merge branch 'master' of github.com:department-of-veterans-affairs/caseflow into hotfix/APPEALS-57839

commit 6f2e676
Author: William Medders <medders_william@bah.com>
Date:   Fri Sep 13 15:39:11 2024 -0500

    update jest test to have post meridiem time

commit 50c1764
Author: William Medders <medders_william@bah.com>
Date:   Fri Sep 13 15:18:09 2024 -0500

    Add fix for time slot buttons

commit e34da00
Author: Jeremy Croteau <jcroteau@users.noreply.github.com>
Date:   Fri Sep 13 14:48:10 2024 -0400

    feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

    * 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

    The following config settings are not backwards compatible:

    - config.action_dispatch.use_cookies_with_metadata
    - config.action_mailer.delivery_job

    Now that Rails 6.0 is stable on production, we can assume
    their default values going forward.

    * ✅ Fix flakey spec

    * 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

    Since we are making other cookie configuration changes in this PR for Rails 6.0,
    this is an opportune time to migrate this Rails 5.2 cookie setting to its
    default value as well.

    * ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

    While testing in PreProd, we discovered that, without these cookie config overrides,
    re-authentication was broken -- after logging out, a user could not log back in.

    Since the default settings are still optional going forward, we can restore these
    overrides and devise a solution to migrate cookies later.

    For more details, see Jira story APPEALS-54897:

    https://jira.devops.va.gov/browse/APPEALS-54897

    * ✨ Add new utility module for adding DB indexes concurrently

    Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
    for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
    since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
    to its extensive use on legacy migrations and should be deprecated moving
    forward.

    * 🗑️ Deprecate `Caseflow::Migration`

    * 🔧 Add instructive error message for non-concurrent `add_index` migrations

    * 🚨 Address linter / codeclimate complaints

    * ✨ Introduce `SslRedirectExclusionPolicy`

    To be used in the environment configuration settings for excluding exempt
    request paths from SSL redirects when `config. force_ssl = true`

    * ♻️ Replace deprecated controller-level `force_ssl`

    Replace deprecated controller-level `force_ssl` with
    equivalent configuration settings in preparation for
    the Rails 6.1 upgrade.

    * 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

    This will have no implications for Caseflow, since we are only using the `sqlite3`
    adapter nominally for the `demo_vacols` database, which is not actually being used
    in our demo environments (demo environments are deployed as `development` envs).

    * ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

    Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

    * ⬆️ Update rails and other gems as necessary

    * 🐛 Fix 'uninitialized constant' error when loading app

    * ⬆️ bin/rails app:update - Apply relevant changes

    * 🔧 Override default for `config.active_record.has_many_inversing`

    * 🔧 Assume default for `config.active_storage.track_variants`

    We're not currently using ActiveStorage in Caseflow, so it
    is safe to just assume the default here.

    * 🔧 Override default for `config.active_job.retry_jitter`

    The default jitter is probably safe, however, I'm not 100% sure that we
    don't have any jobs that need to be requeued with exact wait times. So
    we let's override this for now to stay on the safe side.

    * 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

    We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
    callbacks on existing Caseflow jobs, so the default should be fine here.

    For more background, see
    https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

    * 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

    This setting controls the `SameSite` optional attribute for the
    `Set-Cookie` header.

    `SameSite=Lax` means that the cookie is not sent on cross-site requests,
    such as on requests to load images or frames, but is sent when a user is
    navigating to the origin site from an external site (for example, when
    following a link). This is the default behavior if the SameSite attribute
    is not specified.

    `Lax` is currently the default assumed by both Chrome and Edge browsers
    when this attribute is left unspecified, so assuming this value
    should be sensible. It allows us to have our cake (blocking CSRF attacks)
    and eat it too (providing a logged-in experience when users navigate to
    Caseflow  across origins).

    For more background, see
    - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
    - https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

    * 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

    * 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

    We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
    so the default is safe to assume here.

    * 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

    The default is safe to assume.

    For more background, see
    https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

    * 🔧 Assume default for `config.active_record.legacy_connection_handling`

    The default should be safe to assume here, as we do not do any
    role or shard switching on database connections.

    For more background, see
    https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

    * 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

    We don't use the `form_with` helper anywhere, so this behavior change is
    inconsequential for us, and we can safely assume the new default.

    * 🔧 Assume default for `config.active_storage.queues.analysis`

    We do not use ActiveStorage, so the default is safe to assume here.

    * 🔧 Assume default for `config.active_storage.queues.purge`

    We do not use ActiveStorage, so the default is safe to assume here.

    * 🔧 Assume default for `config.action_mailbox.queues.incineration`

    We don't use ActionMailbox, so the new default is safe to assume here.

    * 🔧 Assume default for `config.action_mailbox.queues.routing`

    We do not use ActionMailbox, so the default is safe to assume here.

    * 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

    We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
    so the default is safe to assume.

    * 🔧 Assume default for `config.action_view.preload_links_header`

    This flag can be safely uncommented. Browsers that support Link
    headers will get a performance boost. Browsers that don’t will
    ignore them.

    We override in `development` environments to avoid an edge case
    leading to an HTTP response header overflow.

    For more background, see
    https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

    * 🔥 Remove 'new_framework_defaults_6_1.rb'

    * 🔧 Load defaults for Rails 6.1

    * ♻️ Extract constant

    * ♻️ Migrate to new Rails deprecation config where applicable

    * ♻️ Push members down now that there is only one subclass

    * 🩹 Add forgotten disallowed deprecation warning

    This deprecation warning was addressed by the following
    PR, but we forgot to add it to the list of disallowed
    deprecation warnings:

    #21614

    * 💡 Update comment

    Task `rake routes` has been replaced with `rails routes`

    * ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

    `ActionDispatch::Response#content_type` now returns the full Content-Type header

    * 🚨 Exclude 'config.ru' from Rubocop cops

    * 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

    * 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

    * ♻️ Arrange 'database.yml' configs by environment

    Group DB configs by environment in anticipation of
    reformatting for Rails 6+ multi-DB configuration.

    * 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

    * 🔧 Add etl migration paths to DB config

    * 🔧 Update DB connection names in 'database_cleaner' config

    * ♻️ Use new database-specific rake tasks

    After migrating to the Rails 6+ native multi-database configuration,
    the behavior of some DB management tasks, such as `rake db:migrate`
    changed such that they now act on ALL databases and not just the
    primary database. So we must replace the invocations of these
    tasks with their new, database-specific counterparts.

    * ➖ Remove 'multiverse' gem

    Now that we have fiully transitioned to Rails-native
    multi-database support, we are no longer reliant on
    the 'multiverse' gem and can remove it.

    * 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

    After transitioning to Rails-native multi-DB support,
    the behavior of some DB tasks changed such that they will now
    act on ALL databases and not just the primary database
    (ex. `rake db:migrate` will now migrate ALL databases).

    To avoid accidents, we re-define these tasks here to no-op
    and output a helpful message to redirect developers toward
    using their new database-specific counterparts instead.

    * ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

    Instead of performing a bunch of hard-to-maintain `sed` gymnastics
    to modify the existing 'test' environment, let's create a new
    'make_docs' environment (based off of 'test') and configure it
    appropriately for use by the 'Make-docs-to-webpage' GH workflow.

    * 💚 Remove redundant DB migrations from CI workflow

    Task `db:schema:load` already loads the checked in schema,
    so there should be no need to run `db:migrate` afterwards.

    * 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

    Addresses the following error:

      NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

    * 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

    Addresses the following error:

      FrozenError: can't modify frozen Hash: {}

    * ✅ Add test for `RoSchedulePeriod`

    * 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

    Apparently, there were some changes to the inner workings of
    `ActiveModel::Errors` in Rails 6.1, causing a model to be
    considered invalid in the case that `errors[:base] == [[]]`.
    This makes sense, as `[[]]` is not considered "empty".

    Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
    to inadvertently mark the model as invalid upon creation.
    `HearingSchedule::ValidateRoSpreadsheet #validate` returns an
    empty array (`[]`) when valid, which gets pushes onto the
    `RoSchedulePeriod` `errors[:base]` array, resulting in a
    non-empty array (`[[]]`) and an erroneously invalid disposition.

    Furthermore, calling `<<` to an `ActiveModel::Errors` message array
    in order to add an error is a deprecated, so we can take this
    opportunity to use the new `#add` API to hit two birds with one stone.

    The change implemented here is not a pure refactoring, however the
    end-user experience is unchanged in terms of how errors are presented
    when attempting to upload a spreadsheet with multiple non-conformities.

    Down the road, we may want to consider moving
    `HearingSchedule::ValidateRoSpreadsheet` toward using
    `ActiveModel::Validations` in order to leverage the
    full `ActiveModel::Errors` API and construct the
    errors object in the prescribed manner.

    For more details see
    - https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
    - https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

    * 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

    * ✅ Fix `spec/models/veteran_spec.rb`

    * ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

    Addresses failures such as the below:

      0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
         Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

           expected: "76"
                got: 0.76e2

    * ✅ Fix multiple specs - `Minitest::UnexpectedError`

    Test helper method `#perform_enqueued_jobs` now wraps exceptions
    in an `Minitest::UnexpectedError`:

    https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

    So, to assert that a specific
    exception is raised during execution of the `#perform_enqueued_jobs`
    block, we must rescue the `Minitest::UnexpectedError` and make the
    assertion on its error message instead.

    * ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

    * ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

    In Rails 6.1, `ActiveJob #perform_now` was changed to
    behave as it did once before (at the behest of GitHub),
    returning the value fo the job instead of true/false.

    See related GH issue: rails/rails#38040

    * 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

    Addresses error:

      NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

      0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
         Failure/Error: errors: errors.messages[:workflow],

         NoMethodError:
           undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

    * 🐛 Fix `CaseSearchResultsBase` validations

    Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
    similar to the below:

      AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
         Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

           expected: "Veteran file number missing"
                got: nil

    Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
    somewhat permissible in the past, but it is an abuse of the object's intended use and is
    also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

    In order to preserve the existing response shape of the affected JSON endpoints,
    we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
    (and its descendent classes) to a more bespoke method of performing validations and aggregating
    errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

    * ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

    Addresses the test failure below:

        ApplicationController no cache headers when toggle set sets Cache-Control etc
         Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

           expected: "no-cache, no-store"
                got: "no-store"

           (compared using ==)

    In Rails 6.1, the `no-store` directive is exclusive of any others
    that are set on the `Cache-Control` header, which makes sense given
    the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

    This change was implemented in PR rails/rails#39461

    Since it no longer makese sense to set both `no-store` and `no-cache` directives,
    we will only set `no-store` here, as that is the stronger of the two.

    * 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

    Addresses multiple test failures caused by the error below:

      QueueConfig.to_hash title when assigned to an org is formatted as expected
         Failure/Error:
           tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
             label = self.class.format_option_label(option, count)
             self.class.filter_option_hash(option, label)
           end

         ActiveRecord::EagerLoadPolymorphicError:
           Cannot eagerly load the polymorphic association :appeal

    * 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

    In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
    will now clear any records cached by the calling relation.

    This was altering the behavior of `Task #cancel_task_and_child_subtasks`
    and causing the following test failure:

      Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
         Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

           expected: 3
                got: 2

           (compared using ==)

    To remedy, we will now cache the necessary Task records in an Array, which can
    be used for generating PaperTrail versions both before and after the `update_all`.

    * 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

    Addresses the following test failure:

      Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
         Failure/Error: expect(ical_event.description).to eq(expected_description)

           expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
                got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

    * 🐛 Fix YAML syntax error caused by whitespace in ENV var

    Address the following error, found during demo deployment:

      rake aborted!
      Cannot load database configuration:
      YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

    * ⬆️ Update `caseflow-commons` dependency to latest ref

    Removes `bourbon` and `neat` dependencies.
msteele96 added a commit that referenced this pull request Sep 16, 2024
* Calvin/APPEALS-43852-cavc-levers (#21441)

* enabled cavc affinity levers in UI

* updated rspec

* [APPEALS-43849]Update CAVC Affinity Implementation for AMA Dockets to… (#21456)

* [APPEALS-43849]Update CAVC Affinity Implementation for AMA Dockets to Account for Omit/Infinity

* Affinity rules applied to non genpop

* Addressed comments

* Addressed comments

* fixed rubocop issues + added clarity to where clause

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fix migration for null affinity start date column

* fixes, added tests

* more test updates

* add return in job if no query results, tests for no query results

* add test for after_save hook adding dist task instructions

* set start dist job to queue affinity job after running

* fix update job and start dist job spec

* queue affinity update job from push job

* code clarity

* fix judge in seed file

* remove comment, fix hearing factory, disable some seeds for testing

* add more tests

* test refactor

* update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory

* disable new seed on reset

* update seed file with vet names, add another seed category

* fix distirbuted case factory?

* actually fix GHA runs

* lint, test fixes

* change constants in new job

* [Appeals 43850] Update Legacy Docket Queries to Account for the Previous Decision Judge and Type Action  (#21556)

* test changes for seans ticket

* test changes

* added joins to all required methods

* fixed lint

* fixed column ambiguity errors

* cleaned up naming scheme

* Documentation for JOIN_PREVIOUS_APPEALS constant

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611)

* swap distribution queries from distribution_task to appeal_affinities

* update seed files to use appeal affinities instead of distribution task

* clean up seed file method names

* add missing Timecop.return in ama affinity case seed

* fix name of a method in a seed file

* remove references to distribution task in distribution scopes

* fix push priority job tests

* fix naming of args in one of the seed files

* fix user seed, fix date format in distribution task instructions

* fix tests for date format update

* APPEALS-44187: Factory Bot Additions (#21438)

* AC1: values for bfddec and bfmpro

* AC2: case issues updated to '3'

* AC3-4: attorney and judge additions

* ac 5: bfdpdcn addition

* AC6: case type action addition

* ac7: new folder match to original

* ac8: case issues set to original

* AC 3/4: added associations to original

* ac3/4: updated logic to handle no args

* ac3/4: return sattyid

* ac7:updating folder assignment

* ac7: added bfkey to except block

* ac7/8: update to case issue list and validations dismissed

* removed byebug

* ac7: added 'ticknum' to except

* lint fixes

* lint fixes

* lint fixes

* lint fixes

* nested trait into form_9 factory

* new addtions

* added .save to case issues

* resolving correspondent and titrnum associations

* fixed bfdc typo

* factory additions

* added ssn to associated corr.

* removed transient and added .save

* added after create to corr factory

* veteran lookup check prior to create

* committing missed 'end'

* moved over veteran create to case fact.

* move corr. association field to case fact.

* lint issues + corres. save

* Calvin/APPEALS-44957-rake-affinity (#21577)

* grabbed receipt dates from distributed cases

* refactored for functionality + added method to grab appeals that match

* using receipt date, get all related appeals

* added update/creation plus cleaned prior imple.

* gets most recent distributed case receipt_date

* skips if receipt_date is nil for performance

* if appeal affinity is nil, it will now be updated

* created spec file

* fixed non ready appeals

* updated query to match new AC

* removing comment

* testing for each docket

* updated spec file

* added new tests to rspec

* updated start date to receipt date instead of Time.now

* fixed date/time rspec errors

* added rails logger to know when rake task has finished

* added tag for rails log

* removed nonpriority dockets for direct_review and evidence_submission

* fixed lint issue

* fixed flaky spec test

* limits distributed cases query to within the last week

* APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660)

* add affinity start date to explain page

* add feature test to verify dates display

* Sudhir/appeals 43851 (#21613)

* Implement CAVC + AOD Affinity Lever for AMA Dockets

* addressed comments

* addressed comments

* Addressed comments

* added cavc_aod_affinity in case distribution lever model

* addressed comments

* addressed comments

* updated specs

* Updated specs

* specs changes reverted

* ama_aod and ama_non_aod queries updated

* change the assertion in docket spec

* Craig/appeals 46196 (#21689)

* fix query, tested locally

* add basic test to verify csv downloads aren't broken

* APPEALS-43851: Add test to validate CAVC+AOD behavior on hearing docket appeals affinities (#21678)

* add test to validate cavc+aod on hearing docket appeals

* lint, test case_docket_spec fix

* modify case_docket_spec again

* more test fix testing

* attempt to fix test again

* test removing prev appeals from nonpriority queries

* more test tests

* feature toggle change in test

* reorder new portions of query

* remove unused portions of queries in case_docket

* revert unneeded change to query order

* revert unneeded change to query order

* update rake task and spec (#21731)

* APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730)

* add aod hearing cases to ama affinity cases seed

* fix lever spec

* APPEALS-45148: Hook to clear saved affinity date (#21623)

* initial imp. idea

* AC1: check for affinity_start_date on assignment

* AC2/3: update affinity start date  w/ instr.

* updates to naming, instructions, and hook logic

* updates after review

* rspec coverage and addtional condition

* removed unused identifier

* removed reduntant 'self's

* added update on actual AA record

* updated to save aa record and addtional rspec

* added change to assignment on no record test

* check for assignment

* addd update to 'on_hold' status

* public method to handle legacy affinity appeals

* added .reload to :with_affinity_appeal

* added .reload to :ready_for_distribution

* updates to pass explain_spec

* switched boolean values

* typo

* readujsted order on :create for affinity appeal

* removed after(:create)

* testing rspec by readding after :create

* reloading in assertation

* addressing lint errors

* fix seeds/users_spec

* add case dist lever to new tests (#21776)

* fix tests, add lever to factory, fix dist scopes (#21779)

* fix rubocop warning

* Acd/appeals 43853 43854 (#21971)

* Calvin/appeals 43853 (#21723)

* initial updates

* removing unnecessary variable

* focused in on priority

* removing non priority stuff

* added general comments

* added BFAC and AOD to cavc aod lever query

* adding judge vacols id to query

* aod affinity_start_date filter initial changes

* fixed sorting

* fixed rubocop issues

* updated filter method

* error handling

* added ineligibility to queries for PREV_DECIDING_JUDGE

* fixed SQL query + added comments

* added exclude from affinity check into the case docket queries

* error handling + fixing sql queries

* rejects appeals without affinity_start_dates and nonmatching judges

* fixing rubocop offenses

* fixed inconsistencies between methods

* fixed conditions for rejecting appeals

* refactored cavc aod affinity filter to make it much easier to read

* refactored code to account for AC6

* error handling for empty exclude from affinity

* reverted next if block to old logic to ensure it works

* added PREV_DEC_JUDGE is not null

* case.rb factory changes

* added more options to legacy_cavc_appeal creation

* cleaned up code for simpler reading

* fix for aod legacy cavc creation

* added tied to option to legacy cavc appeal factory

* limits are now handled correctly in query

* replaced return false to next if, as return false was causing unexpected behavior

* fix rspecs + one edge case

* added cavc aod lever creation to rspecs

* removed bfac and aod from nonpriority query

* cavc aod appeals w/excluded judges are now properly being filtered

* refactored excluded judges check

* added to old query to fix rspec errors

* modified case factory bot

* query now handles when prev_deciding_judge is nil

* removed unnecessary condition

* fixed case factory to now have tied_to attatched to orig appeal

* fixed next if block within filter

* handles omit scenarios + correctly rejects with next

* working on rspec (still failing)

* fix for ineligble VLJ when infinite

* fixed rspec suite for cavc aod filters

* fixed omit scenario in cavc aod affinity filter

* consolidation & readability refactor

* rubocop fixes

* fixed spec error

* Implement CAVC Affinity for Legacy Docket (#21706)

* Implement CAVC Affinity for Legacy Docket

* addressed comments

* Added BFAC in the query

* code changes for affinitty date

* Added affinity code

* code refactor and removed non priority code changes

* fixed syntax change

* Addressed comments

* refactor cavc affinity filter

* refactored code

* code refactor

* code refactor

* Updated existing specs

* code refactor

* Added new rspecs

* code refactor and added test  cases

* code refactor

* added test cases

* fixes push_priority_spec

* fixed rubocop issues

* rubocop issue fixed

* refactored code to make it easier to understand

* refactored + fixed rspec and lint errors

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>
Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>

* basic creation of legacy affinity cases seed data

* bug fixes, added bfcorlid with veterans, fully runs now

* added new appeals for affinity_and_tied_to_judge

* made data have realistic bfcorlids

* changes document sequence to use less digits

* added new file numbers for tied_to cases to make them easier to identify

---------

Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com>

* APPEALS-50692: Update Appeals Ready to Distribute CSV to include CAVC remand original judge (#22070)

* CSV download functional

* add tests, fix CSV query in CaseDocket

* fix lint

* Remove transaction_wrapper

* Remove extra newline

* Calvin/appeals 44313 (#22119)

* initial seed data file

* added legacy cavc and cavc aod affinity cases

* update

* fixed tied to for legacy appeals

* added AOD versions of appeals

* small lint fixes

* ensured AOD cases for legacy hearings with exluded or ineligible judge

* added vacols staff record creation for users without it

* APPEALS-51045: Remove ReceiveNotificationJob (#22207)

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* MattT/APPEALS-51115: Initialize FIFO SQS Queues Locally (#22182)

* Set local env to utilize FIFO queues where appropriate

FIFO queues are configured with the same attributes as our queues in higher environments.

* Resolve failing test

* Remove defunct test

* Update make commands

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* APPEALS-47741: Update the UpdateAppealAffinityDatesJob to add appeal_affinity records for Legacy Appeals (#22023)

* AC1: changes and respective tests

* adjustements after refactoring

* identifier mismatch

* name update

* name update

* added appeal affinity filter

* updated comment

* remove byebug

* update rspec to handle hash input

* added no start date test case

* updated process method test

* removed 'todo' comment

* dried up query string

* aligned conditions

* update to hash quotations

* update to hash quotations

* added legacy to priority receipt dates from dist.

* moved append to resulting list

* added legacy receipt date to push job hash

* uncomment call to legacy

* updated dist.id to @dist_id

* uncomment call to process legacy appeals

* handling update to legacy docket type

* current rspec status

* fixed typo

* fix rspec

* legacy spec additions

* legacy spec additions

* added legacy dist. case factory

* removed vacols_judge ref

* updates for spec

* final review

* removed comment

* rubocop fixes

* fix rubocop warnings (#22225)

* APPEALS-51847: Institute Database Migration for Establishing 'sms_status_reason' and 'email_status_reason' Columns (#22208)

* adding and running migration

* adding comments to migration and re running db:migrate

* pushing up original scheam

* committing schema

* small edit to migration and deleting unnecessary columns from schema

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Fix rubocop and tests (#22231)

* removing job and all mentions of job (#22212)

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-51059: Alter Select Quarterly Statuses (#22239)

* Alter status messages

* Save more info in fake response

* Swap keys

* Add missing param

* Test fixes. Also, setting appeal_docketed to false whenever appeals are decided or cancelled

* Fix fasterer issue

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-51101: Rewrite ProcessNotificationStatusUpdateJob to Consume Messages from an SQS Queue (#22247)

* Update fake response body

* Try enabling localstack in CI

* Init SqsService and alter most/all of the ProcessNotificationStatusUpdatesJob

* Create SQS queues in test env

* Change port formatting

* Mount docker socket

* Try localstack hostname

* Wait for localstack in CI

* Add more yarddoc comments

* Log errors and number of messages processed

* Add custom error classes

* Add yarddoc comments to SqsService class

* Create SqsService spec file

* Redo much of ProcessNotificationStatusUpdatesJob's spec file

* Disable line length checks for yarddoc comments

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Calvin/appeals 52551 (#22293)

* age_of_n_oldest_priority_appeals_available_to_judge time out changes

* fixed timeout issue for distribute_priority_appeals

* fixed lint errors

* Craig/case docket optimization (#22294)

* age_of_n_oldest_priority_appeals_available_to_judge time out changes

* fixed timeout issue for distribute_priority_appeals

* optimize case docket priority distribution methods

* fix das deprecation distribution spec

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-51087: Rewrite Api::V1::VaNotifyController#notification_update Controller Action to No Longer Utilize Redis (#22295)

* initial push

* rubocop'n

* fixing tests?

* rubocop'n

* addressing most of matt's comments

* removing yard doc files and keeping comment

* rubocop

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* Update admin_ui_spec.rb for CAVC levers being enabled

* Remove extra attribute

* Fix incorrect log counts

* Fix log statement

* Fix typo

* APPEALS-53603: Modify logic to always show recipient information if present (#22414)

* initial commit

* making rspec tests happy

* linting

* adding tests back and refactoring

* small char error

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* Sync decided appeals with states table (#22434)

* APPEALS-52882 Sync decided appeals decision_mailed status

* APPEALS-52882 Fix lint issues

* APPEALS-52882 Fix codeclimate issues

* APPEALS-52882 Address PR feedback

* APPEALS-52882 Address PR feedback

* Jcohen/APPEALS-52861 (#22450)

* APPEALS-52861 Bug fix implemented.

* APPEALS-52861 cleaned up some code through aliasing a common method name between appeal_types, eliminating a check that we do in the AppealDecisionMailed module.

* APPEALS-52861 fixed method name error.

* APPEALS-52861 fixed some tests.

* APPEALS-52861 fixed More tests.

* APPEALS-52861 fixed More tests.

* APPEALS-52861 feature branch changes merged in with working branch and method name changes extracted.

* APPEALS-52861 feature branch changes merged in with working branch and method name changes extracted, included case statement.

* APPEALS-52861 moved case statement to another file to be the boolean check for constested status on an appeal.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-52892: For all legacy appeal states/notifications check status in VACOLS (#22455)

* initial commit

* addressing comments

* small change

* making tests
happy

* fixing spec tests

* rubocop'n

* reverting

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-53993: Update Implementation of Legacy Appeals with Hearing Held (#22473)

* implement new hearing requirement and test

* first pass at seed data for testing

* add new case to test and seed, fix typo and comments

* update for new 8.2.1.1 requirement

* fix rubocop warning

* fix error in seed file

* add new affinity scenario to seed data

* make some seed methods private

* fix rubocop warnings

* APPEALS-55159: Parameter Requirements Are Too Stringent Given What We Will Expect from VA Notify (#22561)

* APPEALS-55159

* updating tests

* APPEALS-55159 Refactor permitted and required params

* APPEALS-55159 Fix linting issue

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: msteele <Marc.Steele@va.gov>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* Adding rake task to sync decided appeals (#22492)

* APPEALS-52872 Add rake task to sync decided appeals

* APPEALS-52872 Remove byebug

* APPEALS-52872 Fixing lint errors

* APPEALS-52872 Addressing performance issues

* APPEALS-52872 Addressing performance issues

* APPEALS-52872 Fix ENV variable update

* APPEALS-52872 Parallelizing AppealState updates

* APPEALS-52872 Remove byebug

---------

Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* Prevent Prodtest from contacting VA Notify Staging (#22629)

* APPEALS-54918 Update VA Notify fake service and initializer

* APPEALS-54918 Add CASEFLOW_BASE_URL env var in demo/dev

* APPEALS-54918 Add seed file for API Key and added to main seed execution

* APPEALS-54918 Add missing argument to method definition

* APPEALS-54918 Update "to" params and fix linting issues

* APPEALS-54918 Prevent post requests in test env

* Rename ApiKeys seed file

* Fix linting error on require statement

* Add argument for call within sync_review_job.rb and minor refactor

* Inherit seed from base, align with AMA for seed file placement

* added test cases for infinite and omit levers with desired outcomes

* add check for hearing date to levers being infinite

* fix lint

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22776)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* APPEALS-57351 Inactive Appeal Errors present when outcoding an appeal (#22721)

* APPEALS-57351 add template name check to handle errors

* APPEALS-57351 Add template_name argument to spec tests

* Update app/models/prepend/va_notify/appellant_notification.rb

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-57351 Partial rspec updates, pushed before handing off

* APPEALS-57351 Add specs requested during review

* Update spec/controllers/idt/api/v2/appeals_controller_spec.rb

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* feature/APPEALS-50882 - Open Telemetry configuration and implementation (#22787)

* feature/appeals-45972 (#21950)

* Remove UUID from attrs sent_to metrics. (#21630)

* Remove UUID from attrs sent_to metrics.

* pushing with some linting issues for visibility.

* Change config implementation.

* Remove UUID from spec

* remove uuid from update_appellant job

* diable rubocop for open_telemetry init

* OTEL fixes

* rescue, errors

---------

Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>

* add otel reqs

* Remove throw

* comment out otel file loop

* try vendor suggested config

* update otel config to match vendor

* update pg gem

* otel include dt_host file

* otel require bundler and rubygems

* otel subset of instrumentation

* Revert "update pg gem"

This reverts commit fc1a45d.

* update redis and minimize otel instrumentation to just rails, rack, and activerecord

* otel add use_all except pg and redis

* otel require instruments

* otel fix typo

* otel fix typo

* otel comment out net_http

* otel silence aws sdk internals

* otel silence aws sdk internals

* otel add net http

* Individually use OTEL instruments (#22082)

* Individually use OTEL instruments
with options.

* disable AwsSdk only. Checking Rack options.

* re-require awssdk even while disabled.

* disable awssdk

* disable datadog for testing

* change sequence factory to properly seed

* updated opentelemetry and datadog configs

* rack context getter initalizer

* use one at a time

* add curly braces

* Revert change

* revert change

* Revert change

* Revert change

* Remove gemfile grouping

* Remove datadog.

* ActionPack and Actionview changes

* APPEALS-44287: Excluding disposition held and select that appeal for distribution  (#22277)

* first run at an SQL query removing duplicate appeals from distribution

* code refactor and excluding disposition held and select that appeal for distribution

* automated test for the duplicate hearing bug

* fix rubocop offense SpaceInsideBlockBraces

---------

Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>

* Update bundler to 2.4.22

* Updating OTEL to use all and remove new relic gem

* Remove calls to new relic

* removed id attrs in metrics service calls that were causing dimension errors

* Update config for otel

* Reorder gems to fix linting issues

* Updating config and refactoring verbose gems to add all

* Reinstall gems

* Adding all instruments

* Update config to only include basic instruments

* Update Gemfile.lock

* Adding rake to gemfile

* Adding instruments

* Comment out PG and ActiveSupport

* Suppress AWS logs

* Remove redis and turn on actionview

* Turn actionview off

* Add Redis instrumentation back

* Turn ActionPack back on

* Disable Redis

* Remove mentions of Datadog

* Removed extra mentions of Datadog

* removed newrelic references and yml file

* Test updating workflow

* Revert workflow change

* Adding simplecov back

* Fixing linting error

* Removing by: attribute after removing keyword in metric service

* Adding simplecov lcov gem and updating workflow

* Update workflow

* Updating simplecov

* Revert simple cov

* Adding featureenvy skip for reek

* Update service name. (#22762)

---------

Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: alex-guanipatin <alex.guanipatin@va.gov>
Co-authored-by: Drew Hadley <50673809+VandelayUtd@users.noreply.github.com>

* Remove unused variable with lint error. Re-introduce cert fixes

* Remove references to x86

* Revert "Remove references to x86"

This reverts commit fda290d.

---------

Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>
Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com>
Co-authored-by: Calvin <Calvin.Costa@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>
Co-authored-by: Craig Reese <Reese_Craig@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com>
Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>
Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: alex-guanipatin <alex.guanipatin@va.gov>
Co-authored-by: Drew Hadley <50673809+VandelayUtd@users.noreply.github.com>
roberttravispierce added a commit that referenced this pull request Sep 20, 2024
* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
AdamShawBAH pushed a commit that referenced this pull request Sep 20, 2024
* Calvin/APPEALS-43852-cavc-levers (#21441)

* enabled cavc affinity levers in UI

* updated rspec

* [APPEALS-43849]Update CAVC Affinity Implementation for AMA Dockets to… (#21456)

* [APPEALS-43849]Update CAVC Affinity Implementation for AMA Dockets to Account for Omit/Infinity

* Affinity rules applied to non genpop

* Addressed comments

* Addressed comments

* fixed rubocop issues + added clarity to where clause

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fix migration for null affinity start date column

* fixes, added tests

* more test updates

* add return in job if no query results, tests for no query results

* add test for after_save hook adding dist task instructions

* set start dist job to queue affinity job after running

* fix update job and start dist job spec

* queue affinity update job from push job

* code clarity

* fix judge in seed file

* remove comment, fix hearing factory, disable some seeds for testing

* add more tests

* test refactor

* update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory

* disable new seed on reset

* update seed file with vet names, add another seed category

* fix distirbuted case factory?

* actually fix GHA runs

* lint, test fixes

* change constants in new job

* [Appeals 43850] Update Legacy Docket Queries to Account for the Previous Decision Judge and Type Action  (#21556)

* test changes for seans ticket

* test changes

* added joins to all required methods

* fixed lint

* fixed column ambiguity errors

* cleaned up naming scheme

* Documentation for JOIN_PREVIOUS_APPEALS constant

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611)

* swap distribution queries from distribution_task to appeal_affinities

* update seed files to use appeal affinities instead of distribution task

* clean up seed file method names

* add missing Timecop.return in ama affinity case seed

* fix name of a method in a seed file

* remove references to distribution task in distribution scopes

* fix push priority job tests

* fix naming of args in one of the seed files

* fix user seed, fix date format in distribution task instructions

* fix tests for date format update

* APPEALS-44187: Factory Bot Additions (#21438)

* AC1: values for bfddec and bfmpro

* AC2: case issues updated to '3'

* AC3-4: attorney and judge additions

* ac 5: bfdpdcn addition

* AC6: case type action addition

* ac7: new folder match to original

* ac8: case issues set to original

* AC 3/4: added associations to original

* ac3/4: updated logic to handle no args

* ac3/4: return sattyid

* ac7:updating folder assignment

* ac7: added bfkey to except block

* ac7/8: update to case issue list and validations dismissed

* removed byebug

* ac7: added 'ticknum' to except

* lint fixes

* lint fixes

* lint fixes

* lint fixes

* nested trait into form_9 factory

* new addtions

* added .save to case issues

* resolving correspondent and titrnum associations

* fixed bfdc typo

* factory additions

* added ssn to associated corr.

* removed transient and added .save

* added after create to corr factory

* veteran lookup check prior to create

* committing missed 'end'

* moved over veteran create to case fact.

* move corr. association field to case fact.

* lint issues + corres. save

* Calvin/APPEALS-44957-rake-affinity (#21577)

* grabbed receipt dates from distributed cases

* refactored for functionality + added method to grab appeals that match

* using receipt date, get all related appeals

* added update/creation plus cleaned prior imple.

* gets most recent distributed case receipt_date

* skips if receipt_date is nil for performance

* if appeal affinity is nil, it will now be updated

* created spec file

* fixed non ready appeals

* updated query to match new AC

* removing comment

* testing for each docket

* updated spec file

* added new tests to rspec

* updated start date to receipt date instead of Time.now

* fixed date/time rspec errors

* added rails logger to know when rake task has finished

* added tag for rails log

* removed nonpriority dockets for direct_review and evidence_submission

* fixed lint issue

* fixed flaky spec test

* limits distributed cases query to within the last week

* APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660)

* add affinity start date to explain page

* add feature test to verify dates display

* Sudhir/appeals 43851 (#21613)

* Implement CAVC + AOD Affinity Lever for AMA Dockets

* addressed comments

* addressed comments

* Addressed comments

* added cavc_aod_affinity in case distribution lever model

* addressed comments

* addressed comments

* updated specs

* Updated specs

* specs changes reverted

* ama_aod and ama_non_aod queries updated

* change the assertion in docket spec

* Craig/appeals 46196 (#21689)

* fix query, tested locally

* add basic test to verify csv downloads aren't broken

* APPEALS-43851: Add test to validate CAVC+AOD behavior on hearing docket appeals affinities (#21678)

* add test to validate cavc+aod on hearing docket appeals

* lint, test case_docket_spec fix

* modify case_docket_spec again

* more test fix testing

* attempt to fix test again

* test removing prev appeals from nonpriority queries

* more test tests

* feature toggle change in test

* reorder new portions of query

* remove unused portions of queries in case_docket

* revert unneeded change to query order

* revert unneeded change to query order

* update rake task and spec (#21731)

* APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730)

* add aod hearing cases to ama affinity cases seed

* fix lever spec

* APPEALS-45148: Hook to clear saved affinity date (#21623)

* initial imp. idea

* AC1: check for affinity_start_date on assignment

* AC2/3: update affinity start date  w/ instr.

* updates to naming, instructions, and hook logic

* updates after review

* rspec coverage and addtional condition

* removed unused identifier

* removed reduntant 'self's

* added update on actual AA record

* updated to save aa record and addtional rspec

* added change to assignment on no record test

* check for assignment

* addd update to 'on_hold' status

* public method to handle legacy affinity appeals

* added .reload to :with_affinity_appeal

* added .reload to :ready_for_distribution

* updates to pass explain_spec

* switched boolean values

* typo

* readujsted order on :create for affinity appeal

* removed after(:create)

* testing rspec by readding after :create

* reloading in assertation

* addressing lint errors

* fix seeds/users_spec

* add case dist lever to new tests (#21776)

* fix tests, add lever to factory, fix dist scopes (#21779)

* fix rubocop warning

* Acd/appeals 43853 43854 (#21971)

* Calvin/appeals 43853 (#21723)

* initial updates

* removing unnecessary variable

* focused in on priority

* removing non priority stuff

* added general comments

* added BFAC and AOD to cavc aod lever query

* adding judge vacols id to query

* aod affinity_start_date filter initial changes

* fixed sorting

* fixed rubocop issues

* updated filter method

* error handling

* added ineligibility to queries for PREV_DECIDING_JUDGE

* fixed SQL query + added comments

* added exclude from affinity check into the case docket queries

* error handling + fixing sql queries

* rejects appeals without affinity_start_dates and nonmatching judges

* fixing rubocop offenses

* fixed inconsistencies between methods

* fixed conditions for rejecting appeals

* refactored cavc aod affinity filter to make it much easier to read

* refactored code to account for AC6

* error handling for empty exclude from affinity

* reverted next if block to old logic to ensure it works

* added PREV_DEC_JUDGE is not null

* case.rb factory changes

* added more options to legacy_cavc_appeal creation

* cleaned up code for simpler reading

* fix for aod legacy cavc creation

* added tied to option to legacy cavc appeal factory

* limits are now handled correctly in query

* replaced return false to next if, as return false was causing unexpected behavior

* fix rspecs + one edge case

* added cavc aod lever creation to rspecs

* removed bfac and aod from nonpriority query

* cavc aod appeals w/excluded judges are now properly being filtered

* refactored excluded judges check

* added to old query to fix rspec errors

* modified case factory bot

* query now handles when prev_deciding_judge is nil

* removed unnecessary condition

* fixed case factory to now have tied_to attatched to orig appeal

* fixed next if block within filter

* handles omit scenarios + correctly rejects with next

* working on rspec (still failing)

* fix for ineligble VLJ when infinite

* fixed rspec suite for cavc aod filters

* fixed omit scenario in cavc aod affinity filter

* consolidation & readability refactor

* rubocop fixes

* fixed spec error

* Implement CAVC Affinity for Legacy Docket (#21706)

* Implement CAVC Affinity for Legacy Docket

* addressed comments

* Added BFAC in the query

* code changes for affinitty date

* Added affinity code

* code refactor and removed non priority code changes

* fixed syntax change

* Addressed comments

* refactor cavc affinity filter

* refactored code

* code refactor

* code refactor

* Updated existing specs

* code refactor

* Added new rspecs

* code refactor and added test  cases

* code refactor

* added test cases

* fixes push_priority_spec

* fixed rubocop issues

* rubocop issue fixed

* refactored code to make it easier to understand

* refactored + fixed rspec and lint errors

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>
Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>

* basic creation of legacy affinity cases seed data

* bug fixes, added bfcorlid with veterans, fully runs now

* added new appeals for affinity_and_tied_to_judge

* made data have realistic bfcorlids

* changes document sequence to use less digits

* added new file numbers for tied_to cases to make them easier to identify

---------

Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com>

* APPEALS-50692: Update Appeals Ready to Distribute CSV to include CAVC remand original judge (#22070)

* CSV download functional

* add tests, fix CSV query in CaseDocket

* fix lint

* Remove transaction_wrapper

* Remove extra newline

* Calvin/appeals 44313 (#22119)

* initial seed data file

* added legacy cavc and cavc aod affinity cases

* update

* fixed tied to for legacy appeals

* added AOD versions of appeals

* small lint fixes

* ensured AOD cases for legacy hearings with exluded or ineligible judge

* added vacols staff record creation for users without it

* APPEALS-51045: Remove ReceiveNotificationJob (#22207)

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* MattT/APPEALS-51115: Initialize FIFO SQS Queues Locally (#22182)

* Set local env to utilize FIFO queues where appropriate

FIFO queues are configured with the same attributes as our queues in higher environments.

* Resolve failing test

* Remove defunct test

* Update make commands

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* APPEALS-47741: Update the UpdateAppealAffinityDatesJob to add appeal_affinity records for Legacy Appeals (#22023)

* AC1: changes and respective tests

* adjustements after refactoring

* identifier mismatch

* name update

* name update

* added appeal affinity filter

* updated comment

* remove byebug

* update rspec to handle hash input

* added no start date test case

* updated process method test

* removed 'todo' comment

* dried up query string

* aligned conditions

* update to hash quotations

* update to hash quotations

* added legacy to priority receipt dates from dist.

* moved append to resulting list

* added legacy receipt date to push job hash

* uncomment call to legacy

* updated dist.id to @dist_id

* uncomment call to process legacy appeals

* handling update to legacy docket type

* current rspec status

* fixed typo

* fix rspec

* legacy spec additions

* legacy spec additions

* added legacy dist. case factory

* removed vacols_judge ref

* updates for spec

* final review

* removed comment

* rubocop fixes

* fix rubocop warnings (#22225)

* APPEALS-51847: Institute Database Migration for Establishing 'sms_status_reason' and 'email_status_reason' Columns (#22208)

* adding and running migration

* adding comments to migration and re running db:migrate

* pushing up original scheam

* committing schema

* small edit to migration and deleting unnecessary columns from schema

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Fix rubocop and tests (#22231)

* removing job and all mentions of job (#22212)

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-51059: Alter Select Quarterly Statuses (#22239)

* Alter status messages

* Save more info in fake response

* Swap keys

* Add missing param

* Test fixes. Also, setting appeal_docketed to false whenever appeals are decided or cancelled

* Fix fasterer issue

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-51101: Rewrite ProcessNotificationStatusUpdateJob to Consume Messages from an SQS Queue (#22247)

* Update fake response body

* Try enabling localstack in CI

* Init SqsService and alter most/all of the ProcessNotificationStatusUpdatesJob

* Create SQS queues in test env

* Change port formatting

* Mount docker socket

* Try localstack hostname

* Wait for localstack in CI

* Add more yarddoc comments

* Log errors and number of messages processed

* Add custom error classes

* Add yarddoc comments to SqsService class

* Create SqsService spec file

* Redo much of ProcessNotificationStatusUpdatesJob's spec file

* Disable line length checks for yarddoc comments

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Calvin/appeals 52551 (#22293)

* age_of_n_oldest_priority_appeals_available_to_judge time out changes

* fixed timeout issue for distribute_priority_appeals

* fixed lint errors

* Craig/case docket optimization (#22294)

* age_of_n_oldest_priority_appeals_available_to_judge time out changes

* fixed timeout issue for distribute_priority_appeals

* optimize case docket priority distribution methods

* fix das deprecation distribution spec

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-51087: Rewrite Api::V1::VaNotifyController#notification_update Controller Action to No Longer Utilize Redis (#22295)

* initial push

* rubocop'n

* fixing tests?

* rubocop'n

* addressing most of matt's comments

* removing yard doc files and keeping comment

* rubocop

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* Update admin_ui_spec.rb for CAVC levers being enabled

* Remove extra attribute

* Fix incorrect log counts

* Fix log statement

* Fix typo

* APPEALS-53603: Modify logic to always show recipient information if present (#22414)

* initial commit

* making rspec tests happy

* linting

* adding tests back and refactoring

* small char error

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* Sync decided appeals with states table (#22434)

* APPEALS-52882 Sync decided appeals decision_mailed status

* APPEALS-52882 Fix lint issues

* APPEALS-52882 Fix codeclimate issues

* APPEALS-52882 Address PR feedback

* APPEALS-52882 Address PR feedback

* Jcohen/APPEALS-52861 (#22450)

* APPEALS-52861 Bug fix implemented.

* APPEALS-52861 cleaned up some code through aliasing a common method name between appeal_types, eliminating a check that we do in the AppealDecisionMailed module.

* APPEALS-52861 fixed method name error.

* APPEALS-52861 fixed some tests.

* APPEALS-52861 fixed More tests.

* APPEALS-52861 fixed More tests.

* APPEALS-52861 feature branch changes merged in with working branch and method name changes extracted.

* APPEALS-52861 feature branch changes merged in with working branch and method name changes extracted, included case statement.

* APPEALS-52861 moved case statement to another file to be the boolean check for constested status on an appeal.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-52892: For all legacy appeal states/notifications check status in VACOLS (#22455)

* initial commit

* addressing comments

* small change

* making tests
happy

* fixing spec tests

* rubocop'n

* reverting

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-53993: Update Implementation of Legacy Appeals with Hearing Held (#22473)

* implement new hearing requirement and test

* first pass at seed data for testing

* add new case to test and seed, fix typo and comments

* update for new 8.2.1.1 requirement

* fix rubocop warning

* fix error in seed file

* add new affinity scenario to seed data

* make some seed methods private

* fix rubocop warnings

* APPEALS-55159: Parameter Requirements Are Too Stringent Given What We Will Expect from VA Notify (#22561)

* APPEALS-55159

* updating tests

* APPEALS-55159 Refactor permitted and required params

* APPEALS-55159 Fix linting issue

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: msteele <Marc.Steele@va.gov>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* Adding rake task to sync decided appeals (#22492)

* APPEALS-52872 Add rake task to sync decided appeals

* APPEALS-52872 Remove byebug

* APPEALS-52872 Fixing lint errors

* APPEALS-52872 Addressing performance issues

* APPEALS-52872 Addressing performance issues

* APPEALS-52872 Fix ENV variable update

* APPEALS-52872 Parallelizing AppealState updates

* APPEALS-52872 Remove byebug

---------

Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* Prevent Prodtest from contacting VA Notify Staging (#22629)

* APPEALS-54918 Update VA Notify fake service and initializer

* APPEALS-54918 Add CASEFLOW_BASE_URL env var in demo/dev

* APPEALS-54918 Add seed file for API Key and added to main seed execution

* APPEALS-54918 Add missing argument to method definition

* APPEALS-54918 Update "to" params and fix linting issues

* APPEALS-54918 Prevent post requests in test env

* Rename ApiKeys seed file

* Fix linting error on require statement

* Add argument for call within sync_review_job.rb and minor refactor

* Inherit seed from base, align with AMA for seed file placement

* added test cases for infinite and omit levers with desired outcomes

* add check for hearing date to levers being infinite

* fix lint

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22776)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* APPEALS-57351 Inactive Appeal Errors present when outcoding an appeal (#22721)

* APPEALS-57351 add template name check to handle errors

* APPEALS-57351 Add template_name argument to spec tests

* Update app/models/prepend/va_notify/appellant_notification.rb

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-57351 Partial rspec updates, pushed before handing off

* APPEALS-57351 Add specs requested during review

* Update spec/controllers/idt/api/v2/appeals_controller_spec.rb

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* feature/APPEALS-50882 - Open Telemetry configuration and implementation (#22787)

* feature/appeals-45972 (#21950)

* Remove UUID from attrs sent_to metrics. (#21630)

* Remove UUID from attrs sent_to metrics.

* pushing with some linting issues for visibility.

* Change config implementation.

* Remove UUID from spec

* remove uuid from update_appellant job

* diable rubocop for open_telemetry init

* OTEL fixes

* rescue, errors

---------

Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>

* add otel reqs

* Remove throw

* comment out otel file loop

* try vendor suggested config

* update otel config to match vendor

* update pg gem

* otel include dt_host file

* otel require bundler and rubygems

* otel subset of instrumentation

* Revert "update pg gem"

This reverts commit fc1a45d.

* update redis and minimize otel instrumentation to just rails, rack, and activerecord

* otel add use_all except pg and redis

* otel require instruments

* otel fix typo

* otel fix typo

* otel comment out net_http

* otel silence aws sdk internals

* otel silence aws sdk internals

* otel add net http

* Individually use OTEL instruments (#22082)

* Individually use OTEL instruments
with options.

* disable AwsSdk only. Checking Rack options.

* re-require awssdk even while disabled.

* disable awssdk

* disable datadog for testing

* change sequence factory to properly seed

* updated opentelemetry and datadog configs

* rack context getter initalizer

* use one at a time

* add curly braces

* Revert change

* revert change

* Revert change

* Revert change

* Remove gemfile grouping

* Remove datadog.

* ActionPack and Actionview changes

* APPEALS-44287: Excluding disposition held and select that appeal for distribution  (#22277)

* first run at an SQL query removing duplicate appeals from distribution

* code refactor and excluding disposition held and select that appeal for distribution

* automated test for the duplicate hearing bug

* fix rubocop offense SpaceInsideBlockBraces

---------

Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>

* Update bundler to 2.4.22

* Updating OTEL to use all and remove new relic gem

* Remove calls to new relic

* removed id attrs in metrics service calls that were causing dimension errors

* Update config for otel

* Reorder gems to fix linting issues

* Updating config and refactoring verbose gems to add all

* Reinstall gems

* Adding all instruments

* Update config to only include basic instruments

* Update Gemfile.lock

* Adding rake to gemfile

* Adding instruments

* Comment out PG and ActiveSupport

* Suppress AWS logs

* Remove redis and turn on actionview

* Turn actionview off

* Add Redis instrumentation back

* Turn ActionPack back on

* Disable Redis

* Remove mentions of Datadog

* Removed extra mentions of Datadog

* removed newrelic references and yml file

* Test updating workflow

* Revert workflow change

* Adding simplecov back

* Fixing linting error

* Removing by: attribute after removing keyword in metric service

* Adding simplecov lcov gem and updating workflow

* Update workflow

* Updating simplecov

* Revert simple cov

* Adding featureenvy skip for reek

* Update service name. (#22762)

---------

Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: alex-guanipatin <alex.guanipatin@va.gov>
Co-authored-by: Drew Hadley <50673809+VandelayUtd@users.noreply.github.com>

* Remove unused variable with lint error. Re-introduce cert fixes

* Remove references to x86

* Revert "Remove references to x86"

This reverts commit fda290d.

---------

Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>
Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com>
Co-authored-by: Calvin <Calvin.Costa@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>
Co-authored-by: Craig Reese <Reese_Craig@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com>
Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>
Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: alex-guanipatin <alex.guanipatin@va.gov>
Co-authored-by: Drew Hadley <50673809+VandelayUtd@users.noreply.github.com>
mikefinneran added a commit that referenced this pull request Sep 24, 2024
* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
laurenyj pushed a commit that referenced this pull request Sep 25, 2024
* Calvin/APPEALS-43852-cavc-levers (#21441)

* enabled cavc affinity levers in UI

* updated rspec

* [APPEALS-43849]Update CAVC Affinity Implementation for AMA Dockets to… (#21456)

* [APPEALS-43849]Update CAVC Affinity Implementation for AMA Dockets to Account for Omit/Infinity

* Affinity rules applied to non genpop

* Addressed comments

* Addressed comments

* fixed rubocop issues + added clarity to where clause

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-44956: Add AppealAffinity model and database table (#21526)

* add migration for appeal_affinities

* add AppealAffinity model and associations, update migration for new column

* update index to be unique

* add factory, add tests

* add factory traits to appeal and case for appeal affinities

* add combination trait to appeal factory

* add appeal_affinity to skipped associations in ETL reporting

* add a validation, test

* Craig/appeals 44958 (#21564)

* add new job, update affinity model validation and after save hook

* add update from push job

* fix job extending distribution scopes

* add with appeal affinities to distribution scopes

* typo

* add error handling, add test file

* add distributed case factory, refactor naming in job

* fix factories, added tests

* fix migration for null affinity start date column

* fixes, added tests

* more test updates

* add return in job if no query results, tests for no query results

* add test for after_save hook adding dist task instructions

* set start dist job to queue affinity job after running

* fix update job and start dist job spec

* queue affinity update job from push job

* code clarity

* fix judge in seed file

* remove comment, fix hearing factory, disable some seeds for testing

* add more tests

* test refactor

* update appeals for dist query to add affinity start, add seed file, fix hearing factory, add stat to dist factory

* disable new seed on reset

* update seed file with vet names, add another seed category

* fix distirbuted case factory?

* actually fix GHA runs

* lint, test fixes

* change constants in new job

* [Appeals 43850] Update Legacy Docket Queries to Account for the Previous Decision Judge and Type Action  (#21556)

* test changes for seans ticket

* test changes

* added joins to all required methods

* fixed lint

* fixed column ambiguity errors

* cleaned up naming scheme

* Documentation for JOIN_PREVIOUS_APPEALS constant

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-44959: Modify affinity date checks to use appeal_affinity (#21611)

* swap distribution queries from distribution_task to appeal_affinities

* update seed files to use appeal affinities instead of distribution task

* clean up seed file method names

* add missing Timecop.return in ama affinity case seed

* fix name of a method in a seed file

* remove references to distribution task in distribution scopes

* fix push priority job tests

* fix naming of args in one of the seed files

* fix user seed, fix date format in distribution task instructions

* fix tests for date format update

* APPEALS-44187: Factory Bot Additions (#21438)

* AC1: values for bfddec and bfmpro

* AC2: case issues updated to '3'

* AC3-4: attorney and judge additions

* ac 5: bfdpdcn addition

* AC6: case type action addition

* ac7: new folder match to original

* ac8: case issues set to original

* AC 3/4: added associations to original

* ac3/4: updated logic to handle no args

* ac3/4: return sattyid

* ac7:updating folder assignment

* ac7: added bfkey to except block

* ac7/8: update to case issue list and validations dismissed

* removed byebug

* ac7: added 'ticknum' to except

* lint fixes

* lint fixes

* lint fixes

* lint fixes

* nested trait into form_9 factory

* new addtions

* added .save to case issues

* resolving correspondent and titrnum associations

* fixed bfdc typo

* factory additions

* added ssn to associated corr.

* removed transient and added .save

* added after create to corr factory

* veteran lookup check prior to create

* committing missed 'end'

* moved over veteran create to case fact.

* move corr. association field to case fact.

* lint issues + corres. save

* Calvin/APPEALS-44957-rake-affinity (#21577)

* grabbed receipt dates from distributed cases

* refactored for functionality + added method to grab appeals that match

* using receipt date, get all related appeals

* added update/creation plus cleaned prior imple.

* gets most recent distributed case receipt_date

* skips if receipt_date is nil for performance

* if appeal affinity is nil, it will now be updated

* created spec file

* fixed non ready appeals

* updated query to match new AC

* removing comment

* testing for each docket

* updated spec file

* added new tests to rspec

* updated start date to receipt date instead of Time.now

* fixed date/time rspec errors

* added rails logger to know when rake task has finished

* added tag for rails log

* removed nonpriority dockets for direct_review and evidence_submission

* fixed lint issue

* fixed flaky spec test

* limits distributed cases query to within the last week

* APPEALS-46016: Add Affinity Start Date to the Explain Page (#21660)

* add affinity start date to explain page

* add feature test to verify dates display

* Sudhir/appeals 43851 (#21613)

* Implement CAVC + AOD Affinity Lever for AMA Dockets

* addressed comments

* addressed comments

* Addressed comments

* added cavc_aod_affinity in case distribution lever model

* addressed comments

* addressed comments

* updated specs

* Updated specs

* specs changes reverted

* ama_aod and ama_non_aod queries updated

* change the assertion in docket spec

* Craig/appeals 46196 (#21689)

* fix query, tested locally

* add basic test to verify csv downloads aren't broken

* APPEALS-43851: Add test to validate CAVC+AOD behavior on hearing docket appeals affinities (#21678)

* add test to validate cavc+aod on hearing docket appeals

* lint, test case_docket_spec fix

* modify case_docket_spec again

* more test fix testing

* attempt to fix test again

* test removing prev appeals from nonpriority queries

* more test tests

* feature toggle change in test

* reorder new portions of query

* remove unused portions of queries in case_docket

* revert unneeded change to query order

* revert unneeded change to query order

* update rake task and spec (#21731)

* APPEALS-46325: Add Seeds for AOD Appeals and Update Dates to Match CAVC (#21730)

* add aod hearing cases to ama affinity cases seed

* fix lever spec

* APPEALS-45148: Hook to clear saved affinity date (#21623)

* initial imp. idea

* AC1: check for affinity_start_date on assignment

* AC2/3: update affinity start date  w/ instr.

* updates to naming, instructions, and hook logic

* updates after review

* rspec coverage and addtional condition

* removed unused identifier

* removed reduntant 'self's

* added update on actual AA record

* updated to save aa record and addtional rspec

* added change to assignment on no record test

* check for assignment

* addd update to 'on_hold' status

* public method to handle legacy affinity appeals

* added .reload to :with_affinity_appeal

* added .reload to :ready_for_distribution

* updates to pass explain_spec

* switched boolean values

* typo

* readujsted order on :create for affinity appeal

* removed after(:create)

* testing rspec by readding after :create

* reloading in assertation

* addressing lint errors

* fix seeds/users_spec

* add case dist lever to new tests (#21776)

* fix tests, add lever to factory, fix dist scopes (#21779)

* fix rubocop warning

* Acd/appeals 43853 43854 (#21971)

* Calvin/appeals 43853 (#21723)

* initial updates

* removing unnecessary variable

* focused in on priority

* removing non priority stuff

* added general comments

* added BFAC and AOD to cavc aod lever query

* adding judge vacols id to query

* aod affinity_start_date filter initial changes

* fixed sorting

* fixed rubocop issues

* updated filter method

* error handling

* added ineligibility to queries for PREV_DECIDING_JUDGE

* fixed SQL query + added comments

* added exclude from affinity check into the case docket queries

* error handling + fixing sql queries

* rejects appeals without affinity_start_dates and nonmatching judges

* fixing rubocop offenses

* fixed inconsistencies between methods

* fixed conditions for rejecting appeals

* refactored cavc aod affinity filter to make it much easier to read

* refactored code to account for AC6

* error handling for empty exclude from affinity

* reverted next if block to old logic to ensure it works

* added PREV_DEC_JUDGE is not null

* case.rb factory changes

* added more options to legacy_cavc_appeal creation

* cleaned up code for simpler reading

* fix for aod legacy cavc creation

* added tied to option to legacy cavc appeal factory

* limits are now handled correctly in query

* replaced return false to next if, as return false was causing unexpected behavior

* fix rspecs + one edge case

* added cavc aod lever creation to rspecs

* removed bfac and aod from nonpriority query

* cavc aod appeals w/excluded judges are now properly being filtered

* refactored excluded judges check

* added to old query to fix rspec errors

* modified case factory bot

* query now handles when prev_deciding_judge is nil

* removed unnecessary condition

* fixed case factory to now have tied_to attatched to orig appeal

* fixed next if block within filter

* handles omit scenarios + correctly rejects with next

* working on rspec (still failing)

* fix for ineligble VLJ when infinite

* fixed rspec suite for cavc aod filters

* fixed omit scenario in cavc aod affinity filter

* consolidation & readability refactor

* rubocop fixes

* fixed spec error

* Implement CAVC Affinity for Legacy Docket (#21706)

* Implement CAVC Affinity for Legacy Docket

* addressed comments

* Added BFAC in the query

* code changes for affinitty date

* Added affinity code

* code refactor and removed non priority code changes

* fixed syntax change

* Addressed comments

* refactor cavc affinity filter

* refactored code

* code refactor

* code refactor

* Updated existing specs

* code refactor

* Added new rspecs

* code refactor and added test  cases

* code refactor

* added test cases

* fixes push_priority_spec

* fixed rubocop issues

* rubocop issue fixed

* refactored code to make it easier to understand

* refactored + fixed rspec and lint errors

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>
Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>

* basic creation of legacy affinity cases seed data

* bug fixes, added bfcorlid with veterans, fully runs now

* added new appeals for affinity_and_tied_to_judge

* made data have realistic bfcorlids

* changes document sequence to use less digits

* added new file numbers for tied_to cases to make them easier to identify

---------

Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com>

* APPEALS-50692: Update Appeals Ready to Distribute CSV to include CAVC remand original judge (#22070)

* CSV download functional

* add tests, fix CSV query in CaseDocket

* fix lint

* Remove transaction_wrapper

* Remove extra newline

* Calvin/appeals 44313 (#22119)

* initial seed data file

* added legacy cavc and cavc aod affinity cases

* update

* fixed tied to for legacy appeals

* added AOD versions of appeals

* small lint fixes

* ensured AOD cases for legacy hearings with exluded or ineligible judge

* added vacols staff record creation for users without it

* APPEALS-51045: Remove ReceiveNotificationJob (#22207)

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* MattT/APPEALS-51115: Initialize FIFO SQS Queues Locally (#22182)

* Set local env to utilize FIFO queues where appropriate

FIFO queues are configured with the same attributes as our queues in higher environments.

* Resolve failing test

* Remove defunct test

* Update make commands

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* APPEALS-47741: Update the UpdateAppealAffinityDatesJob to add appeal_affinity records for Legacy Appeals (#22023)

* AC1: changes and respective tests

* adjustements after refactoring

* identifier mismatch

* name update

* name update

* added appeal affinity filter

* updated comment

* remove byebug

* update rspec to handle hash input

* added no start date test case

* updated process method test

* removed 'todo' comment

* dried up query string

* aligned conditions

* update to hash quotations

* update to hash quotations

* added legacy to priority receipt dates from dist.

* moved append to resulting list

* added legacy receipt date to push job hash

* uncomment call to legacy

* updated dist.id to @dist_id

* uncomment call to process legacy appeals

* handling update to legacy docket type

* current rspec status

* fixed typo

* fix rspec

* legacy spec additions

* legacy spec additions

* added legacy dist. case factory

* removed vacols_judge ref

* updates for spec

* final review

* removed comment

* rubocop fixes

* fix rubocop warnings (#22225)

* APPEALS-51847: Institute Database Migration for Establishing 'sms_status_reason' and 'email_status_reason' Columns (#22208)

* adding and running migration

* adding comments to migration and re running db:migrate

* pushing up original scheam

* committing schema

* small edit to migration and deleting unnecessary columns from schema

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* Fix rubocop and tests (#22231)

* removing job and all mentions of job (#22212)

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-51059: Alter Select Quarterly Statuses (#22239)

* Alter status messages

* Save more info in fake response

* Swap keys

* Add missing param

* Test fixes. Also, setting appeal_docketed to false whenever appeals are decided or cancelled

* Fix fasterer issue

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* MattT/APPEALS-51101: Rewrite ProcessNotificationStatusUpdateJob to Consume Messages from an SQS Queue (#22247)

* Update fake response body

* Try enabling localstack in CI

* Init SqsService and alter most/all of the ProcessNotificationStatusUpdatesJob

* Create SQS queues in test env

* Change port formatting

* Mount docker socket

* Try localstack hostname

* Wait for localstack in CI

* Add more yarddoc comments

* Log errors and number of messages processed

* Add custom error classes

* Add yarddoc comments to SqsService class

* Create SqsService spec file

* Redo much of ProcessNotificationStatusUpdatesJob's spec file

* Disable line length checks for yarddoc comments

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>

* Calvin/appeals 52551 (#22293)

* age_of_n_oldest_priority_appeals_available_to_judge time out changes

* fixed timeout issue for distribute_priority_appeals

* fixed lint errors

* Craig/case docket optimization (#22294)

* age_of_n_oldest_priority_appeals_available_to_judge time out changes

* fixed timeout issue for distribute_priority_appeals

* optimize case docket priority distribution methods

* fix das deprecation distribution spec

---------

Co-authored-by: Calvin <Calvin.Costa@va.gov>

* APPEALS-51087: Rewrite Api::V1::VaNotifyController#notification_update Controller Action to No Longer Utilize Redis (#22295)

* initial push

* rubocop'n

* fixing tests?

* rubocop'n

* addressing most of matt's comments

* removing yard doc files and keeping comment

* rubocop

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* Update admin_ui_spec.rb for CAVC levers being enabled

* Remove extra attribute

* Fix incorrect log counts

* Fix log statement

* Fix typo

* APPEALS-53603: Modify logic to always show recipient information if present (#22414)

* initial commit

* making rspec tests happy

* linting

* adding tests back and refactoring

* small char error

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>

* Sync decided appeals with states table (#22434)

* APPEALS-52882 Sync decided appeals decision_mailed status

* APPEALS-52882 Fix lint issues

* APPEALS-52882 Fix codeclimate issues

* APPEALS-52882 Address PR feedback

* APPEALS-52882 Address PR feedback

* Jcohen/APPEALS-52861 (#22450)

* APPEALS-52861 Bug fix implemented.

* APPEALS-52861 cleaned up some code through aliasing a common method name between appeal_types, eliminating a check that we do in the AppealDecisionMailed module.

* APPEALS-52861 fixed method name error.

* APPEALS-52861 fixed some tests.

* APPEALS-52861 fixed More tests.

* APPEALS-52861 fixed More tests.

* APPEALS-52861 feature branch changes merged in with working branch and method name changes extracted.

* APPEALS-52861 feature branch changes merged in with working branch and method name changes extracted, included case statement.

* APPEALS-52861 moved case statement to another file to be the boolean check for constested status on an appeal.

---------

Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-52892: For all legacy appeal states/notifications check status in VACOLS (#22455)

* initial commit

* addressing comments

* small change

* making tests
happy

* fixing spec tests

* rubocop'n

* reverting

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* APPEALS-53993: Update Implementation of Legacy Appeals with Hearing Held (#22473)

* implement new hearing requirement and test

* first pass at seed data for testing

* add new case to test and seed, fix typo and comments

* update for new 8.2.1.1 requirement

* fix rubocop warning

* fix error in seed file

* add new affinity scenario to seed data

* make some seed methods private

* fix rubocop warnings

* APPEALS-55159: Parameter Requirements Are Too Stringent Given What We Will Expect from VA Notify (#22561)

* APPEALS-55159

* updating tests

* APPEALS-55159 Refactor permitted and required params

* APPEALS-55159 Fix linting issue

---------

Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: msteele <Marc.Steele@va.gov>
Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* Adding rake task to sync decided appeals (#22492)

* APPEALS-52872 Add rake task to sync decided appeals

* APPEALS-52872 Remove byebug

* APPEALS-52872 Fixing lint errors

* APPEALS-52872 Addressing performance issues

* APPEALS-52872 Addressing performance issues

* APPEALS-52872 Fix ENV variable update

* APPEALS-52872 Parallelizing AppealState updates

* APPEALS-52872 Remove byebug

---------

Co-authored-by: Marc Steele <71673522+msteele96@users.noreply.github.com>

* Prevent Prodtest from contacting VA Notify Staging (#22629)

* APPEALS-54918 Update VA Notify fake service and initializer

* APPEALS-54918 Add CASEFLOW_BASE_URL env var in demo/dev

* APPEALS-54918 Add seed file for API Key and added to main seed execution

* APPEALS-54918 Add missing argument to method definition

* APPEALS-54918 Update "to" params and fix linting issues

* APPEALS-54918 Prevent post requests in test env

* Rename ApiKeys seed file

* Fix linting error on require statement

* Add argument for call within sync_review_job.rb and minor refactor

* Inherit seed from base, align with AMA for seed file placement

* added test cases for infinite and omit levers with desired outcomes

* add check for hearing date to levers being infinite

* fix lint

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22776)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* APPEALS-57351 Inactive Appeal Errors present when outcoding an appeal (#22721)

* APPEALS-57351 add template name check to handle errors

* APPEALS-57351 Add template_name argument to spec tests

* Update app/models/prepend/va_notify/appellant_notification.rb

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* APPEALS-57351 Partial rspec updates, pushed before handing off

* APPEALS-57351 Add specs requested during review

* Update spec/controllers/idt/api/v2/appeals_controller_spec.rb

---------

Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>

* feature/APPEALS-50882 - Open Telemetry configuration and implementation (#22787)

* feature/appeals-45972 (#21950)

* Remove UUID from attrs sent_to metrics. (#21630)

* Remove UUID from attrs sent_to metrics.

* pushing with some linting issues for visibility.

* Change config implementation.

* Remove UUID from spec

* remove uuid from update_appellant job

* diable rubocop for open_telemetry init

* OTEL fixes

* rescue, errors

---------

Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>

* add otel reqs

* Remove throw

* comment out otel file loop

* try vendor suggested config

* update otel config to match vendor

* update pg gem

* otel include dt_host file

* otel require bundler and rubygems

* otel subset of instrumentation

* Revert "update pg gem"

This reverts commit fc1a45d.

* update redis and minimize otel instrumentation to just rails, rack, and activerecord

* otel add use_all except pg and redis

* otel require instruments

* otel fix typo

* otel fix typo

* otel comment out net_http

* otel silence aws sdk internals

* otel silence aws sdk internals

* otel add net http

* Individually use OTEL instruments (#22082)

* Individually use OTEL instruments
with options.

* disable AwsSdk only. Checking Rack options.

* re-require awssdk even while disabled.

* disable awssdk

* disable datadog for testing

* change sequence factory to properly seed

* updated opentelemetry and datadog configs

* rack context getter initalizer

* use one at a time

* add curly braces

* Revert change

* revert change

* Revert change

* Revert change

* Remove gemfile grouping

* Remove datadog.

* ActionPack and Actionview changes

* APPEALS-44287: Excluding disposition held and select that appeal for distribution  (#22277)

* first run at an SQL query removing duplicate appeals from distribution

* code refactor and excluding disposition held and select that appeal for distribution

* automated test for the duplicate hearing bug

* fix rubocop offense SpaceInsideBlockBraces

---------

Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>

---------

Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: raymond-hughes <raymond.hughes2@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>

* Update bundler to 2.4.22

* Updating OTEL to use all and remove new relic gem

* Remove calls to new relic

* removed id attrs in metrics service calls that were causing dimension errors

* Update config for otel

* Reorder gems to fix linting issues

* Updating config and refactoring verbose gems to add all

* Reinstall gems

* Adding all instruments

* Update config to only include basic instruments

* Update Gemfile.lock

* Adding rake to gemfile

* Adding instruments

* Comment out PG and ActiveSupport

* Suppress AWS logs

* Remove redis and turn on actionview

* Turn actionview off

* Add Redis instrumentation back

* Turn ActionPack back on

* Disable Redis

* Remove mentions of Datadog

* Removed extra mentions of Datadog

* removed newrelic references and yml file

* Test updating workflow

* Revert workflow change

* Adding simplecov back

* Fixing linting error

* Removing by: attribute after removing keyword in metric service

* Adding simplecov lcov gem and updating workflow

* Update workflow

* Updating simplecov

* Revert simple cov

* Adding featureenvy skip for reek

* Update service name. (#22762)

---------

Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: alex-guanipatin <alex.guanipatin@va.gov>
Co-authored-by: Drew Hadley <50673809+VandelayUtd@users.noreply.github.com>

* Remove unused variable with lint error. Re-introduce cert fixes

* Remove references to x86

* Revert "Remove references to x86"

This reverts commit fda290d.

---------

Co-authored-by: calvincostaBAH <108481161+calvincostaBAH@users.noreply.github.com>
Co-authored-by: samasudhirreddy <108430298+samasudhirreddy@users.noreply.github.com>
Co-authored-by: Calvin <Calvin.Costa@va.gov>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Isaiah Saucedo <irsaucedo5@gmail.com>
Co-authored-by: Craig Reese <Reese_Craig@bah.com>
Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: noahhansen-gov <166541737+noahhansen-gov@users.noreply.github.com>
Co-authored-by: nhansen3 <noah.hansen1323@gmail.com>
Co-authored-by: Matthew Thornton <99351305+ThorntonMatthew@users.noreply.github.com>
Co-authored-by: prernadevbah <132498915+prernadevbah@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <121630615+JCohDev@users.noreply.github.com>
Co-authored-by: Jonathan Cohen <cohen_jonathan@bah.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: Noelle Adkin <98478937+NoelleAd@users.noreply.github.com>
Co-authored-by: Dani <danielle.coleman1@va.gov>
Co-authored-by: Sean Parker <Sean.Parker3@va.gov>
Co-authored-by: samasudhirreddy <sudhirreddy.sama@va.gov>
Co-authored-by: Andrew Hadley <hadley_andrew@bah.com>
Co-authored-by: alex-guanipatin <alex.guanipatin@va.gov>
Co-authored-by: Drew Hadley <50673809+VandelayUtd@users.noreply.github.com>
laurenyj added a commit that referenced this pull request Sep 25, 2024
* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
mikefinneran added a commit that referenced this pull request Sep 27, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Add doc navigation test to ReaderFooter.test.js (#22969)

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
mikefinneran added a commit that referenced this pull request Sep 27, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Add doc navigation test to ReaderFooter.test.js (#22969)

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Reader prototype combo branch (#23002)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
mikefinneran added a commit that referenced this pull request Oct 15, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
mikefinneran added a commit that referenced this pull request Oct 16, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

* Reader prototype combo branch (#23227)

* Use ctrl as meta key for 'find next' behavior. (#23214)

* Use ctrl as meta key for 'find next' behavior.

* Bugfix

* Fix text layer scale bug. (#23216)

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
mikefinneran added a commit that referenced this pull request Oct 16, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

* Use ctrl as meta key for 'find next' behavior. (#23214)

* Use ctrl as meta key for 'find next' behavior.

* Bugfix

* Fix text layer scale bug. (#23216)

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
ThorntonMatthew added a commit that referenced this pull request Oct 16, 2024
* Have time slots handle aliased timezones properly

* Add Indianapolis alias

* Pluck RTL version of the ScheduleVeteranForm from the Node 18 upgrade branch.

Co-authored-by: AdamShawBAH <adam.shaw@va.gov>

* Add unrecognized timezones to tz initializer

* Add spec file for initializer

* Add Jest test coverage

* Fix undefined expectations

* Update snapshots

* Leverage timezone aliases

* Remove defunct TZ mapping overrides

* Add missing alias

* Refactor ReadOnlyHearingTimeWithZone's Jest test file to

utilize beginsAt values for hearing days that are formatted in the way they are in actuality within the app.

* WIP: Add service specs

* Add HearingDatetimeService tests

* Remove extra line of whitespace

* Make date consistent in tests

* Add legacy tests

* Update tz initializer spec

* Fix typo where I used 'subject' in place of 'is_expected'

* Fix use of wrong variable name

* Fix legacy hearing staging

* Add specs for HearingTimeService

* Add icol service test

* Fix hearing time service time_to_string method

* Change time expectations to meet actual behavior

* Fix mistake where I had accidentally set the expectation for the

Louisville, KY RO to be a time in the wrong timezone.

* Reader prototype bugfixes (#23233)

* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

* Use ctrl as meta key for 'find next' behavior. (#23214)

* Use ctrl as meta key for 'find next' behavior.

* Bugfix

* Fix text layer scale bug. (#23216)

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>

---------

Co-authored-by: Matthew Thornton <ThorntonMatthew@users.noreply.github.com>
Co-authored-by: AdamShawBAH <adam.shaw@va.gov>
Co-authored-by: mikefinneran <110622959+mikefinneran@users.noreply.github.com>
Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
mikefinneran added a commit that referenced this pull request Oct 16, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

* Use ctrl as meta key for 'find next' behavior. (#23214)

* Use ctrl as meta key for 'find next' behavior.

* Bugfix

* Fix text layer scale bug. (#23216)

* remove code from bad merge

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
mikefinneran added a commit that referenced this pull request Oct 17, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

* Use ctrl as meta key for 'find next' behavior. (#23214)

* Use ctrl as meta key for 'find next' behavior.

* Bugfix

* Fix text layer scale bug. (#23216)

* remove code from bad merge

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
AdamShawBAH pushed a commit that referenced this pull request Oct 19, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

* Use ctrl as meta key for 'find next' behavior. (#23214)

* Use ctrl as meta key for 'find next' behavior.

* Bugfix

* Fix text layer scale bug. (#23216)

* remove code from bad merge

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
hawkespoulterva pushed a commit that referenced this pull request Oct 21, 2024
* Hotfix/appeals 57826 (#22946)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

* Add previous/next navigation with left/right arrow keys

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Remove alpha attribute from Page component to fix black boxes renderi… (#22947)

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57877 (#22948)

* Add fix for filtered docs bug

* Revert component import paths to full path

* feature/APPEALS-34124-43428-29105-28925-33581 - Rails 6.1 upgrade (release) (#22813) (#22817)

* 🔧 Assume defaults for `config.action_dispatch.use_cookies_with_metadata` and `config.action_mailer.delivery_job`

The following config settings are not backwards compatible:

- config.action_dispatch.use_cookies_with_metadata
- config.action_mailer.delivery_job

Now that Rails 6.0 is stable on production, we can assume
their default values going forward.

* ✅ Fix flakey spec

* 🔧 Assume default for `config.action_dispatch.use_authenticated_cookie_encryption`

Since we are making other cookie configuration changes in this PR for Rails 6.0,
this is an opportune time to migrate this Rails 5.2 cookie setting to its
default value as well.

* ⏪️ Restore overrides for `config.action_dispatch.use_authenticated_cookie_encryption` and `config.action_dispatch.use_cookies_with_metadata`

While testing in PreProd, we discovered that, without these cookie config overrides,
re-authentication was broken -- after logging out, a user could not log back in.

Since the default settings are still optional going forward, we can restore these
overrides and devise a solution to migrate cookies later.

For more details, see Jira story APPEALS-54897:

https://jira.devops.va.gov/browse/APPEALS-54897

* ✨ Add new utility module for adding DB indexes concurrently

Introduces `Caseflow::Migrations::AddIndexConcurrently` as a replacement
for `Caseflow::Migration` for migrations on ActiveRecord 6.0 and beyond,
since `Caseflow::Migration` is forever coupled to ActiveRecord 5.1 due
to its extensive use on legacy migrations and should be deprecated moving
forward.

* 🗑️ Deprecate `Caseflow::Migration`

* 🔧 Add instructive error message for non-concurrent `add_index` migrations

* 🚨 Address linter / codeclimate complaints

* ✨ Introduce `SslRedirectExclusionPolicy`

To be used in the environment configuration settings for excluding exempt
request paths from SSL redirects when `config. force_ssl = true`

* ♻️ Replace deprecated controller-level `force_ssl`

Replace deprecated controller-level `force_ssl` with
equivalent configuration settings in preparation for
the Rails 6.1 upgrade.

* 🔥 Remove deprecated config setting `config.active_record.sqlite3.represent_boolean_as_integer`

This will have no implications for Caseflow, since we are only using the `sqlite3`
adapter nominally for the `demo_vacols` database, which is not actually being used
in our demo environments (demo environments are deployed as `development` envs).

* ⬆️ Update `caseflow-commons` to resolve sub-dependency conflicts

Removes unneeded gems `bourbon` and `neat`, which had a sub-dependency conflict on `thor`.

* ⬆️ Update rails and other gems as necessary

* 🐛 Fix 'uninitialized constant' error when loading app

* ⬆️ bin/rails app:update - Apply relevant changes

* 🔧 Override default for `config.active_record.has_many_inversing`

* 🔧 Assume default for `config.active_storage.track_variants`

We're not currently using ActiveStorage in Caseflow, so it
is safe to just assume the default here.

* 🔧 Override default for `config.active_job.retry_jitter`

The default jitter is probably safe, however, I'm not 100% sure that we
don't have any jobs that need to be requeued with exact wait times. So
we let's override this for now to stay on the safe side.

* 🔧 Assume default for `config.active_job.skip_after_callbacks_if_terminated`

We're not currently using `throw :abort` within any `before_enqueue`/`before_perform` 
callbacks on existing Caseflow jobs, so the default should be fine here.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c60

* 🔧 Assume default for `config.action_dispatch.cookies_same_site_protection`

This setting controls the `SameSite` optional attribute for the
`Set-Cookie` header.

`SameSite=Lax` means that the cookie is not sent on cross-site requests,
such as on requests to load images or frames, but is sent when a user is
navigating to the origin site from an external site (for example, when
following a link). This is the default behavior if the SameSite attribute
is not specified.

`Lax` is currently the default assumed by both Chrome and Edge browsers
when this attribute is left unspecified, so assuming this value
should be sensible. It allows us to have our cake (blocking CSRF attacks)
and eat it too (providing a logged-in experience when users navigate to
Caseflow  across origins).

For more background, see
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
- https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#1f15

* 🔧 Assume default for `config.action_controller.urlsafe_csrf_tokens`

* 🔧 Assume default for `ActiveSupport.utc_to_local_returns_utc_offset_times`

We're not using `ActiveSupport::TimeZone.utc_to_local` anywhere,
so the default is safe to assume here.

* 🔧 Assume default for `config.action_dispatch.ssl_default_redirect_status`

The default is safe to assume.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#4c3e

* 🔧 Assume default for `config.active_record.legacy_connection_handling`

The default should be safe to assume here, as we do not do any
role or shard switching on database connections.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#8007

* 🔧 Assume default for `config.action_view.form_with_generates_remote_forms`

We don't use the `form_with` helper anywhere, so this behavior change is
inconsequential for us, and we can safely assume the new default.

* 🔧 Assume default for `config.active_storage.queues.analysis`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.active_storage.queues.purge`

We do not use ActiveStorage, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.incineration`

We don't use ActionMailbox, so the new default is safe to assume here.

* 🔧 Assume default for `config.action_mailbox.queues.routing`

We do not use ActionMailbox, so the default is safe to assume here.

* 🔧 Assume default for `config.action_mailer.deliver_later_queue_name`

We're not using `ActionMailer::MessageDelivery #deliver_later` anywhere,
so the default is safe to assume.

* 🔧 Assume default for `config.action_view.preload_links_header`

This flag can be safely uncommented. Browsers that support Link
headers will get a performance boost. Browsers that don’t will
ignore them.

We override in `development` environments to avoid an edge case
leading to an HTTP response header overflow.

For more background, see
https://lilyreile.medium.com/rails-6-1-new-framework-defaults-what-they-do-and-how-to-safely-uncomment-them-c546b70f0c5e#3679

* 🔥 Remove 'new_framework_defaults_6_1.rb'

* 🔧 Load defaults for Rails 6.1

* ♻️ Extract constant

* ♻️ Migrate to new Rails deprecation config where applicable

* ♻️ Push members down now that there is only one subclass

* 🩹 Add forgotten disallowed deprecation warning

This deprecation warning was addressed by the following
PR, but we forgot to add it to the list of disallowed
deprecation warnings:

#21614

* 💡 Update comment

Task `rake routes` has been replaced with `rails routes`

* ✅ Update test to account for change to `ActionDispatch::Response#content_type` 

`ActionDispatch::Response#content_type` now returns the full Content-Type header

* 🚨 Exclude 'config.ru' from Rubocop cops

* 🚚 Move 'db/etl/migrate' to 'db/etl_migrate'

* 🚚 Move 'db/etl/schema.rb' to 'db/etl_schema.rb'

* ♻️ Arrange 'database.yml' configs by environment

Group DB configs by environment in anticipation of
reformatting for Rails 6+ multi-DB configuration.

* 🔧 Reformat 'database.yml' to Rails 6+ multi-DB conventions

* 🔧 Add etl migration paths to DB config

* 🔧 Update DB connection names in 'database_cleaner' config

* ♻️ Use new database-specific rake tasks

After migrating to the Rails 6+ native multi-database configuration,
the behavior of some DB management tasks, such as `rake db:migrate`
changed such that they now act on ALL databases and not just the
primary database. So we must replace the invocations of these
tasks with their new, database-specific counterparts.

* ➖ Remove 'multiverse' gem

Now that we have fiully transitioned to Rails-native
multi-database support, we are no longer reliant on
the 'multiverse' gem and can remove it.

* 🗃️ Prohibit execution of vacols DB and non-DB-specific rake tasks

After transitioning to Rails-native multi-DB support,
the behavior of some DB tasks changed such that they will now
act on ALL databases and not just the primary database
(ex. `rake db:migrate` will now migrate ALL databases).

To avoid accidents, we re-define these tasks here to no-op
and output a helpful message to redirect developers toward
using their new database-specific counterparts instead.

* ♻️ Create new environment for GH workflow 'Make-docs-to-webpage'

Instead of performing a bunch of hard-to-maintain `sed` gymnastics
to modify the existing 'test' environment, let's create a new
'make_docs' environment (based off of 'test') and configure it
appropriately for use by the 'Make-docs-to-webpage' GH workflow.

* 💚 Remove redundant DB migrations from CI workflow

Task `db:schema:load` already loads the checked in schema,
so there should be no need to run `db:migrate` afterwards.

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `NoMethodError`

Addresses the following error:

  NoMethodError: undefined method `build_lookup_context' for ActionView::Base:Class

* 🐛 Fix `spec/workflows/post_decision_motion_updater_spec.rb` - `FrozenError`

Addresses the following error:

  FrozenError: can't modify frozen Hash: {}

* ✅ Add test for `RoSchedulePeriod`

* 🐛 Fix `spec/models/schedule_period_spec.rb` - `ActiveRecord::RecordInvalid`

Apparently, there were some changes to the inner workings of
`ActiveModel::Errors` in Rails 6.1, causing a model to be
considered invalid in the case that `errors[:base] == [[]]`.
This makes sense, as `[[]]` is not considered "empty".

Unfortunately, this was causing `RoSchedulePeriod #validate_spreadsheet`
to inadvertently mark the model as invalid upon creation.
`HearingSchedule::ValidateRoSpreadsheet #validate` returns an
empty array (`[]`) when valid, which gets pushes onto the
`RoSchedulePeriod` `errors[:base]` array, resulting in a
non-empty array (`[[]]`) and an erroneously invalid disposition.

Furthermore, calling `<<` to an `ActiveModel::Errors` message array
in order to add an error is a deprecated, so we can take this
opportunity to use the new `#add` API to hit two birds with one stone.

The change implemented here is not a pure refactoring, however the
end-user experience is unchanged in terms of how errors are presented
when attempting to upload a spreadsheet with multiple non-conformities.

Down the road, we may want to consider moving
`HearingSchedule::ValidateRoSpreadsheet` toward using
`ActiveModel::Validations` in order to leverage the
full `ActiveModel::Errors` API and construct the
errors object in the prescribed manner.

For more details see
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Validations.html
- https://api.rubyonrails.org/v6.1.7.7/classes/ActiveModel/Errors.html

* 🐛 Fix `spec/mailers/hearing_mailer_spec.rb` - `ActionView::Template::Error`

* ✅ Fix `spec/models/veteran_spec.rb`

* ✅ Fix `spec/sql/ama_cases_sql_spec.rb`

Addresses failures such as the below:

  0) AMA Cases Tableau data source expected report calculates age and AOD based on person.dob
     Failure/Error: expect(aod_case["aod_veteran.age"]).to eq("76")

       expected: "76"
            got: 0.76e2

* ✅ Fix multiple specs - `Minitest::UnexpectedError`

Test helper method `#perform_enqueued_jobs` now wraps exceptions
in an `Minitest::UnexpectedError`:

https://github.com/rails/rails/blob/914caca2d31bd753f47f9168f2a375921d9e91cc/activejob/lib/active_job/test_helper.rb#L591

So, to assert that a specific
exception is raised during execution of the `#perform_enqueued_jobs`
block, we must rescue the `Minitest::UnexpectedError` and make the
assertion on its error message instead.

* ✅ Fix `spec/lib/helpers/association_wrapper_spec.rb`

* ✅ Fix `spec/controllers/api/v1/jobs_controller_spec.rb`

In Rails 6.1, `ActiveJob #perform_now` was changed to
behave as it did once before (at the behest of GitHub),
returning the value fo the job instead of true/false.

See related GH issue: rails/rails#38040

* 🐛 Fix `spec/controllers/appeals_controller_spec.rb` - `NoMethodError`

Addresses error:

  NoMethodError: undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>

  0) AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: errors: errors.messages[:workflow],

     NoMethodError:
       undefined method `workflow' for #<CaseSearchResultsForVeteranFileNumber:0x00007f9a030966c8>
     # ./app/workflows/case_search_results_base.rb:31:in `search_call'

* 🐛 Fix `CaseSearchResultsBase` validations

Addresses test failures in `spec/controllers/appeals_controller_spec.rb`
similar to the below:

  AppealsController GET appeals when current user is a System Admin when request header does not contain Veteran ID responds with an error
     Failure/Error: expect(response_body["errors"][0]["title"]).to eq "Veteran file number missing"

       expected: "Veteran file number missing"
            got: nil

Using `ActiveModel::Errors` to store error data in an arbitrary format may have been
somewhat permissible in the past, but it is an abuse of the object's intended use and is
also proving incompatible with the more formalized `ActiveModels::Errors` API in Rails 6.1.

In order to preserve the existing response shape of the affected JSON endpoints,
we need to move away from the `ActiveModel::Validations` implementation on `CaseSearchResultsBase`
(and its descendent classes) to a more bespoke method of performing validations and aggregating
errors, since Rails 6.1 `ActiveModel::Errors` is no longer appropriate for  our needs here.

* ✅ Fix `spec/controllers/application_controller_spec.rb` -- Cache-Control error

Addresses the test failure below:

    ApplicationController no cache headers when toggle set sets Cache-Control etc
     Failure/Error: expect(response.headers["Cache-Control"]).to eq "no-cache, no-store"

       expected: "no-cache, no-store"
            got: "no-store"

       (compared using ==)
     # ./spec/controllers/application_controller_spec.rb:59:in `block (4 levels) in <top (required)>'

In Rails 6.1, the `no-store` directive is exclusive of any others
that are set on the `Cache-Control` header, which makes sense given
the specification https://datatracker.ietf.org/doc/html/rfc7234#section-3

This change was implemented in PR rails/rails#39461

Since it no longer makese sense to set both `no-store` and `no-cache` directives,
we will only set `no-store` here, as that is the stronger of the two.

* 🐛 Fix multiple specs - `ActiveRecord::EagerLoadPolymorphicError`

Addresses multiple test failures caused by the error below:

  QueueConfig.to_hash title when assigned to an org is formatted as expected
     Failure/Error:
       tasks.with_assignees.group("assignees.display_name").count(:all).each_pair.map do |option, count|
         label = self.class.format_option_label(option, count)
         self.class.filter_option_hash(option, label)
       end

     ActiveRecord::EagerLoadPolymorphicError:
       Cannot eagerly load the polymorphic association :appeal
     # ./app/models/queue_column.rb:110:in `assignee_options'

* 🐛 Fix `spec/models/task_spec.rb` - `update_all` clears query cache

In Rails 6.1.7.7, the method `ActiveRecord::Relation #update_all`
will now clear any records cached by the calling relation.

This was altering the behavior of `Task #cancel_task_and_child_subtasks`
and causing the following test failure:

  Task#cancel_task_and_child_subtasks cancels all tasks and child subtasks
     Failure/Error: expect(second_level_tasks[0].versions.count).to eq(initial_versions + 2)

       expected: 3
            got: 2

       (compared using ==)
     # ./spec/models/task_spec.rb:368:in `block (3 levels) in <top (required)>'

To remedy, we will now cache the necessary Task records in an Array, which can
be used for generating PaperTrail versions both before and after the `update_all`.

* 🐛 Fix `spec/services/hearings/calendar_service_spec.rb` - template rendering error

Addresses the following test failure:

  Hearings::CalendarService.confirmation_calendar_invite returns appropriate iCalendar event
     Failure/Error: expect(ical_event.description).to eq(expected_description)

       expected: "You're scheduled for a virtual hearing with a Veterans Law Judge of the Board of Veterans' Appeals.\...to reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n"
            got: #<Icalendar::Values::Text("You're scheduled for a virtual hearing with a Veterans Law Judge of the Bo... reschedule or cancel your virtual hearing, contact us by email at bvahearingteamhotline@va.gov\n")>

* 🐛 Fix YAML syntax error caused by whitespace in ENV var

Address the following error, found during demo deployment:

  rake aborted!
  Cannot load database configuration:
  YAML syntax error occurred while parsing /caseflow/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): could not find expected ':' while scanning a simple key at line 49 column 5

* ⬆️ Update `caseflow-commons` dependency to latest ref

Removes `bourbon` and `neat` dependencies.

* Add arrow keys fix

* Pull filtered docs and doc navigation changes from laurenyj/APPEALS-58255 and add browser tab fix

* Update Document Viewer document title logic so document title updates when user clicks Next or Previous buttons

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>

* Hotfix/appeals 57831 (#22949)

* Add fix for the outer scroll bar in the DocumentList page

* Remove unnecessary conditional for outer scroll bar logic in DocumentViewer

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>

* Hotfix/appeals 57827 57832 57836 (#22950)

* Add fix for filtered docs bug

* Revert component import paths to full path

* Revert glamor styles changes

* Update lodash imports to reduce size

* Replace lodash/get with javascript optional chaining

* Refactor previous/next doc logic without lodash

* Remove unused import from ReaderFooter

* Delete lodash logic in documentUtil and move ReaderToolbar functions to ReaderToolbar component

* Update prototype-footer css

* Adding regression tests for filtered document order.

* Adding label to filtered icon.

* Adding test for unfiltered content.

* Moving test up to previous.

* Fix merge conflict

* Fix merge conflict

* Fix empty arrow function lint error in ReaderFooter.test.js

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>

* Andre/appeals 57834 (#22951)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Andre/appeals 57833 (#22878)

* Update scaleFraction to allow single column on load

* create scaling equation for large screens

* Started test to detect single or two column loading on default

* update css to breakpoint at 1654px for most docs

* remove test as not changing code only css

* Andre/appeals 57834 (#22858)

* APPEALS-57834 Sidebar is defaulting to "close" instead of "open"

* Add test to detect sidebar is open

* Category test fixes/props cleanup.

* WIP for readersidebar

* finish up test to verify sidebar state persist to next document

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Removed Line 30 (#22953)

Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>

* Davywentwortht2it/appeals 57817 (#22954)

* APPEALS-57817. Rework Reader prototype Page logic to minimize race conditions when scaling/scrolling.

* APPEALS-57817. Minimal test coverage for Page component.

---------

Co-authored-by: Davy Wentworth <david.wentworth@va.gov>

* Update documentation replacing master with main (#22960)

* Update WINDOWS_11.md replacing master with main

* References to master are changed to main where applicable

* Add doc navigation test to ReaderFooter.test.js (#22969)

* APPEALS-54874: Update PG and Ruby-oci8 gems (#22506)

* update minimum version in gemfile and ran bundle install (#22503)

* require ruby-oci8 in config/boot.rb to fix SIGV fault

* APPEALS-36292: Conditionally render banner alerts based on which environment it is deployed on (#21367)

* Conditionally render alerts based on which environment is deployed

* setting Env alert banner sitewide

* separate colors for different envs using the same alert type

* lighter reds for prodtest alert so the text is more readable

* give demo banner more contrast

* adjust specific language for demo env

* adjust logic to accept proper env var. Add style for preprod (yellow)

* isolate env alert styles

* remove duplicate 'demo' Alert

* remove development env banner to fix tests

* making conditional logic a little more bulletproof against 'production'

* update CaseWorkerIndex snapshot

* fix env var

* update snapshot from hard 'uat' setting

* conditionally render env alert on only the home page

* sticky env header statuses

* getting development alert banners to work

* target correct frontend dependency for NavigationBar changes

* connecting new frontend package with better prod exclusion logic

* make the prodtest env badge a more readable color

* cleaning up testing code

* fix linting issues

* Remove unnecessary space

* new NavigationBar update

* yarn install of new FE dependency

* remove extra package.json

* remove development env logic due to NODE_ENV bug

* fixing broken logo link padding and colors

* hardening logic to exclude other inputs

* correcting operator logic

* remove testing var

* point caseflow-frontend to master

* point at most recent caseflow-frontend master

* linting issues fix

* update Route and CaseWorker snapshot

* update snapshot for process.env.DEPLOY_ENV

---------

Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>

* Merge feature/APPEALS-41559 into release/FY24Q4.6.0 (#22979)

* Start feature work tracking PR with a TODO comment

* Remove TODO comment for CodeClimate

* SeanC/APPEALS-42315 | Create separate Remand table, model and seed data (#22220)

* added migration file for adding type column to supplemental claims table

* created stub for remand model

* added type to supplemental claim factory and new remand trait

* added remand sc's to vha seeds

* updated migration name and fixed typo

* Changed migration to inherit from Caseflow::Mirgration

* schema changes

* reverting schema

* changed the setting of the type column

* fixed schema and renamed migration file

* fixed migration and schema

* updated the remands factory and seeds

* fixed comment in schema

---------

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* TYLERB/APPEALS-42455: Display new and migrated Remands in Decision Review Queue tabs (#22206)

* Added support for remands to the business_line.rb model and the index.js util file that parses the decision review type filters for the decision review queue.

* Updated the business line spec file, the decision reviews controller spec tests, and the reviews spec feature test to support remands.

* Added a decision review polymorphic helper to DRY up some of the polymorphic appeal concerns.

* Overrode the remand model association to request issues so active record joins will work correctly.

* Added another helper for sti polymorphic relationships. Fixed filtering for STI decision review types for remands. Updated tests and added factories for testing.

* Code climate fixes and test fixes.

* Fixed more test failures. Removed the remand request issues relationship since it was incorrectly implemented. Added a scope to supplemental claims for remands. Fixed an issue where board grant effectuation tasks without request issues were missing from the new task type count method.

* Changed the UNION ALL to a UNION in the new task_type_count method to prevent duplicate row counts. Updated tests and fixed an issue where the board grant effectuation tasks were being counted for pending task queries.

* JHoang/APPEALS-42318 (#22270)

* some preliminary remand & sc model updates

* typo

* some preliminary hlr checks?

* undo seed change

* decision issue and sc updates

* attempt code climate fixes

* another code climate fix

* testing changes

* useless variable..

* fix conditional in decision issue

* fix undefined find_by method

* attempt rspec fix

* rspec fix attempt #2

* supplemental_claim_spec fix?

* remove comma

* code climate fix

* added comment for transparency on remand creation, attempt fix for remands route

* updated specs for decision_issue, hlr_spec, appeal_spec to account for remand creation type

* fix lint error

* fix lint error #2

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* APPEALS-42458 (#22365)

* disable edit issues link for remands

* add banners explaining that remands are not editable

also makes sure that remands are not editable on the edit issues page

* TYLERB/APPEALS-44922: Update Generate task report page UI to include Remand in conditions (#22356)

* Initial commit. Changed the DecisionReviewType condition filter to a searchable dropdown and added the remands option to it as well. Updated the report page filter parsing to work with the searchable dropdown instead of checkboxes for the decision review type condition filter.

* Updated the ReportPage jest test and the report page feature test to work with the decision review type filter as a searchable dropdown instead of checkboxes.

* SeanC/APPEALS-42317 | Migrate existing Supplemental Claim Remands to Remand records via script (#22359)

* initial verison of update script

* remanded migration file

* updated sc spec with type

* schema

* fixed a few issues in the migration

* small fix to migration file

* moved the type column check into a seperate it block

* fixed wrong column in migration file

* created a new migration for creating the view

* updated the backfill migration file

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>

* J hoang/appeals 44940 (#22428)

* initial

* some factory and spec updates

* change history query update and spec fixes

* code climate/lint fix

* change @claim_type identifier

* fix claim_history_event_spec.rb

* test coverage for change history with Remand claim type

* spec lint fixes

* refactor claim_type filtering to account for remand subtype

* business_line_spec fix

* decision_reviews_controller_spec update for remand claim type

* lint fixes for decision_reviews_controller_spec.rb

* comment updates in business_line.rb

* renamed mock data in change_history_reporter_spec

* trigger GA

* refactor claim type filter for less conditional handling

* business line spec fix

---------

Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>

* Initial commit for the brakeman sql injection warning fixes. (#22598)

* Updated the business line reporter class to properly display Remands as a seperate type than SupplementalClaims. Also added additional testing logic for the business line reporter for hlr and scs since it was only covering appeals. (#22664)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Fixed a bug where the frontend would error due to calling .toLowerCase() on a null or undefined value which could happen sometimes if the api filter options are in an incorrect state. (#22796)

Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>

* Updated the remand migration files to work with the rails 6 upgrade and the changes to Caseflow::Migration. (#22825)

* added fix for failing test in decision_reviews_controller_spec (#22829)

---------

Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>

* APPEALS-50679 | Reassign Cases to Camo Change History (#22982)

* Al/APPEALS-45335 (#22228)

* added additional option to check box list

* fixed some tests and code clean up

* fixed more tests

* fixed jest tests

* changes per Pr feedback

* added custom error display

* fixed style for error message

---------

Co-authored-by: Sean Craig <sean.craig2@va.gov>

* adding logic to bring in issue-modification request and updating the … (#22238)

* adding logic to bring in issue-modification request and updating the csv logic

* refactor logic to get pending status and null to request addition

* pending status filter work fixing

* adding withdrawal date and adding logic to display request issue components

* getting edit of request rows and fixing cancelled data

* fixing linter and fixing the query to make test happy

* fixing specs failures

* removing byebug

* removing frontend changes, adding test, fixing the query to replace higherlevel review,adding new field in serializer

* making code climate happy by doing some minor refactor

* fixing the serializer spec failure

* After merging APPEALS-45335, filter for Requested issues were broken, so refactored it and removed the unnecessary methood that i created

* fixing code climate and spec was failing because of hard coded date

* refactor the edit of request logic to take from version, refactored business line query to remove coalesce and fix test

* fixing codeclimate, remove unnecessary field

* refactor to make first comment appear first in edit of request

* fixing linter issue, spec and refactor to fix the bug

* fixing pending status filter issue and adding test for business line

* fixing broken spec failure

* adding user facilty

* fixing the lead and lag function to prevent entry of pending status multiple times

* fixing an issue in which in progress event was not being made

* adding decision reason that was missed and fixing the event logic one more time

* fixing the multiple issue modification request after decision has been made

* refactor inprogress logic for approved data

* fixing spec failure

* fixing the first version logic to be more simpler and fixing name and adding spec

* fixing more inprogess event

* removing the disabled complexity and taking out the boolean condition to a separate method

* Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events (#22483)

* added logic for claim history events table

* fixed linting errors

* fixing test failures

* added change Pr feedback

* PR feedback round 2

* changes from round 2 of PR feedback

* Added logic event data versions and tests to cover more edgecases

* changed RequestedIssueFragment

* Updated the individual claim history spec file for test failures. Updated an attribute in the IndividualClaimHistory page that was using the wrong getter. Fixed a code climate linting error.

* Removing unnecessary clear filter

* Combined some of the individual claim history tests into one test so it will run more quickly.

* fixing the withdrawal date versioning issue for different level changes

* fixing the spec failure and linter

---------

Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-57367: change-history-updates (#22479)

* Initial commit with new tests cases for issue modification requests for change history.

* Added two cte queries to the business line change history query to properly work with a lead for the issue modification requests. Added new methods into the claim history event to work with this new lead and modified the existing issue modification in progress and pending event generation methods to better reflect the state of a claim that is going through the issue modficiation process.

* Cleaned up unused code and todos.

* Updated the claim history event create_imr_in_progress_status_event? with even more logic and edge cases.

* Fixed a possible error when with a greater than operator could be used on a null value.

* Fixed a few rspec tests.

* Renamed a method and fixed a few code climate issues.

* Fixed a bug in event status generation if there is a task with versions but no versions that change status.

* Updated tests to work with new logic and remove a todo statement.

* Fixed code complexity warnings.

* Updated serializer spec to work with the bug fix.

* Adjusted the pending method to prevent possible race conditions.

* Fixed a bug where the incorrect decision event user would be shown for an issue modification request creation if the request has been decided when it should be the requestor as the event user.

* Added the correct css ids to a few IMR change history events so that the filtering would work correctly. Also added some additional sql to properly filter based on css id and station id for requestor and decider joins.

* Updated the IMR business line logic so that the decided at fields would always account for cancelled status since it uses updated at instead of decided at to determine when the IMR was closed. Fixed a bit of logic in the claim history event IMR in progress event generation to work another edge case.

* Added in previous IMR edit versions for displaying it to the user.

* Added a test for the change history service class to verify that request edit events have the correct attributes from the previous edits.

* Fixed a typo for one of the table aliases in the business line query.

* Fixed another typo where the facilities filter was using css id instead of station id from a copy/paste error.

* adding changes for previous state array and some test modification

* adding test for previous data

* Fixed some outstanding test failures.

* Fixed a linting error. Removed some duplicated code that happened when merging in the feature branch. Updated a factorybot method that was causing tests to fail.

* Fixed a few code climate warnings.

* Removed some puts statements in the individual claim history feature test.

---------

Co-authored-by: Prajwal Amatya <pamatya@take2it.com>

* TYLERB/APPEALS-58656: Change History CSV and Version Parsing fix (#22874)

* Fixed a modification request claim history in progress event generation bug that could occur when 3-4 pending requests were all created at the same time and then later cancelled at the same time. Also fixed an issue count bug used when building the issue type filter due to additional duplicate rows being inserted into issue type count query due to the left join to the issue modification requests table.

* Altered the version parsing for change history to work with commas in the version strings since that was causing parsing errors. Altered the business line query to use '|||' as a delimeter instead of comma and also changed the array_agg functions to string agg to avoid the '{}' array type casting that was happening between postgres and rails. Updated tests to work with this new parsing.

* Updated vha seed data to have associations to intake data so those seeded claims can correctly generate change history.

* TYLERB/CHANGE-HISTORY-YAML-QUOTE-FIX (#22910)

* Made an update to the claim history parse versions method to work with double quotations after the array_agg to string_agg change.

* Updated the tests to work with the new string agg and version parsing method.

* Skip flakey tests

These are possibly flakey now due to the rails upgrade. We can come
back and fix these once the work has been confirmed in UAT.

* Add rubocop disables for line length

These should be removed when the skips are removed.

* Updated the report_page feature test to reduce flakyness in github actions. Also updated the DownloadHelpers module.

---------

Co-authored-by: Brandon Dorner <brandonleedorner@gmail.com>

* Fix testing error from merge conflict

---------

Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Hotfix/appeals 37269 #2 (#22886)

* adds script and tests for the script

* adjust the way scheduled_for is created since the previous method was removed

* refactor some of the script

* rename test file to include _spec

* push empty commit to rerun tests

---------

Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>

* APPEALS-59294: Hearings seed file is creating DistributionTasks for legacy appeals (#22983)

* set parent task for legacy appeal hearing tasks to root task

* fix whitespace issue

* Fix alt+m hotkey for opening and closing sidebar (#22986)

* Fix alt+m hotkey for opening and closing sidebar

* Add fix for double search results bug and revert current page refactor

* Hotfix/appeals 57826.1 - Fix for alt+C placing comment and moving icon with arrow keys (#22985)

* Fix for icon appearing on alt+c and arrow key support for moving icon.

* Add test coverage

* Andre/appeals 57833 1 (#22990)

* Added test for checking the view layout based on the width of screen

* Add in test for default column

* Fix failing tests in ReaderFooter.test.js

---------

Co-authored-by: davywentwortht2it <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>

* Making document reads persist. (#22936)

* Making document reads persist.

* Adding test to insure api is called.

* Change the store to use rootReducer.

* Fixing linting issues.

* Adding a test to make sure previous/next work.

* Hotfix/appeals 57830 (#22952)

* Persist zoom level between Reader documents

* component tests

* code cleanup

---------

Co-authored-by: Daniel Mage <dmage20@gmail.com>

* Add loading text in ReaderFooter (#23007)

* fix for persisting reader sidebar state between documents

* Fix failing tests; add factory for documents.

* bug fix for sidebar toggle persisting across documents

* remove commented out test to clean up pr

* Metrics collection for Reader Prototype

* Adding tests for both complete and incomplete document loads.

* Deleting PdfDocument test.

* Adding new test for metric logging.

* bug fix unsaved comment removed on doc change

* Fix for incorrect document title.

* Fix for ctrl-F not working on Windows.

* Ensure document title persists even when documents have the same type.

* Update paths in test due to new file location.

* Use ctrl as meta key for 'find next' behavior. (#23214)

* Use ctrl as meta key for 'find next' behavior.

* Bugfix

* Fix text layer scale bug. (#23216)

* remove code from bad merge

---------

Co-authored-by: laurenyj <44596134+laurenyj@users.noreply.github.com>
Co-authored-by: Brian Bommarito <brian@bommarito.me>
Co-authored-by: Jeremy Croteau <jcroteau@users.noreply.github.com>
Co-authored-by: Andre Pollard <andre.pollard@va.gov>
Co-authored-by: Davy Wentworth <david.wentworth@va.gov>
Co-authored-by: andrecolinone <146746795+andrecolinone@users.noreply.github.com>
Co-authored-by: Anusha Palliyil <palliyil_anusha@bah.com>
Co-authored-by: Raymond Hughes <131811099+raymond-hughes@users.noreply.github.com>
Co-authored-by: Craig Reese <109101548+craigrva@users.noreply.github.com>
Co-authored-by: seanrpa <155660052+seanrpa@users.noreply.github.com>
Co-authored-by: Robert Travis Pierce <robert@roberttravispierce.com>
Co-authored-by: Robert Travis Pierce <Pierce_Robert@ne.bah.com>
Co-authored-by: Sean Craig <110493538+seancva@users.noreply.github.com>
Co-authored-by: Tyler Broyles <109369527+TylerBroyles@users.noreply.github.com>
Co-authored-by: jonathanh-va <111081469+jonathanh-va@users.noreply.github.com>
Co-authored-by: Jonathan Hoang <trinhjoanthan.hoang@va.gov>
Co-authored-by: Brandon Lee Dorner <Brandondorner@yahoo.com>
Co-authored-by: Clay Sheppard <csheepy@gmail.com>
Co-authored-by: almorbah <149511814+almorbah@users.noreply.github.com>
Co-authored-by: Sean Craig <sean.craig2@va.gov>
Co-authored-by: Prajwal Amatya <122557351+pamatyatake2@users.noreply.github.com>
Co-authored-by: = <tyler.broyles@va.gov>
Co-authored-by: Prajwal Amatya <pamatya@take2it.com>
Co-authored-by: zborgesva <145717155+zborgesva@users.noreply.github.com>
Co-authored-by: Zackary Borges-Rowe <borges-rowe_zackary@bah.com>
Co-authored-by: Ron Wabukenda <130374706+ronwabVa@users.noreply.github.com>
Co-authored-by: Daniel Mage <dmage20@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants