refactor(cliproxy): address review feedback on parity and refresh flow

- make refresh ownership handling exhaustive in provider refresher

- extend backend/ui sync test to provider IDs and device-code providers

- remove DEFAULT_CURSOR_PORT re-export from use-cursor hook

- import cursor default port directly from shared defaults module
This commit is contained in:
Tam Nhu Tran committed 2026-02-18 03:24:28 +07:00
1 parent 5a786263bc
commit 39593c161b
4 files changed
+40 -19

No files matched your search

@@ -7,10 +7,22 @@
import { describe, expect, test } from 'bun:test';
import { CLIPROXY_DEFAULT_PORT as BACKEND_CLIPROXY_DEFAULT_PORT } from '../../../src/cliproxy/config/port-manager';
import { DEFAULT_CURSOR_PORT as BACKEND_CURSOR_DEFAULT_PORT } from '../../../src/cursor/cursor-models';
import {
CLIPROXY_PROVIDER_IDS as BACKEND_CLIPROXY_PROVIDER_IDS,
getProvidersByOAuthFlow,
} from '../../../src/cliproxy/provider-capabilities';
import {
CLIPROXY_DEFAULT_PORT as UI_CLIPROXY_DEFAULT_PORT,
DEFAULT_CURSOR_PORT as UI_CURSOR_DEFAULT_PORT,
} from '../../../ui/src/lib/default-ports';
import {
CLIPROXY_PROVIDERS as UI_CLIPROXY_PROVIDERS,
DEVICE_CODE_PROVIDERS as UI_DEVICE_CODE_PROVIDERS,
} from '../../../ui/src/lib/provider-config';
function sorted(values: readonly string[]): string[] {
return [...values].sort((a, b) => a.localeCompare(b));
}
describe('Default Port Sync', () => {
test('CLIProxy default port is synced between backend and UI', () => {
@@ -20,4 +32,12 @@ describe('Default Port Sync', () => {
test('Cursor default port is synced between backend and UI', () => {
expect(UI_CURSOR_DEFAULT_PORT).toBe(BACKEND_CURSOR_DEFAULT_PORT);
});
test('CLIProxy provider IDs are synced between backend and UI', () => {
expect(sorted(UI_CLIPROXY_PROVIDERS)).toEqual(sorted(BACKEND_CLIPROXY_PROVIDER_IDS));
});
test('Device code providers are synced between backend and UI', () => {
expect(sorted(UI_DEVICE_CODE_PROVIDERS)).toEqual(sorted(getProvidersByOAuthFlow('device_code')));
});
});