/** * The correlation store (nest/common/request-correlation.ts): which incoming * ids are adopted, how a unit of work nests inside another, and how the tag * reads in a log line. */ import { acceptRequestId, childCorrelation, correlationTag, currentCorrelation, newCorrelationId, runWithCorrelation, } from '../../../../src/nest/common/request-correlation'; import { describe, it, expect } from 'vitest'; describe('acceptRequestId', () => { it('CORR-001: adopts the ids proxies and tracers send', () => { for (const id of [ 'abc123', '7f9c2ba4-e88f-11ec-8ea0-0242ac120002', 'Root=1-5759e988-bd862e3fe1be46a994272793', 'a.b_c:d', ]) { expect(acceptRequestId(id)).toBe(id); } }); it('CORR-002: refuses anything that could forge or bloat a log line', () => { expect(acceptRequestId('')).toBeNull(); expect(acceptRequestId('x'.repeat(129))).toBeNull(); expect(acceptRequestId('has space')).toBeNull(); expect(acceptRequestId('line\nbreak')).toBeNull(); expect(acceptRequestId('