mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-20 05:11:48 +00:00
fix(cliproxy): harden composite variant routing and validation
This commit is contained in:
1 parent
e914fe9778
commit
0a8adb22fc
4 files changed
+115
-33
No files matched your search
@@ -435,4 +435,45 @@ cliproxy:
|
||||
expect(variants.test).toBeDefined();
|
||||
expect(variants.test.hasFallback).toBe(false);
|
||||
});
|
||||
|
||||
it('should skip malformed composite variant and keep valid variants', () => {
|
||||
const configPath = path.join(tmpDir, 'config.yaml');
|
||||
const yamlContent = `version: 2
|
||||
accounts: {}
|
||||
profiles: {}
|
||||
preferences:
|
||||
theme: system
|
||||
telemetry: false
|
||||
auto_update: true
|
||||
cliproxy:
|
||||
oauth_accounts: {}
|
||||
providers:
|
||||
- gemini
|
||||
- codex
|
||||
- agy
|
||||
variants:
|
||||
bad:
|
||||
type: composite
|
||||
default_tier: sonnet
|
||||
tiers:
|
||||
opus:
|
||||
provider: agy
|
||||
model: claude-opus-4-6-thinking
|
||||
sonnet:
|
||||
provider: agy
|
||||
model: claude-sonnet-4-5-thinking
|
||||
settings: cliproxy/bad.settings.json
|
||||
port: 8318
|
||||
good:
|
||||
provider: gemini
|
||||
settings: cliproxy/good.settings.json
|
||||
port: 8319
|
||||
`;
|
||||
fs.writeFileSync(configPath, yamlContent, 'utf-8');
|
||||
|
||||
const variants = listVariantsFromConfig();
|
||||
expect(variants.bad).toBeUndefined();
|
||||
expect(variants.good).toBeDefined();
|
||||
expect(variants.good.provider).toBe('gemini');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user