Repository navigation
🐛 fix(sink/kafka): require all acks to prevent silent message loss (REL-07) - #166
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the Kafka sink’s delivery guarantees by explicitly requiring ISR acknowledgements, eliminating a “fire-and-forget” default that could silently drop events after broker/leader failure.
Changes:
- Set
RequiredAcks: kafka.RequireAllon the struct-literalkafka.Writerto avoid theNewWriterdefault-coercion bypass. - Add a regression unit test ensuring
NewBackendconstructs a writer withRequireAllacks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/sink/kafka/backend.go | Explicitly configures the Kafka writer to require all in-sync replica acknowledgements. |
| internal/sink/kafka/backend_test.go | Adds a regression test asserting RequiredAcks is set to kafka.RequireAll. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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.



REL-07 (P2) — Kafka sink was fire-and-forget (silent data loss)
Surfaced by the 2026-08-02 /project-audit (reliability lens). The Kafka writer was built as a struct literal
&kafka.Writer{...}withRequiredAcksunset — which bypasses kafka-go'sNewWriter0→RequireAllcoercion, leaving the effective value atRequireNone.WriteMessagescould return nil before the broker persisted → events silently lost on post-accept broker/leader failure, no error surfaced.Fix
Set
RequiredAcks: kafka.RequireAllexplicitly on the writer.Async/Completionare unset soWriteMessagesis synchronous and returns the ISR-ack error, which the caller (pipeline/wire.go:174) already treats as a failure.Review
Independent reviewer: APPROVE, no findings — verified the fix is on the real writer, the caller treats ack errors as failures (not fire-and-forget), and the test is a genuine regression guard needing no broker. Gates green.