Fix/make sure start date before end date#27611
Merged
Conversation
JunTaoLuo
reviewed
Apr 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds guards to prevent Unified Health Data (SCDF) AVS metadata fetches when date ranges are invalid or when the appointment is in the future, reducing upstream 400s for VAOS appointment requests.
Changes:
- Skip AVS metadata fetch for single OH appointments unless the appointment start is in the past.
- Add start/end date range short-circuiting before calling UHD/SCDF.
- Add unit/request specs covering invalid date ranges, equality edge case, Date-object inputs, and future-appointment behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
modules/vaos/app/services/vaos/v2/appointments_service.rb |
Avoid AVS fetch for future OH appointments; add date-range guard and expand error logging context. |
modules/vaos/spec/requests/vaos/v2/appointments_spec.rb |
Add request spec ensuring AVS isn’t fetched/returned for future OH appointment even when requested. |
lib/unified_health_data/service.rb |
Add date-order check before calling UHD client for AVS metadata. |
spec/lib/unified_health_data/service_spec.rb |
Add unit specs for invalid date order, equality case, and Date object inputs. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
JunTaoLuo
approved these changes
Apr 7, 2026
stiehlrod
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related issue(s)
Testing done
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
Check that in staging no 400 errors are received from SCDF in the logs:
https://vagov.ddog-gov.com/logs?saved-view-id=4635