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