test(producer): pin Tracer header injection through DLQ#191
Merged
Conversation
Existing shouldSendDlqRecordWithAllHeaders covers the static x-dlq-* headers but does NOT verify that a custom Tracer's injectContextInto runs against the outbound record. A future refactor that drops the tracer.injectContextInto(headers) call would silently strip trace context from DLQ records without any test failure. New test dlqRecordCarriesTracerInjectedHeaders wires a tiny anonymous Tracer stub that stamps x-tracer-stamp: yes during injection, sends a record through sendToDlq, and asserts the stamp lands on the captured ProducerRecord. Uses a hand-written stub (not Mockito) so the contract is enforced by behaviour, not by argument matching.
Owner
Author
|
@copilot please review |
Copilot stopped work on behalf of
eschizoid due to an error
June 18, 2026 19:26
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #191 +/- ##
============================================
- Coverage 77.64% 77.60% -0.04%
+ Complexity 732 731 -1
============================================
Files 68 68
Lines 2800 2800
Branches 346 346
============================================
- Hits 2174 2173 -1
Misses 465 465
- Partials 161 162 +1 ☔ View full report in Codecov by Harness. |
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
Closes a criticality-5 coverage gap: a future refactor that drops the
tracer.injectContextInto(headers)call inKPipeProducer.sendToDlqwould silently strip trace context from DLQ records without any existing test failing.dlqRecordCarriesTracerInjectedHeaderstoKPipeProducerTest.Tracerstub (not Mockito) that stampsx-tracer-stamp: yesduringinjectContextInto.ProducerRecord's headers after asendToDlqcall.Existing
shouldSendDlqRecordWithAllHeaderscovers the staticx-dlq-*enrichment headers but never exercises the tracer injection branch; using a hand-written stub keeps the contract enforced by behaviour rather than by Mockito argument matching.No production-code change. Production already invokes the tracer correctly at
KPipeProducer.java:183— this PR just pins that invariant under test.Test plan
./gradlew :lib:kpipe-producer:test— green (24 tests inKPipeProducerTest, was 23).Tracerimplementation, not a mock.