DurableEmitter: Default idempotency key#2200
Open
tarcisiozf wants to merge 6 commits into
Open
Conversation
📊 API Diff Results
|
tarcisiozf
commented
Jun 25, 2026
pkcll
reviewed
Jun 25, 2026
e58d1d7 to
103ee23
Compare
Contributor
There was a problem hiding this comment.
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.IdempotencyKeyAttrwhen absent (currently computed from source + type + body with length prefixes). - Add unit tests verifying defaulting behavior and preserving caller-supplied keys.
- Bump
pkg/chipingressdependency version ingo.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.
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>
|
|
||
| event, err := chipingress.NewEvent(sourceDomain, entityType, body, parseAttrs(attrKVs...)) | ||
| attrs := parseAttrs(attrKVs...) | ||
| if key, _ := attrs[chipingress.IdempotencyKeyAttr].(string); key == "" { |
Contributor
There was a problem hiding this comment.
this is very verbose. there's not a more readable way to handle this?
patrickhuie19
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the idempotency handling in the
DurableEmitterby automatically generating a deterministic idempotency key when one is not supplied.Idempotency Key Generation and Testing Improvements:
pkg/durableemitter/durable_emitter.go: TheEmitmethod 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.