Skip to content

fix(ts-sdk): honor options.priority and options.scope in EventClient.bulkPush#3932

Open
sushaan-k wants to merge 1 commit into
hatchet-dev:mainfrom
sushaan-k:aarya/fix-bulk-push-options-drop
Open

fix(ts-sdk): honor options.priority and options.scope in EventClient.bulkPush#3932
sushaan-k wants to merge 1 commit into
hatchet-dev:mainfrom
sushaan-k:aarya/fix-bulk-push-options-drop

Conversation

@sushaan-k
Copy link
Copy Markdown

@sushaan-k sushaan-k commented May 18, 2026

Hi! Picking up #3931.

EventClient.bulkPush(type, inputs, options) silently dropped options.priority and options.scope. The per-event mapping only read those fields from each input, and never fell back to the shared options argument. additionalMetadata already falls back to options.additionalMetadata, and EventClient.push reads all three fields directly from options, so the bulk path was the odd one out.

Fix mirrors the additionalMetadata pattern:

priority: input.priority ?? options.priority,
scope: input.scope ?? options.scope,

Per-event overrides still win, and the shared options apply to every event in the batch that doesn't set its own.

Testing

Added a unit test that covers both paths: an event with no per-event override picks up the shared option, an event with a per-event override keeps its own.

cd sdks/typescript
pnpm exec jest src/clients/event/event-client.test.ts   # 6/6 pass
pnpm lint:check                                          # clean
pnpm exec tsc                                            # clean

Closes #3931

…bulkPush

`EventClient.bulkPush(type, inputs, options)` silently dropped
`options.priority` and `options.scope` because the per-event mapping only
read those fields from each `EventWithMetadata` input and never fell back
to the shared `options` argument. `additionalMetadata` already falls back
to `options.additionalMetadata`, and `EventClient.push` honors all three
fields from `options`, so the previous behaviour was inconsistent.

Mirror the `additionalMetadata` fallback for `priority` and `scope` so
the shared options argument applies to every event in the batch that
does not set its own override.

Closes hatchet-dev#3931
Copilot AI review requested due to automatic review settings May 18, 2026 03:13
@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

@sushaan-k is attempting to deploy a commit to the Hatchet Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an inconsistency in the TypeScript SDK’s EventClient.bulkPush by ensuring options.priority and options.scope are applied as batch-wide defaults for events that don’t specify per-event overrides (matching push behavior and how additionalMetadata already works).

Changes:

  • Apply options.priority / options.scope as fallbacks in bulkPush’s per-event request mapping (input.* ?? options.*).
  • Add a unit test validating both the shared-default behavior and per-event override precedence.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
sdks/typescript/src/clients/event/event-client.ts Ensures bulk-pushed events inherit priority/scope from shared options when not set per event.
sdks/typescript/src/clients/event/event-client.test.ts Adds coverage confirming defaults are applied and per-event values take precedence.

@BloggerBust
Copy link
Copy Markdown
Contributor

This fix looks good! It makes bulkPush consistent with push for priority and scope, while still allowing event values to override the shared options. The added test covers the important shared-default and event-override cases, and I also ran the tests and typechecker locally. Thanks!

@BloggerBust
Copy link
Copy Markdown
Contributor

@sushaan-k one release housekeeping request before merge: could you bump the TypeScript SDK package version in sdks/typescript/package.json to 1.23.0 and add a changelog entry for the bulkPush priority/scope fix in sdks/typescript/CHANGELOG.md?

PR #3933 can add its own separate changelog entry under the same version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][Typescript SDK] EventClient.bulkPush silently drops options.priority and options.scope

3 participants