Conversation
Extend the patron_request structure with last_action, last_action_outcome, last_action_result. Not populated yet with any values.
There was a problem hiding this comment.
Pull request overview
Adds database support for capturing “last action” metadata on patron requests, with corresponding query and API schema updates to surface these fields through the broker’s Patron Request model.
Changes:
- Adds
last_action,last_action_outcome, andlast_action_resultcolumns topatron_request(schema + migration). - Updates patron request create/update SQL and the CQL-backed list scanning to include the new columns.
- Extends the OpenAPI
PatronRequestschema with the new fields.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| broker/sqlc/pr_schema.sql | Extends patron_request table definition with last-action columns. |
| broker/sqlc/pr_query.sql | Persists last-action columns in Create/Update queries. |
| broker/patron_request/db/prcql.go | Updates CQL list scan order to include new columns. |
| broker/oapi/open-api.yaml | Documents new PatronRequest fields in the API schema. |
| broker/migrations/019_last_action.up.sql | Migration to add new patron_request columns. |
| broker/migrations/019_last_action.down.sql | Rollback migration to drop the new columns. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Adds “last action” metadata to Patron Requests so API consumers can see the most recent executed action and its outcome/status, supporting CROSSLINK-231 (first part).
Changes:
- Extend
patron_requestschema + migrations withlast_action,last_action_outcome,last_action_result. - Populate these fields when actions are finalized, and expose them via the Patron Request API + OpenAPI schema.
- Update CQL list scanning and add/extend API tests to assert the new fields.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| broker/test/patron_request/api/api-handler_test.go | Adds assertions for last-action fields and adjusts expectations around a failing blocking action. |
| broker/sqlc/pr_schema.sql | Adds new patron_request columns to sqlc schema. |
| broker/sqlc/pr_query.sql | Updates Create/Update queries to include last-action columns. |
| broker/patron_request/service/action.go | Sets last-action fields during action finalization. |
| broker/patron_request/db/prcql.go | Extends manual rows.Scan to include the new columns. |
| broker/patron_request/api/api-handler.go | Maps new DB fields into API PatronRequest response. |
| broker/oapi/open-api.yaml | Documents last-action fields on PatronRequest schema. |
| broker/migrations/019_last_action.up.sql | Migration to add last-action columns. |
| broker/migrations/019_last_action.down.sql | Rollback migration to drop last-action columns. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Adds “last action” tracking to Patron Requests so the system can persist and expose the most recent executed action along with its outcome and event status.
Changes:
- Add
last_action,last_action_outcome,last_action_resultcolumns topatron_request(schema + migration) and wire them into sqlc create/update/list queries. - Persist last-action metadata on every action execution and expose it via the PatronRequest API + OpenAPI schema.
- Extend CRUD API tests to assert last-action fields after create/action execution.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| broker/test/patron_request/api/api-handler_test.go | Adds assertions for last action/outcome/result after create and after executing actions. |
| broker/sqlc/pr_schema.sql | Extends patron_request table definition with last-action columns. |
| broker/sqlc/pr_query.sql | Updates Create/Update queries to include last-action fields. |
| broker/patron_request/service/action_mapping.go | Refactors action-availability helpers; adds logic intended to filter auto-actions based on failure. |
| broker/patron_request/service/action.go | Persists last-action fields during action finalization (always updates PR). |
| broker/patron_request/db/prcql.go | Updates manual rows.Scan mapping to include last-action columns. |
| broker/patron_request/api/api-handler.go | Maps last-action fields into API responses; documents that they’re unset at creation time. |
| broker/oapi/open-api.yaml | Adds lastAction/lastActionOutcome/lastActionResult to the PatronRequest schema. |
| broker/migrations/019_last_action.up.sql | Migration adding last-action columns. |
| broker/migrations/019_last_action.down.sql | Rollback migration dropping last-action columns. |
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds persisted “last action” metadata to patron requests so API consumers can see the most recent workflow action and its outcome/status, aligning runtime behavior with CROSSLINK-231.
Changes:
- Adds
last_action,last_action_outcome,last_action_resultcolumns (schema + migration) and wires them through sqlc queries and CQL scanning. - Persists last action info on every executed action and exposes the fields in the PatronRequest API + OpenAPI schema.
- Extends API integration tests to assert last-action fields after key actions.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| broker/test/patron_request/api/api-handler_test.go | Adds assertions verifying last action/outcome/result in API responses. |
| broker/sqlc/pr_schema.sql | Extends patron_request table schema with last-action columns. |
| broker/sqlc/pr_query.sql | Updates insert/update queries to include last-action columns. |
| broker/patron_request/service/action_mapping.go | Adjusts action listing/availability logic with awareness of last action result. |
| broker/patron_request/service/action.go | Updates action finalization to persist last-action metadata on patron requests. |
| broker/patron_request/db/prcql.go | Updates manual rows.Scan order to match new patron_request column order. |
| broker/patron_request/api/api-handler.go | Maps last-action fields into API PatronRequest responses. |
| broker/oapi/open-api.yaml | Documents lastAction/lastActionOutcome/lastActionResult in OpenAPI. |
| broker/migrations/019_last_action.up.sql | Migration adding last-action columns. |
| broker/migrations/019_last_action.down.sql | Migration removing last-action columns. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Adds “last action” metadata to patron requests so API consumers can see the most recent action name, outcome, and event status for a request (CROSSLINK-231).
Changes:
- Add
last_action,last_action_outcome,last_action_resultcolumns topatron_request(schema + migration) and include them in sqlc queries/CQL scanning. - Persist last-action fields during action execution and expose them via the Patron Request API + OpenAPI schema.
- Extend API integration tests to assert last-action fields are returned/updated.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| broker/test/patron_request/api/api-handler_test.go | Asserts last-action fields in CRUD flow and after executing actions. |
| broker/sqlc/pr_schema.sql | Adds last-action columns to the patron_request table definition used by sqlc. |
| broker/sqlc/pr_query.sql | Updates Create/Update queries to include last-action columns. |
| broker/patron_request/service/action_mapping.go | Changes action availability logic to optionally include auto actions after failures, using last-action fields. |
| broker/patron_request/service/action.go | Persists last-action fields on every action finalization via UpdatePatronRequest. |
| broker/patron_request/db/prcql.go | Updates manual rows.Scan arg list to match new patron_request column order. |
| broker/patron_request/api/api-handler.go | Re-reads PR after auto-actions so response includes updated last-action fields; maps new fields to API model. |
| broker/oapi/open-api.yaml | Documents lastAction/lastActionOutcome/lastActionResult on PatronRequest. |
| broker/migrations/019_last_action.up.sql | Adds last-action columns to patron_request at runtime. |
| broker/migrations/019_last_action.down.sql | Removes last-action columns on rollback. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Adds end-to-end support for tracking the most recent action performed on a patron request (action name, outcome, and status), persisting it in Postgres and exposing it via the PatronRequest API.
Changes:
- Add
last_action,last_action_outcome,last_action_resultcolumns + migration and sqlc query updates. - Persist last-action fields on every action finalization and expose them in API responses/OpenAPI.
- Update action availability logic to optionally include auto-actions after a failed last action; extend tests accordingly.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| broker/test/patron_request/api/api-handler_test.go | Extends integration CRUD test assertions to validate last-action fields across POST and action execution. |
| broker/sqlc/pr_schema.sql | Adds last-action columns to patron_request table schema definition. |
| broker/sqlc/pr_query.sql | Updates Create/Update queries to include last-action columns. |
| broker/patron_request/service/action_mapping_test.go | Adds coverage for GetActionsForPatronRequest behavior with/without state model and for failed last action. |
| broker/patron_request/service/action_mapping.go | Computes available actions based on state model + last action failure status (incl. auto-action handling). |
| broker/patron_request/service/action.go | Ensures last-action fields are updated and persisted on every action execution finalization. |
| broker/patron_request/db/prcql.go | Updates manual rows.Scan to match new column order (including last-action fields). |
| broker/patron_request/api/api-handler.go | Re-fetches PR after auto-actions and maps last-action fields into API model. |
| broker/oapi/open-api.yaml | Documents lastAction/lastActionOutcome/lastActionResult fields on PatronRequest. |
| broker/migrations/019_last_action.up.sql | Adds last-action columns via migration. |
| broker/migrations/019_last_action.down.sql | Drops last-action columns via rollback migration. |
You can also share your feedback on Copilot code review. Take the survey.
| respBytes = httpRequest(t, "POST", thisPrPath+"/action"+queryParams, actionBytes, 200) | ||
| // used to succeed, but the illmock currently does not include items as part of the Loaned message, which causes the action to fail. | ||
| // We should either update the mock to include items or change the test to not use blocking action. | ||
| assert.Equal(t, "{\"actionResult\":\"ERROR\"}\n", string(respBytes)) | ||
|
|
||
| respBytes = httpRequest(t, "GET", thisPrPath+queryParams, []byte{}, 200) | ||
| err = json.Unmarshal(respBytes, &foundPr) | ||
| assert.NoError(t, err, "failed to unmarshal patron request") | ||
| assert.Equal(t, *newPr.Id, foundPr.Id) | ||
| assert.Equal(t, "receive", *foundPr.LastAction) | ||
| assert.Equal(t, "failure", *foundPr.LastActionOutcome) | ||
| assert.Equal(t, "ERROR", *foundPr.LastActionResult) |
| return | ||
| } | ||
| } | ||
| pr, err = a.prRepo.GetPatronRequestById(ctx, pr.ID) |
There was a problem hiding this comment.
@adamdickmeiss it would be more clear if RunAutoActionsOnStateEntry returned an updated version of pr
| return r.SMService | ||
| } | ||
|
|
||
| type ActionEntry struct { |
There was a problem hiding this comment.
@adamdickmeiss could we rename this to PatronRequestAction and the string to ActionName
https://index-data.atlassian.net/browse/CROSSLINK-231