CannotDeleteContention - department-of-veterans-affairs/caseflow GitHub Wiki

CannotDeleteContention Error

What is it?

The CannotDeleteContention error is thrown within the vbms_connect gem whenever VBMS sends back a response that indicates that a VBMS contention correlated to a caseflow request issue is not permitted to be deleted. Vbms_connect identifies several errors by inspecting the response from VBMS. VBMS_CONNECT looks for several key phrases within the response using regular expressions to identify if an error should be thrown. If one of the regular expressions is found, VBMS_CONNECT will throw the appropriate error. In the case of CannotDeleteContention, the regular expression that will raise this error is: "The contention is connected to an issue in ratings and cannot be deleted." If the VBMS response contains this text, then the CannotDeleteContention Error will be thrown. Then the CannotDeleteContention Error will be thrown

How does Caseflow handle this error?

This error is rescued by the DecisionReviewProcessJob. This job accepts a Request Issues Update as an argument. As mentioned before, a Request Issues Update can contain several edits to request issues. The order that these ‘edits’ get processed by this job are:

  1. Added Issues (this includes Corrected Issues, because Corrected Issues become added issues)
  2. Edited Issues
  3. Removed and Withdrawn Issues When the CannotDeleteContention Error is thrown, the job is at the 3rd part that involves Removed and Withdrawn issues. The way that this job handles the error is that it updates the Request Issues Update’s ERROR field with the response sent from VBMS. It is important to note that any remaining withdrawn or removed issues will not be processed on VBMS side. This leads to the job being considered ‘stuck’, because the job cannot finish with the current implementation unless manually ‘unstuck’.

How do we ‘un-stick’ Jobs that result in the CannotDeleteContention error?

There is a remediation job that runs nightly called CannotDeleteContentionRemediationJob that will allow the job to continue by resetting the state of the request issue that is not allowed to be removed (setting closed_at and closed_status values to null), un-removing the removed request issue from the request issues update by adding the affected request issue id into the after_request_issue_ids attribute, and resyncing the end product establishment so that a decision issue can be generated and a proper closed_status can be applied to the affected request issue. This job can also safely be run from the rails console by entering CannotDeleteContentionRemediationJob.perform_now. It is important to note that occasionally there will be request issues updates that involve the removal or withdrawal of more than one request issue that is not allowed to be deleted on VBMS side. In scenarios such as these, the remediation job will need to be run multiple times, as each error is tied to a specific request issue and it is not possible to know if VBMS will reject any other removals/withdrawals until the job is allowed to continue.