Skip to content

DurableEmitter: Default idempotency key#2200

Merged
DylanTinianov merged 9 commits into
mainfrom
CRE-4733/durable-emitter-idemp-key
Jun 29, 2026
Merged

DurableEmitter: Default idempotency key#2200
DylanTinianov merged 9 commits into
mainfrom
CRE-4733/durable-emitter-idemp-key

Conversation

@tarcisiozf

@tarcisiozf tarcisiozf commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This pull request enhances the idempotency handling in the DurableEmitter by automatically generating a deterministic idempotency key when one is not supplied.

Idempotency Key Generation and Testing Improvements:

  • pkg/durableemitter/durable_emitter.go: The Emit method now generates a SHA256-based idempotency key from the source domain, entity type, and event body if the caller does not provide one. This ensures event deduplication and deterministic key generation.
  • pkg/durableemitter/durable_emitter_test.go: Added tests to verify that the idempotency key is correctly generated by default and that a caller-supplied key is preserved. These tests confirm the robustness of the new idempotency logic.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-common

View full report

Comment thread go.mod Outdated
Comment thread pkg/durableemitter/durable_emitter.go Outdated
Base automatically changed from CRE-4733/chip-idemp-key to main June 26, 2026 15:29
@tarcisiozf tarcisiozf force-pushed the CRE-4733/durable-emitter-idemp-key branch from e58d1d7 to 103ee23 Compare June 26, 2026 15:37
@tarcisiozf tarcisiozf marked this pull request as ready for review June 26, 2026 15:41
@tarcisiozf tarcisiozf requested a review from a team as a code owner June 26, 2026 15:41
Copilot AI review requested due to automatic review settings June 26, 2026 15:41

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

This PR updates DurableEmitter to automatically set a CloudEvent idempotency key when the caller doesn’t supply one, enabling consistent downstream deduplication.

Changes:

  • Default chipingress.IdempotencyKeyAttr when absent (currently computed from source + type + body with length prefixes).
  • Add unit tests verifying defaulting behavior and preserving caller-supplied keys.
  • Bump pkg/chipingress dependency version in go.mod/go.sum.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/durableemitter/durable_emitter.go Adds default idempotency key computation when missing.
pkg/durableemitter/durable_emitter_test.go Adds tests for defaulting and caller-supplied idempotency keys.
go.mod Updates github.com/smartcontractkit/chainlink-common/pkg/chipingress version.
go.sum Updates checksums for the bumped chipingress module version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/durableemitter/durable_emitter.go Outdated
Comment thread pkg/durableemitter/durable_emitter.go Outdated
Comment thread pkg/durableemitter/durable_emitter_test.go Outdated
Comment thread pkg/durableemitter/durable_emitter.go Outdated
patrickhuie19
patrickhuie19 previously approved these changes Jun 26, 2026
tarcisiozf and others added 7 commits June 29, 2026 10:41
Co-authored-by: Pavel <177363085+pkcll@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@tarcisiozf tarcisiozf force-pushed the CRE-4733/durable-emitter-idemp-key branch from e1ef533 to faaafc6 Compare June 29, 2026 13:41
Comment thread pkg/durableemitter/durable_emitter_test.go
pkcll
pkcll previously approved these changes Jun 29, 2026
@DylanTinianov DylanTinianov added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit 6bcb242 Jun 29, 2026
32 of 33 checks passed
@DylanTinianov DylanTinianov deleted the CRE-4733/durable-emitter-idemp-key branch June 29, 2026 21:12
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.

5 participants