Add manual patron request termination#636
Open
jakub-id wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated “manual termination” flow for patron requests by introducing a new POST /patron_requests/{id}/terminate endpoint that drives a special internal terminate action through the existing invoke-action task path, without exposing terminate as a normal state-model action.
Changes:
- Added a terminal
MANUALLY_CLOSEDstate (per side) and amanualClosemarker to designate the termination target state. - Implemented a special-case
terminateaction handler in the patron request action service that directly transitions a non-terminal request to the configured manual-close terminal state. - Added a new API endpoint and tests ensuring
terminateis rejected via the generic/actionendpoint but succeeds via/terminate.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| broker/patron_request/service/statemodels/returnables.json | Adds MANUALLY_CLOSED terminal states for requester/supplier and marks them as manualClose targets. |
| broker/patron_request/service/statemodel.go | Validates manualClose is only set on terminal states and is unique per side. |
| broker/patron_request/service/statemodel_test.go | Adds unit tests for the new manualClose validation rules. |
| broker/patron_request/service/statemodel_capabilities.go | Registers MANUALLY_CLOSED as a built-in state and defines the internal terminate action constant. |
| broker/patron_request/service/action.go | Routes internal terminate action to a dedicated handler that updates state/terminal metadata without LMS involvement. |
| broker/patron_request/service/action_test.go | Adds tests for successful termination and rejection when already terminal. |
| broker/patron_request/service/action_mapping.go | Extracts and exposes the per-side manual-close target state from the state model; adds IsTerminalState. |
| broker/patron_request/service/action_mapping_test.go | Tests manual-close state lookup and ensures terminate is not a normal available action. |
| broker/patron_request/api/api-handler.go | Adds POST /patron_requests/{id}/terminate, refactors invoke-action request construction, and reuses a shared invoke+respond helper. |
| broker/patron_request/api/api-handler_test.go | Tests that /action rejects terminate, and /terminate creates the correct invoke-action task payload and rejects terminal PRs. |
| broker/oapi/open-api.yaml | Extends ModelState with manualClose and adds the /patron_requests/{id}/terminate route. |
adamdickmeiss
approved these changes
Jun 13, 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.
https://index-data.atlassian.net/browse/CROSSLINK-275
Summary
Tests