From c0352fd5b5193ea2f46df8787e8ae8e6553aedd0 Mon Sep 17 00:00:00 2001 From: doudouOUC Date: Mon, 25 May 2026 14:53:07 +0800 Subject: [PATCH] test(config): cover getOutboundCorrelationPropagateTraceContext defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R4 (commit 9bdd3bd6f) added the getter but the test file didn't grow a corresponding describe block — sibling telemetry getters all have unit tests but this new one was missed. Add 4 cases covering the security-relevant default-to-false invariant and explicit-set behavior: - omitted outboundCorrelation → false - empty outboundCorrelation: {} → false (the `?? false` collapse on the getter, complementing the same on the constructor) - explicit true → true - explicit false → false PR #4390 review (wenshao). 🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code) --- packages/core/src/config/config.test.ts | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/core/src/config/config.test.ts b/packages/core/src/config/config.test.ts index a9badd5878..2e23499b91 100644 --- a/packages/core/src/config/config.test.ts +++ b/packages/core/src/config/config.test.ts @@ -1655,6 +1655,43 @@ describe('Server Config (config.ts)', () => { }); }); + describe('OutboundCorrelation Configuration', () => { + // Default-to-false is security-relevant — controls whether + // `traceparent` is written onto outbound LLM/fetch request streams. + // PR #4390 R4: keep wire-level toggle out of telemetry namespace. + it('defaults outboundCorrelation.propagateTraceContext to false when outboundCorrelation is omitted', () => { + const config = new Config(baseParams); + expect(config.getOutboundCorrelationPropagateTraceContext()).toBe(false); + }); + + it('defaults to false when outboundCorrelation is provided as empty object', () => { + const params: ConfigParameters = { + ...baseParams, + outboundCorrelation: {}, + }; + const config = new Config(params); + expect(config.getOutboundCorrelationPropagateTraceContext()).toBe(false); + }); + + it('honors outboundCorrelation.propagateTraceContext when explicitly set to true', () => { + const params: ConfigParameters = { + ...baseParams, + outboundCorrelation: { propagateTraceContext: true }, + }; + const config = new Config(params); + expect(config.getOutboundCorrelationPropagateTraceContext()).toBe(true); + }); + + it('honors outboundCorrelation.propagateTraceContext when explicitly set to false', () => { + const params: ConfigParameters = { + ...baseParams, + outboundCorrelation: { propagateTraceContext: false }, + }; + const config = new Config(params); + expect(config.getOutboundCorrelationPropagateTraceContext()).toBe(false); + }); + }); + describe('UseRipgrep Configuration', () => { it('should default useRipgrep to true when not provided', () => { const config = new Config(baseParams);