feat(share-consumer): add explicit acknowledgements #560
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 436 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.364
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #560"
general
weight: 0.35
ShogunPanda
Next part of #480, following #545: explicit acknowledgements, and a handler for records that cannot be deserialized.
renewcomes in a separate PR, since it works differently on the broker.What it does
acknowledgementMode,'implicit'(the default, unchanged) or'explicit', on the constructor and onconsume(). The values are inShareAcknowledgementModes.message.acknowledge(type), with'accept'(the default),'release'or'reject'(ShareAcknowledgementTypes). The acknowledgement goes with the next request to the same broker, like the implicit ones, and also with the heartbeats while the buffer is full.acknowledge()returns nothing, and the broker's errors still arrive asshare-consumer:acknowledgement:error. It throws in implicit mode, for an unknown type, and when the message was already acknowledged. Once the stream is closing it does nothing, since closing released the record.onDeserializationError(context), like the one ofConsumer. It returns'reject'or'release'(ShareDeserializationErrorActions) to acknowledge the record that way and go on, or'fail'to destroy the stream as today. The context has theerror, thepayloadType, the rawrecord,topic,partition,offset,timestampanddeliveryCount. It works in both modes. A handler that throws destroys the stream with its error, and one that returns anything else, like a promise, with an error saying so. The failed offset is no longer acknowledged as a GAP.acknowledge()is a method on the message prototype calling one function shared by the stream, asmessage.commit()does inConsumer.Choices to check
acknowledge()returns nothing rather than a promise. An acknowledgement can wait up tomaxWaitTimefor the next request to its broker, so awaiting it in afor awaitloop would stall the loop. Failures come with the event, and a failed acknowledgement means the record is delivered again.Tests
acknowledge(); close releases the unacknowledged records and a lateracknowledge()is ignored; a session stays open while its record waits for the application; acknowledging from thedataevent; the handler rejecting, releasing and failing, a failed header, a handler that throws or returns a promise, and a failed offset next to a gap; option validation.cp-kafka:8.2.0: the first member accepts, releases and rejects three records, and the second member gets only the released one, with a delivery count of 2. It passes locally, and the existing broker test still does. It skips itself where share groups are not available, like the existing one.