-
Notifications
You must be signed in to change notification settings - Fork 66
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
API-41844: Fix Contestable Issues (Decision Reviews v2) X-VA-Receipt-Date
Bug
#19556
API-41844: Fix Contestable Issues (Decision Reviews v2) X-VA-Receipt-Date
Bug
#19556
Conversation
"appealId": "00000000-1111-2222-3333-444444444444", | ||
"appealType": "NoticeOfDisagreement", | ||
"createDate": "2020-01-02T03:04:05.067Z", | ||
"updateDate": "2020-01-02T03:04:05.067Z" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These particular changes aren't related to the updates in this PR, but the fields reordered themselves after I ran the rake task that regenerates the documentation. These changes don't harm anything, and they accurately reflect the order of fields returned in the response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e39927d
} | ||
render json: { errors: [error] }, status: :unprocessable_entity | ||
end | ||
# rubocop:enable Metrics/MethodLength |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a bug on the Decision Reviews v2 HLR Contestable Issues endpoint (/services/appeals/v2/decision_reviews/higher_level_reviews/contestable_issues/{benefit_type}
) that doesn't occur on the general DR v2 Contestable Issues endpoint (/services/appeals/v2/decision_reviews/contestable_issues/{decision_review_type}
), since the latter endpoint validates the headers against the schema, but the former does not (inherits from the AppealsApi::V1::DecisionReviews::BaseContestableIssuesController
, which is older). The bug occurred when an X-VA-Receipt-Date
header was passed but the contents were an invalid date. The code on L37
was failing to parse the date, and the endpoint was responding with a 500
error. By rescuing the error, I can return a 422
response instead, which is more appropriate.
I started to go down the path of handling this in a more holistic and clean way (I wasn't sure why this endpoint wasn't validating the headers against the schema and the other one was), but the scope spiraled quickly and I didn't want to risk breaking the API contract for this endpoint. Since this endpoint will soon be replaced by the Appealable Issues v0 API, I landed on this simpler (but less ideal, code style-wise) approach. I chose not to save the error detail in our I18n
translation file because I don't want to encourage this pattern going forward. (Headers and params should always be compared against the schema in the future.)
This is ready for re-review! |
Summary
This work is behind a feature toggle (flipper): NO
This PR fixes a bug in the Decision Reviews v2 Contestable Issues endpoints, where the consumer received a confusing error message,
\"2019-02-19\" is before AMA Activation Date (2019-02-19).
, when they provided "2019-02-19" for theX-VA-Receipt-Date
header. The only validations forX-VA-Receipt-Date
that we were performing were 1) checking for its presence, and 2) checking that it matched theyyyy-mm-dd
format. Therefore, this error was being returned from Caseflow itself.After confirming that the
X-VA-Receipt-Date
must be 2019-02-20 or later (rather than 2019-02-19, as previously believed), I added a validation for the date on our end, so that we can avoid the confusing error message and also format the validation error to meet our validation error standards. This PR also adds a message to theX-VA-Receipt-Date
header in our documentation to specify this date requirement, which wasn't anywhere in our documentation before.My team (Lighthouse Banana Peels) owns the
appeals_api
module.Related issue(s)
Testing done
All affected endpoints were tested locally with different
X-VA-Receipt-Date
inputs (valid and invalid) using our Appeals API Bruno examples.Screenshots
What areas of the site does it impact?
This PR impacts the
appeals_api
module only.Acceptance criteria
Requested Feedback
No specific feedback requested for this PR.