feat(share-consumer): add ShareConsumer group membership (KIP-932) #536
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 545 lines diff across 6 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.377
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #536"
general
weight: 0.35
ShogunPanda
Second step of #480: a
ShareConsumerclient which manages the membership of a share group. Fetching records and the implicit acknowledgement come in the next PR, to keep this one reviewable.What it does
new ShareConsumer({ groupId, ... })generates the member id, which is kept for the whole life of the client as ShareGroupHeartbeat requires.joinGroup({ topics })sends ShareGroupHeartbeat with member epoch 0 and resolves with the member id. After that a heartbeat is sent at the interval the coordinator returns, with the full subscription every time.Admindoes, so heartbeats never load topic metadata and a missing topic cannot block them.Consumerdoes.leaveGroup()sends member epoch -1. If it fails, the error is returned but the membership ends anyway, and the coordinator removes the member when its session times out, like the consumer group protocol path ofConsumer. Heartbeating again could otherwise join the group again when only the response to the leave was lost.close()leaves through the already open coordinator connection, bounded byleaveGroupTimeout, likeConsumer.joinGroupfails while a leave is in flight, concurrentleaveGroupcalls share one request, andclose()during a leave sends the leave again instead of skipping it.share-consumer:group:andshare-consumer:heartbeat:, tracing channelsshare-consumer:groupandshare-consumer:heartbeat, and thekafka_share_consumersgauge.Consumeris not touched.#findGroupCoordinator,#handleErrorand#leaveGroupWhileClosingare copied from it, because they are private toConsumer. I can move them to a shared module instead if you prefer, but that would touchConsumer.Questions
1. Event prefix: I used
share-consumer:rather than reusingconsumer:, since it is a separate client. OK?2.
joinGroupandleaveGroupare public so the membership can be used and tested on its own. In the next PRconsume({ topics })will join if needed, likeConsumerdoes. Fine to keep them public, or would you rather hide them until then?3. Should the class be marked experimental until acknowledgements land?
Tests
leaveGroupTimeout, and the interleavings of join, leave, close and retries. They cover 98.9% of the lines and 98.1% of the branches ofshare-consumer.ts, so the coverage gate holds on the Kafka versions where the broker test is skipped.cp-kafka:8.2.0. It skips itself when the broker does not advertise ShareGroupHeartbeat, or answers UNSUPPORTED_VERSION because share groups are disabled, as oncp-kafka:8.1.0(checked locally).cp-kafka:8.2.0: subscribing to a topic before it exists and then creating it (its partition gets assigned), deleting another subscribed topic (it leaves the assignment and the heartbeats keep succeeding), then leaving.src/diagnostic.ts,src/utils.ts(two debug loggers), the client exports and the validators count changed outside the new files.