(feat) O3-5552: validate transition time to prevent negative wait duration#106
Open
Brijesh-0106 wants to merge 2 commits intoopenmrs:mainfrom
Open
(feat) O3-5552: validate transition time to prevent negative wait duration#106Brijesh-0106 wants to merge 2 commits intoopenmrs:mainfrom
Brijesh-0106 wants to merge 2 commits intoopenmrs:mainfrom
Conversation
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.
Requirements
the ticket number (feat) O3-5552 with conventional commit label.
the queue module — the error response structure mirrors other validation
errors in QueueEntryTransitionRestController and uses the same
APIException approach consistent with the rest of the codebase.
to this module and I plan to add tests in a follow-up PR after
receiving initial feedback on the implementation.
Summary
The queue-entry transition endpoint accepted future dates as valid transition dates, which caused incorrect queue state — a transition could be recorded as happening in the future, making queue metrics and wait times unreliable for clinical staff.
This PR adds a server-side validation check that rejects any transition request where the provided transitionDate is in the future.
Changes made:
Added a future date check in QueueEntryTransitionRestController.transitionQueueEntry() immediately after the transition date is resolved
If the provided date is after the current server time, an APIException is thrown with a descriptive message including the invalid date value
Validation runs before any queue state is modified, so no partial transitions can occur
Example error response:
Jira: O3-5552
Screenshots
No change in UI
Related Issue
https://openmrs.atlassian.net/browse/O3-5552