chore(cliproxy): refresh formatting, throw-error baseline, and hardening inventory

This commit is contained in:
Tam Nhu Tran committed 2026-09-02 11:31:43 -04:00
1 parent ed1badcfcb
commit 3ce7c01d95
8 files changed
+34 -27

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"scope": "src/**/*.{ts,tsx,js,jsx,mjs,cjs}",
"syncFs": {
"totalOccurrences": 2509,
"totalOccurrences": 2513,
"filesAffected": 263,
"hotpathOccurrences": 1183,
"hotpathFilesAffected": 156,
+1 -1
View File
@@ -6,7 +6,7 @@ Scope: `src/**/*.{ts,tsx,js,jsx,mjs,cjs}`
| Metric | Value |
|---|---:|
| Sync fs occurrences (all) | 2509 |
| Sync fs occurrences (all) | 2513 |
| Sync fs files affected (all) | 263 |
| Sync fs occurrences (runtime hotpaths) | 1183 |
| Sync fs files affected (runtime hotpaths) | 156 |
+12 -12
View File
@@ -8,12 +8,12 @@
"src/channels/official-channels-store.ts:291",
"src/channels/official-channels-store.ts:296",
"src/channels/official-channels-store.ts:299",
"src/cliproxy/accounts/drain-order.ts:131",
"src/cliproxy/accounts/drain-order.ts:139",
"src/cliproxy/accounts/drain-order.ts:246",
"src/cliproxy/accounts/drain-order.ts:253",
"src/cliproxy/accounts/drain-order.ts:279",
"src/cliproxy/accounts/drain-order.ts:342",
"src/cliproxy/accounts/drain-order.ts:149",
"src/cliproxy/accounts/drain-order.ts:157",
"src/cliproxy/accounts/drain-order.ts:264",
"src/cliproxy/accounts/drain-order.ts:271",
"src/cliproxy/accounts/drain-order.ts:297",
"src/cliproxy/accounts/drain-order.ts:360",
"src/cliproxy/accounts/registry.ts:521",
"src/cliproxy/accounts/registry.ts:536",
"src/cliproxy/accounts/registry.ts:544",
@@ -38,10 +38,10 @@
"src/cliproxy/binary/installer.ts:74",
"src/cliproxy/binary/installer.ts:88",
"src/cliproxy/binary/lifecycle.ts:137",
"src/cliproxy/binary/platform-detector.ts:153",
"src/cliproxy/binary/platform-detector.ts:160",
"src/cliproxy/binary/platform-detector.ts:152",
"src/cliproxy/binary/platform-detector.ts:159",
"src/cliproxy/binary/verifier.ts:55",
"src/cliproxy/binary/version-checker.ts:108",
"src/cliproxy/binary/version-checker.ts:118",
"src/cliproxy/config/base-config-loader.ts:54",
"src/cliproxy/config/base-config-loader.ts:66",
"src/cliproxy/config/base-config-loader.ts:81",
@@ -59,9 +59,9 @@
"src/cliproxy/executor/proxy-resolver.ts:177",
"src/cliproxy/executor/session-bridge.ts:147",
"src/cliproxy/proxy/https-tunnel-proxy.ts:61",
"src/cliproxy/routing/routing-strategy.ts:480",
"src/cliproxy/routing/routing-strategy.ts:488",
"src/cliproxy/routing/routing-strategy.ts:708",
"src/cliproxy/routing/routing-strategy.ts:490",
"src/cliproxy/routing/routing-strategy.ts:498",
"src/cliproxy/routing/routing-strategy.ts:718",
"src/cliproxy/services/remote-auth-fetcher.ts:139",
"src/cliproxy/services/remote-auth-fetcher.ts:150",
"src/cliproxy/services/remote-auth-fetcher.ts:152",
+1 -4
View File
@@ -40,10 +40,7 @@ export const DRAIN_ORDER_MIN_VERSION: CLIProxyBackendMinVersions = {
plus: '6.6.107-0',
};
export function isDrainOrderSupported(
backend: CLIProxyBackend,
installedVersion: string
): boolean {
export function isDrainOrderSupported(backend: CLIProxyBackend, installedVersion: string): boolean {
return meetsBackendMinimumVersion(installedVersion, backend, DRAIN_ORDER_MIN_VERSION);
}
+1 -4
View File
@@ -124,10 +124,7 @@ function getReleaseArchForBackend(
publicArch: SupportedArch,
releaseArch: SupportedArch
): SupportedArch {
if (
publicArch === 'arm64' &&
!isAtLeastVersion(version, AARCH64_ASSET_MIN_VERSION[backend])
) {
if (publicArch === 'arm64' && !isAtLeastVersion(version, AARCH64_ASSET_MIN_VERSION[backend])) {
return 'arm64';
}
@@ -95,11 +95,15 @@ describe('Backend Selection', () => {
it('selects arm64 vs aarch64 release assets across original and plus boundaries', () => {
// Original pre-rename boundaries (<= 6.9.47) use arm64
for (const version of [undefined, '6.9.45', '6.9.47']) {
const effectiveVersion = version || platformDetector.BACKEND_CONFIG.original.fallbackVersion;
const effectiveVersion =
version || platformDetector.BACKEND_CONFIG.original.fallbackVersion;
withMockedProcessPlatform('darwin', 'arm64', () => {
const info = platformDetector.detectPlatform(version, 'original');
assert.strictEqual(info.arch, 'arm64');
assert.strictEqual(info.binaryName, `CLIProxyAPI_${effectiveVersion}_darwin_arm64.tar.gz`);
assert.strictEqual(
info.binaryName,
`CLIProxyAPI_${effectiveVersion}_darwin_arm64.tar.gz`
);
assert.strictEqual(
platformDetector.getDownloadUrl(version, 'original'),
`https://github.com/router-for-me/CLIProxyAPI/releases/download/v${effectiveVersion}/CLIProxyAPI_${effectiveVersion}_darwin_arm64.tar.gz`
@@ -18,7 +18,8 @@ describe('cliproxy routing strategy service', () => {
let binaryBackend: CLIProxyBackend = 'original';
let binaryVersion = '7.2.127-7';
let installedVersionQueriedBackend: CLIProxyBackend | undefined = undefined;
let loggedWarnings: Array<{ event: string; message: string; context?: Record<string, unknown> }> = [];
let loggedWarnings: Array<{ event: string; message: string; context?: Record<string, unknown> }> =
[];
let responseFactory: (() => Promise<Response>) | null = null;
beforeEach(async () => {
@@ -19,6 +19,8 @@ import * as path from 'path';
mock.module('../../../cliproxy/proxy/proxy-detector', () => ({
detectRunningProxy: async () => ({ running: false, verified: false }),
waitForProxyHealthy: async () => ({ running: false, verified: false }),
reclaimOrphanedProxy: () => {},
}));
describe('handleOrderSubcommand', () => {
@@ -199,7 +201,7 @@ describe('handleOrderSubcommand', () => {
expect(output).toContain('reset to file order');
expect(output).toContain('no priority set');
});
});
});
describe('binary version capability gate (#1724)', () => {
const cases: Array<{
@@ -225,7 +227,13 @@ describe('handleOrderSubcommand', () => {
},
];
for (const { backend, belowMinVersion, atMinVersion, backendLabel, requiredMinVersion } of cases) {
for (const {
backend,
belowMinVersion,
atMinVersion,
backendLabel,
requiredMinVersion,
} of cases) {
describe(`${backend} backend`, () => {
it(`refuses --set below minimum version (${belowMinVersion}) without mutating files`, async () => {
await configureBackend(backend, belowMinVersion);