Make the #1320 model-grouping tests actually teethy

A test-efficacy (mutation) check found the #1320 grouping tests were
vacuous: they used opaque ids like 'llama3-8b' that getProviderFromModelId
defaults to 'ollama' anyway, so they passed even without the provider-field
fix. Switched to ids the heuristic MIS-detects ('gpt-oss-20b' -> openai,
'my-claude-clone' -> anthropic) with provider='ollama', so the tests now
fail without the fix and pass with it — verified by reverse-applying the
fix and confirming failure.
This commit is contained in:
rcourtman 2026-06-04 12:04:19 +01:00
parent efb6976069
commit a73a24259c
2 changed files with 15 additions and 9 deletions

View file

@ -49,14 +49,19 @@ describe('aiChatUtils', () => {
it('prefers the server-supplied provider over the id heuristic (#1320)', () => {
const models: ModelInfo[] = [
// Opaque ids that the id heuristic cannot attribute, but with provider set.
{ id: 'llama3-8b', name: 'Llama 3 8B', provider: 'ollama' },
{ id: 'qwen3.5-27b', name: 'Qwen', provider: 'ollama' },
// The id heuristic would MIS-detect these (gpt -> openai, claude ->
// anthropic); the server-supplied provider must win.
{ id: 'gpt-oss-20b', name: 'GPT-OSS 20B', provider: 'ollama' },
{ id: 'my-claude-clone', name: 'Clone', provider: 'ollama' },
];
const grouped = utils.groupModelsByProvider(models);
expect(grouped.get('ollama')?.length).toBe(2);
expect(grouped.has('llama3-8b')).toBe(false);
expect(grouped.get('ollama')?.map((m) => m.id).sort()).toEqual([
'gpt-oss-20b',
'my-claude-clone',
]);
expect(grouped.has('openai')).toBe(false);
expect(grouped.has('anthropic')).toBe(false);
});
});

View file

@ -250,14 +250,15 @@ describe('patrolFormat', () => {
it('prefers the server-supplied provider over the id prefix (#1320)', () => {
const models = [
// Opaque id (no recognizable provider prefix) but an explicit provider.
{ id: 'llama3-8b', name: 'Llama 3 8B', provider: 'ollama' },
{ id: 'qwen3.5-27b', name: 'Qwen', provider: 'ollama' },
// The id prefix/heuristic would mis-group these; provider must win.
{ id: 'gpt-oss-20b', name: 'GPT-OSS 20B', provider: 'ollama' },
{ id: 'my-claude-clone', name: 'Clone', provider: 'ollama' },
];
const groups = groupModelsByProvider(models);
expect(groups.get('ollama')).toHaveLength(2);
expect(groups.has('llama3-8b')).toBe(false);
expect(groups.has('gpt-oss-20b')).toBe(false);
expect(groups.has('my-claude-clone')).toBe(false);
});
});
});