BatchOperation tracks the outcome of a bulk trigger request against a Job. When you trigger a job with multiple items in a single request (via POST /v1/jobs/{jobID}/trigger-bulk), Strait creates a batch operation to record how many items were submitted and how many Runs were actually created.
BatchOperation Model
TheBatchOperation struct (defined in apps/strait/internal/domain/types.go) contains the following fields:
How Batch Operations Work
Batch operations are not created directly through the API. They are created automatically when a bulk trigger request is made:- A client sends a
POST /v1/jobs/{jobID}/trigger-bulkrequest containing multiple items. - Strait creates a
BatchOperationrecord withitem_countset to the number of items in the request. - For each item, Strait attempts to create a run. The resulting runs have their
batch_idfield set to the batch operation’sid. created_countreflects the number of runs that were actually created. This may be lower thanitem_countif some items were deduplicated (see dedup_window_secs).- Once all items have been processed,
finished_atis set.
The difference between
item_count and created_count is a useful signal. A large gap typically indicates deduplication is filtering out duplicate payloads within the configured window.Querying Batch Status
Two read-only endpoints are available for inspecting batch operations:
To find all runs that belong to a specific batch, query runs and filter by
batch_id:
finished_at is non-null.