Skip to content

Add batch action events endpoint, refactor/tighten other endpoints - #677

Merged
jakub-id merged 2 commits into
mainfrom
batch-action-events-api
Jul 22, 2026
Merged

Add batch action events endpoint, refactor/tighten other endpoints#677
jakub-id merged 2 commits into
mainfrom
batch-action-events-api

Conversation

@jakub-id

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 21, 2026 23:38

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 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}/events endpoint backed by a new EventRepo.GetBatchActionEvents query + supporting DB index.
  • Add /ill_transactions/{id}/events endpoint 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.

Comment thread broker/sqlc/sched_query.sql
Comment thread broker/scheduler/api/api_handler.go
Comment thread broker/scheduler/api/api_handler_test.go
@jakub-id
jakub-id merged commit eb415c1 into main Jul 22, 2026
8 of 10 checks passed
@jakub-id
jakub-id deleted the batch-action-events-api branch July 22, 2026 00:07
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.

2 participants