Skip to content

ILLDEV-451 state model selector - #671

Merged
adamdickmeiss merged 4 commits into
mainfrom
ILLDEV-451-state-model-selector
Jul 20, 2026
Merged

ILLDEV-451 state model selector#671
adamdickmeiss merged 4 commits into
mainfrom
ILLDEV-451-state-model-selector

Conversation

@adamdickmeiss

@adamdickmeiss adamdickmeiss commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings July 20, 2026 10:35
@adamdickmeiss adamdickmeiss changed the title Illdev 451 state model selector ILLDEV-451 state model selector Jul 20, 2026
@adamdickmeiss
adamdickmeiss marked this pull request as draft July 20, 2026 10:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.serviceType to state model configuration and schemas; add selection logic in ActionMappingService.
  • Persist state_model on patron_request (schema + migration) and thread it through create/update flows and API responses.
  • Update/extend tests to include ServiceInfo.ServiceType and assert stateModel is set to returnables.

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.

Comment thread broker/sqlc/pr_query.sql
@adamdickmeiss
adamdickmeiss force-pushed the ILLDEV-451-state-model-selector branch from 96523d1 to fb7f1b3 Compare July 20, 2026 11:38
@adamdickmeiss
adamdickmeiss marked this pull request as ready for review July 20, 2026 11:45
@adamdickmeiss
adamdickmeiss merged commit 3610b00 into main Jul 20, 2026
13 checks passed
@adamdickmeiss
adamdickmeiss deleted the ILLDEV-451-state-model-selector branch July 20, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants