Skip to content

fix(sdk): preserve idempotencyKeyOptions on batch.triggerBy* paths - #4422

Closed
Ayush7614 wants to merge 1 commit into
triggerdotdev:mainfrom
Ayush7614:fix/sdk-batch-by-idempotency-key-options
Closed

fix(sdk): preserve idempotencyKeyOptions on batch.triggerBy* paths#4422
Ayush7614 wants to merge 1 commit into
triggerdotdev:mainfrom
Ayush7614:fix/sdk-batch-by-idempotency-key-options

Conversation

@Ayush7614

@Ayush7614 Ayush7614 commented Jul 29, 2026

Copy link
Copy Markdown

Summary

batch.triggerById / ByIdAndWait / ByTask / ByTaskAndWait (array + stream) hashed idempotency keys but never attached idempotencyKeyOptions. Same gap in transformSingleTaskBatchItemsStream. Aligns these paths with the existing batchTrigger / batchTriggerAndWait builders so original key + scope are stored for API/dashboard.

✅ Checklist

  • I have followed the Contributing guide
  • I have checked my changes against the title conventions
  • I have performed a self-review of my code
  • I have written tests for this change (if applicable)
  • I have updated documentation (if applicable)

Testing

  • Compared against task.batchTrigger / batchTriggerAndWait, which already attach idempotencyKeyOptions
  • Verified all triggerBy* array + stream builders now call getIdempotencyKeyOptions and send idempotencyKeyOptions in the NDJSON item options
  • Added changeset for @trigger.dev/sdk (patch)

Changelog

SDK batch triggerBy* APIs now preserve idempotency key scope and original key metadata instead of only sending the hash.

Array and stream builders for triggerById/ByTask (and related stream
transforms) hashed keys but dropped scope/original-key metadata. Match
the existing batchTrigger paths so dashboard/API show the real key.
@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e00ea88

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 28 packages
Name Type
@trigger.dev/sdk Patch
@trigger.dev/python Patch
@internal/dashboard-agent Patch
@internal/sdk-compat-tests Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@trigger.dev/plugins Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
@trigger.dev/rbac Patch
@trigger.dev/sso Patch
trigger.dev Patch
@internal/cache Patch
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/run-store Patch
@internal/schedule-engine Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/tsql Patch
@internal/zod-worker Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Hi @Ayush7614, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Jul 29, 2026

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 230b568e-f756-4ff9-a00f-4481eda4106d

📥 Commits

Reviewing files that changed from the base of the PR and between 2f1734c and e00ea88.

📒 Files selected for processing (2)
  • .changeset/fix-batch-by-idempotency-key-options.md
  • packages/trigger-sdk/src/v3/shared.ts

Walkthrough

Batch trigger array mappings and NDJSON stream transforms now compute per-item idempotency keys once, select item or indexed batch keys, preserve TTL precedence, and conditionally attach idempotencyKeyOptions. A Changesets entry records a patch release for @trigger.dev/sdk.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant