chipingress: batch partial delivery part 2#2114
Draft
pkcll wants to merge 1 commit into
Draft
Conversation
- Use proto enum constants for error codes instead of raw integer casts - Propagate context into completeBatchCallbacksFromResults for metrics - Add backwards-compat comment for empty server response in partial mode - Add test for event_id mismatch with positional dispatch and mismatch metric - Expand README with batch publishing, delivery modes, error codes, and sizing docs
5dadf5a to
285a05c
Compare
📊 API Diff Results
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the ChipIngress batch partial-delivery work by tightening error-code handling, improving OTel metric attribution, expanding batch publishing documentation, and extending batch client tests around result dispatch behavior.
Changes:
- Switch batch client error code constants to use generated proto enum constants (instead of raw integer casts).
- Propagate
context.Contextinto per-result callback completion to attribute OTel metrics correctly. - Add docs and tests covering partial-delivery semantics, including positional dispatch when
event_idmismatches and metrics for mismatches.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/chipingress/README.md | Adds batch publishing documentation: delivery modes, per-event error codes, and sizing guidance. |
| pkg/chipingress/batch/client.go | Uses proto enum constants for error codes; propagates context into result callback completion; documents empty-results compatibility behavior. |
| pkg/chipingress/batch/client_test.go | Adds test ensuring event_id mismatch still dispatches by index and increments mismatch metrics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+95
to
+98
| import ( | ||
| "github.com/smartcontractkit/chainlink-common/pkg/chipingress" | ||
| "github.com/smartcontractkit/chainlink-common/pkg/chipingress/batch" | ||
| ) |
Comment on lines
+320
to
328
| // All-or-nothing (transactionEnabled), or partial delivery with no | ||
| // per-event results to dispatch. The latter assumes a server in | ||
| // partial-delivery mode always returns per-event results for a | ||
| // non-empty batch; if it returns an empty/nil response instead | ||
| // (e.g. an older server unaware of results), we treat the whole | ||
| // batch as succeeded for backwards compatibility. This means a | ||
| // silent server-side drop would be reported as success. | ||
| b.completeBatchCallbacks(batchMessages, nil) | ||
| } |
| {EventId: "e1"}, | ||
| // EventId disagrees with messages[1].event.Id ("e2"); the | ||
| // error must still be dispatched positionally to e2's callback. | ||
| {EventId: "wrong-id", Error: &chipingress.PublishError{ErrorCode: chipingress.PublishErrorCode(1), Reason: "bad"}}, |
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.
Summary
chipingresspb.PublishErrorCode_*) for error codes instead of raw integer castscompleteBatchCallbacksFromResultsfor proper OTel metric attributionFollow-up
This is a follow-up to #2085
Test plan
event_id mismatch still dispatches by index and records mismatch metrictest added