Add batch action events endpoint, refactor/tighten other endpoints - #677
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class “events” support for scheduler batch actions and refactors event retrieval to prefer resource-scoped endpoints (e.g., /ill_transactions/{id}/events) while tightening behavior around synthetic IDs and owner scoping.
Changes:
- Add
/batch_actions/{id}/eventsendpoint backed by a newEventRepo.GetBatchActionEventsquery + supporting DB index. - Add
/ill_transactions/{id}/eventsendpoint and update links/tests to prefer this over/events?.... - Refine scheduler task owner scoping to support owner scopes (nil = unrestricted) and add synthetic-ID rejection for event lookups.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| broker/test/scheduler/db/schedrepo_test.go | Adds coverage for scheduled task owner-scope semantics (nil vs empty vs specific owners). |
| broker/test/mocks/mock_eventrepo.go | Updates event repo mocks to satisfy the new GetBatchActionEvents interface method. |
| broker/test/events/eventbus_test.go | Adds integration test coverage for querying batch-action events ordered by timestamp. |
| broker/test/api/api-handler_test.go | Updates API tests to expect the new ILL-transaction events endpoint and adds broker coverage for it. |
| broker/sqlc/sched_query.sql | Refactors scheduler-task queries to accept owner scopes (owners array / nil scope). |
| broker/sqlc/event_query.sql | Adds GetBatchActionEvents query filtering by taskId inside event_data JSON. |
| broker/scheduler/db/repo.go | Updates scheduler repo interface and Pg implementation for owner scopes. |
| broker/scheduler/api/api_handler.go | Adds batch-action events endpoint and switches batch-action lookups to owner-scope resolution. |
| broker/scheduler/api/api_handler_test.go | Expands scheduler API tests for owner-scope behavior and batch-action events endpoint. |
| broker/patron_request/api/api-handler.go | Rejects synthetic IDs for patron-request event lookups. |
| broker/patron_request/api/api-handler_test.go | Adds test coverage for rejecting synthetic IDs in patron-request events endpoint. |
| broker/oapi/sched-cfg.yaml | Configures scheduler OpenAPI generation to apply the overlay. |
| broker/oapi/open-api.yaml | Adds new endpoints/links (batch-actions link, batch-action events, ILL-transaction events) and related descriptions. |
| broker/migrations/051_add_batch_action_event_index.up.sql | Adds a partial index to optimize batch-action event lookup by taskId + timestamp. |
| broker/migrations/051_add_batch_action_event_index.down.sql | Adds the corresponding index rollback migration. |
| broker/events/eventrepo.go | Extends EventRepo and Pg implementation with GetBatchActionEvents. |
| broker/events/eventmodels.go | Introduces events.IsSyntheticID helper used to reject placeholder IDs in event endpoints. |
| broker/events/eventbus_test.go | Updates event-repo test repo stub to satisfy the new interface method. |
| broker/descriptors/ModuleDescriptor-template.json | Adds module permissions for the new broker endpoints (ILL transaction events, batch-action events). |
| broker/app/app.go | Wires eventRepo into the scheduler API handler constructor. |
| broker/api/api-handler.go | Adds batch-actions link on index, adds /ill_transactions/{id}/events, rejects synthetic IDs, and updates EventsLink generation. |
| broker/api/api_handler_test.go | Adds unit tests ensuring synthetic IDs are rejected for event lookup endpoints. |
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.
No description provided.