fix: resolve remaining review follow-ups
This commit is contained in:
@@ -2,9 +2,13 @@ import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
|
||||
const getProxyFileByPublicIdForOwnerMock = vi.fn();
|
||||
|
||||
vi.mock('../../services/proxyFileStore.js', () => ({
|
||||
vi.mock('../../services/proxyFileStore.js', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('../../services/proxyFileStore.js')>();
|
||||
return {
|
||||
...actual,
|
||||
getProxyFileByPublicIdForOwner: (...args: unknown[]) => getProxyFileByPublicIdForOwnerMock(...args),
|
||||
}));
|
||||
};
|
||||
});
|
||||
|
||||
describe('inlineLocalInputFileReferences', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parseProxyLogMetadata } from '../../../shared/proxyLogMeta.js';
|
||||
import { parseProxyLogMetadata, type ParsedProxyLogMetadata } from '../../../shared/proxyLogMeta.js';
|
||||
|
||||
type ComposeProxyLogMessageArgs = {
|
||||
clientKind?: string | null;
|
||||
@@ -9,13 +9,7 @@ type ComposeProxyLogMessageArgs = {
|
||||
errorMessage?: string | null;
|
||||
};
|
||||
|
||||
export type ParsedProxyLogMessageMeta = {
|
||||
clientKind: string | null;
|
||||
sessionId: string | null;
|
||||
downstreamPath: string | null;
|
||||
upstreamPath: string | null;
|
||||
messageText: string;
|
||||
};
|
||||
export type ParsedProxyLogMessageMeta = ParsedProxyLogMetadata;
|
||||
|
||||
export function parseProxyLogMessageMeta(rawMessage: string): ParsedProxyLogMessageMeta {
|
||||
return parseProxyLogMetadata(rawMessage);
|
||||
|
||||
@@ -2,10 +2,13 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const getProxyFileByPublicIdForOwnerMock = vi.fn();
|
||||
|
||||
vi.mock('./proxyFileStore.js', () => ({
|
||||
vi.mock('./proxyFileStore.js', async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import('./proxyFileStore.js')>();
|
||||
return {
|
||||
...actual,
|
||||
getProxyFileByPublicIdForOwner: (...args: unknown[]) => getProxyFileByPublicIdForOwnerMock(...args),
|
||||
LOCAL_PROXY_FILE_ID_PREFIX: 'file-metapi-',
|
||||
}));
|
||||
};
|
||||
});
|
||||
|
||||
describe('proxyInputFileResolver', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -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: '',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -290,7 +290,7 @@ export default function Settings() {
|
||||
const query = selectorGroupSearch.trim();
|
||||
if (!query) return groupRouteOptions;
|
||||
return groupRouteOptions.filter((route) => {
|
||||
const matchText = `${resolveRouteTitle(route)} ${route.modelPattern} ${route.displayName || ''}`;
|
||||
const matchText = `${resolveRouteTitle(route)} ${route.modelPattern}`;
|
||||
return fuzzyMatch(matchText, query);
|
||||
});
|
||||
}, [groupRouteOptions, selectorGroupSearch]);
|
||||
@@ -1970,6 +1970,8 @@ export default function Settings() {
|
||||
<BrandGlyph brand={routeBrand} alt={routeTitle} size={18} fallbackText={routeTitle} />
|
||||
) : routeIcon.kind === 'auto' ? (
|
||||
<InlineBrandIcon model={route.modelPattern} size={18} />
|
||||
) : routeIcon.kind === 'none' ? (
|
||||
null
|
||||
) : null}
|
||||
</span>
|
||||
<span style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
||||
|
||||
Reference in New Issue
Block a user