- resolveTelemetryPatch: extracted pure switch resolution (unit-tested); fails loud when DSH_TELEMETRY_DISABLED is set but the row is absent, and documents that ANY non-empty value (including '0'/'false') disables. - runHeadless: SIGINT/SIGTERM now dispose the tree before exit so the telemetry tail and shutdown marker drain (Node's default signal exit skips disposal). - web.cordis.yml: explicit maxQueueSize beside maxExportBatchSize (the single-batch drain invariant no longer leans on an SDK default), comment covers exportTimeoutMillis's role and links the Agent Note. - apps/web scaffold: disable telemetry-otel — fixture sessions must never leave the process. - apps/cli README (en/zh + pairing): document the default endpoint, both env seams, and the no-redaction disclosure.
24 lines
965 B
TypeScript
24 lines
965 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { resolveTelemetryPatch } from '../src/app-cli-entry.ts'
|
|
|
|
describe('resolveTelemetryPatch', () => {
|
|
it('keeps telemetry enabled when the switch is unset or empty', () => {
|
|
expect(resolveTelemetryPatch(undefined, true)).toBeUndefined()
|
|
expect(resolveTelemetryPatch('', true)).toBeUndefined()
|
|
})
|
|
|
|
it('disables on ANY non-empty value, including falsy-looking ones', () => {
|
|
for (const value of ['1', '0', 'false', 'no']) {
|
|
expect(resolveTelemetryPatch(value, true)).toEqual({ id: 'telemetry-otel', disabled: true })
|
|
}
|
|
})
|
|
|
|
it('fails loud when the switch is set but the row is absent', () => {
|
|
expect(() => resolveTelemetryPatch('1', false)).toThrow('DSH_TELEMETRY_DISABLED is set but row "telemetry-otel" is not in this composition')
|
|
})
|
|
|
|
it('ignores a missing row while the switch is unset', () => {
|
|
expect(resolveTelemetryPatch(undefined, false)).toBeUndefined()
|
|
})
|
|
})
|