Ask VA | Updating regex for inquiry ID to be more future-proof#27805
Ask VA | Updating regex for inquiry ID to be more future-proof#27805
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Ask VA inquiry ID validation to support newer/longer trailing numeric sequences and adjusts request specs accordingly, so /inquiries/:id/status can accept evolving CRM inquiry number formats.
Changes:
- Broadened inquiry ID regex to allow a trailing digit segment of 5+ digits.
- Updated the controller’s validation comment/error text to reflect the new expected format.
- Updated request spec “invalid id format” examples to remove now-valid cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
modules/ask_va_api/app/controllers/ask_va_api/v0/inquiries_controller.rb |
Expands INQUIRY_ID_FORMAT and updates validation messaging for inquiry ID format. |
modules/ask_va_api/spec/requests/ask_va_api/v0/inquiries_spec.rb |
Adjusts invalid inquiry ID cases to align with the expanded format. |
Comments suppressed due to low confidence (1)
modules/ask_va_api/spec/requests/ask_va_api/v0/inquiries_spec.rb:499
- This spec update removes previously-invalid 5- and 8-digit trailing segments from the “bad id” list, but it doesn’t add a positive assertion that 5- and 8-digit inquiry IDs are accepted. Consider adding explicit examples that
GET /statussucceeds for a 5-digit and an 8-digit trailing segment to lock in the intended new behavior.
context 'when the id format is invalid' do
%w[invalid 12345 A-1234567-123456 A-12345678-1234 A-12345678-12L4567 A12345678123456].each do |bad_id|
it "returns bad_request for '#{bad_id}'" do
get "/ask_va_api/v0/inquiries/#{bad_id}/status"
expect(response).to have_http_status(:bad_request)
expect(JSON.parse(response.body)['error']).to include('Invalid inquiry ID format')
end
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
modules/ask_va_api/spec/requests/ask_va_api/v0/inquiries_spec.rb:500
- This invalid-ID spec now treats an 11-digit trailing segment as invalid, which implicitly matches the new 5–10 digit controller regex. If the intended support is only 5–8 digits per the PR description, add coverage for 9+ digits being rejected (and keep the invalid examples aligned with the controller’s actual range).
context 'when the id format is invalid' do
%w[invalid 12345 A-1234567-123456 A-12345678-1234 A-12345678-12345678901 A-12345678-12L4567
A12345678123456].each do |bad_id|
it "returns bad_request for '#{bad_id}'" do
get "/ask_va_api/v0/inquiries/#{bad_id}/status"
expect(response).to have_http_status(:bad_request)
expect(JSON.parse(response.body)['error']).to include('Invalid inquiry ID format')
end
mfloyd-iat
left a comment
There was a problem hiding this comment.
LGTM - this was the adjustment he mentioned yesterday to expand the digits to allow for production traffic numbers as they differ from staging traffic numbers
acastillo-ironarch
left a comment
There was a problem hiding this comment.
LGTM! Nice work getting the details hashed out
Summary
After talking to the CRM team, we found out that the oldest inquiry IDs end in a 5 digit sequence and the newest ones end in a 7 digit sequence. It's unlikely to happen soon, but at some point the end segment of the inquiry ID may end up being 8 digits long. In order to be as flexible as possible, this PR updates the end segment to accept any sequence of digits between 5 and 10 digits long (so 5, 6, 7 and 8 will work, while leaving us with extra leeway for future-proofing)
Related issue(s)
Testing done
Specs have been updated to remove a now-valid case of 8 digits for the end segment
Screenshots
Note: Optional
What areas of the site does it impact?
(Describe what parts of the site are impacted andifcode touched other areas)
Acceptance criteria
Requested Feedback
(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?