Skip to content

chipingress: batch partial delivery part 2#2114

Draft
pkcll wants to merge 1 commit into
mainfrom
chipingress-batch-partial-delivery-part-2
Draft

chipingress: batch partial delivery part 2#2114
pkcll wants to merge 1 commit into
mainfrom
chipingress-batch-partial-delivery-part-2

Conversation

@pkcll
Copy link
Copy Markdown
Contributor

@pkcll pkcll commented Jun 2, 2026

Summary

  • Use proto enum constants (chipingresspb.PublishErrorCode_*) for error codes instead of raw integer casts
  • Propagate context into completeBatchCallbacksFromResults for proper OTel metric attribution
  • Add backwards-compatibility comment explaining behaviour when server returns empty results in partial-delivery mode
  • Add test for event_id mismatch: verifies positional dispatch still works and records mismatch metric
  • Expand README with batch publishing docs: delivery modes, per-event error codes table, and sizing guidance

Follow-up

This is a follow-up to #2085

Test plan

  • Existing batch client tests pass
  • New event_id mismatch still dispatches by index and records mismatch metric test added

- 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
@pkcll pkcll force-pushed the chipingress-batch-partial-delivery-part-2 branch from 5dadf5a to 285a05c Compare June 4, 2026 21:19
@pkcll pkcll marked this pull request as ready for review June 4, 2026 21:19
@pkcll pkcll requested a review from a team as a code owner June 4, 2026 21:19
Copilot AI review requested due to automatic review settings June 4, 2026 21:19
@pkcll pkcll removed the request for review from hendoxc June 4, 2026 21:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

📊 API Diff Results

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

View full report

@pkcll pkcll marked this pull request as draft June 4, 2026 21:21
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 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.Context into per-result callback completion to attribute OTel metrics correctly.
  • Add docs and tests covering partial-delivery semantics, including positional dispatch when event_id mismatches 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 thread pkg/chipingress/README.md
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"}},
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.

2 participants