fix: resolve remaining review follow-ups

This commit is contained in:
Cita
2026-03-22 23:53:41 +08:00
parent 5d78658af9
commit 29c9fcbd29
5 changed files with 53 additions and 16 deletions
+34
View File
@@ -24,4 +24,38 @@ describe('proxyLogMeta', () => {
messageText: 'network timeout',
});
});
it('handles mixed-case, partial, reordered, and empty metadata safely', () => {
expect(parseProxyLogMetadata('[CLIENT:codex] [SESSION:turn-1] boom')).toEqual({
clientKind: 'codex',
sessionId: 'turn-1',
downstreamPath: null,
upstreamPath: null,
messageText: 'boom',
});
expect(parseProxyLogMetadata('[client:codex] boom')).toEqual({
clientKind: 'codex',
sessionId: null,
downstreamPath: null,
upstreamPath: null,
messageText: 'boom',
});
expect(parseProxyLogMetadata('[upstream:/x] [client:codex] [session:1] msg')).toEqual({
clientKind: 'codex',
sessionId: '1',
downstreamPath: null,
upstreamPath: '/x',
messageText: 'msg',
});
expect(parseProxyLogMetadata('')).toEqual({
clientKind: null,
sessionId: null,
downstreamPath: null,
upstreamPath: null,
messageText: '',
});
});
});