ILLDEV-451 state model selector - #671
Merged
Merged
Conversation
adamdickmeiss
marked this pull request as draft
July 20, 2026 10:36
Contributor
There was a problem hiding this comment.
Pull request overview
Adds state-model selection support (ILLDEV-451) by introducing a selector on state models (currently keyed off ISO18626 serviceInfo.serviceType), persisting the chosen state model name on each patron request, and surfacing it through the broker API.
Changes:
- Add
selector.serviceTypeto state model configuration and schemas; add selection logic inActionMappingService. - Persist
state_modelonpatron_request(schema + migration) and thread it through create/update flows and API responses. - Update/extend tests to include
ServiceInfo.ServiceTypeand assertstateModelis set toreturnables.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| misc/state-models.yaml | Adds selector.serviceType to the returnables state model definition. |
| misc/state-model.json | Extends the state-model JSON schema to include selector. |
| broker/test/patron_request/api/api-handler_test.go | Asserts stateModel is present and sets ServiceInfo.ServiceType where needed. |
| broker/sqlc/pr_schema.sql | Adds state_model column to patron_request schema used by sqlc; view continues to select pr.*. |
| broker/sqlc/pr_query.sql | Updates insert/update queries to include state_model. |
| broker/patron_request/service/statemodels/state-models.json | Includes selector in generated state-models JSON. |
| broker/patron_request/service/message-handler.go | Selects a state model by request and persists its name on created patron requests. |
| broker/patron_request/service/message-handler_test.go | Ensures request messages include ServiceInfo.ServiceType for selection. |
| broker/patron_request/service/action.go | Carries StateModel through retry request creation. |
| broker/patron_request/service/action_mapping.go | Implements GetStateModelNameForRequest selection logic (serviceType-based). |
| broker/patron_request/service/action_mapping_test.go | Adds tests validating selector-based model selection and error cases. |
| broker/patron_request/db/prrepo.go | Maps StateModel from the search view into the DB patron request type. |
| broker/patron_request/db/prcql.go | Updates scan order to include StateModel from patron_request_search_view. |
| broker/patron_request/api/api-handler.go | Selects and persists StateModel on POST/PUT; surfaces it in API responses. |
| broker/patron_request/api/api-handler_test.go | Updates unit tests to include/verify StateModel mapping. |
| broker/oapi/open-api.yaml | Adds stateModel to PatronRequest schema and adds StateModelSelector schema. |
| broker/migrations/050_add_patron_request_state_model.up.sql | Adds state_model column and rebuilds patron_request_search_view. |
| broker/migrations/050_add_patron_request_state_model.down.sql | Drops state_model column and rebuilds the view on rollback. |
adamdickmeiss
force-pushed
the
ILLDEV-451-state-model-selector
branch
from
July 20, 2026 11:38
96523d1 to
fb7f1b3
Compare
adamdickmeiss
marked this pull request as ready for review
July 20, 2026 11:45
jakub-id
approved these changes
Jul 20, 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/ILLDEV-451