mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
Remove low-value voice, speech, and relay tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Later run-all.ts checks against the same host: rebind, orphan grace, silence,
|
||||
// forced resets and pre-upgrade refusals.
|
||||
// forced resets.
|
||||
import WebSocket from 'ws'
|
||||
import { GRACE_MS, ORIGIN, PING_MS, PORT, SILENCE_MS, makeControl, openPhone, record, sleep, waitFor, type Ctx, type Control } from './run-all-harness'
|
||||
|
||||
@@ -89,12 +89,4 @@ export async function runLifecycleChecks(ctx: Ctx, main: Control, mainAck: Ack):
|
||||
back.client.closeNow()
|
||||
}
|
||||
|
||||
// Bad JWT -> 401 before upgrade; malformed host id -> 429.
|
||||
{
|
||||
const bad = new WebSocket(`ws://127.0.0.1:${PORT}/v1/host/control`, { headers: { authorization: 'Bearer nope' } })
|
||||
const status = await new Promise<number>((res) => bad.on('unexpected-response', (_q, r) => res(r.statusCode ?? 0)))
|
||||
const badHost = new WebSocket(`ws://127.0.0.1:${PORT}/v1/connect/short`)
|
||||
const s2 = await new Promise<number>((res) => badHost.on('unexpected-response', (_q, r) => res(r.statusCode ?? 0)))
|
||||
record('R11/R5 ES256 JWKS rejects bad token (401); malformed host id 429', status === 401 && s2 === 429, `${status},${s2}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,11 +100,6 @@ async function runTests(ctx: Ctx): Promise<void> {
|
||||
const mainAck = await main.client.connect()
|
||||
const transport = main.bindTransport(mainAck.generation)
|
||||
|
||||
// Alarm-driven app ping, answered by the shipped client's pong handler.
|
||||
await sleep(PING_MS * 3 + 300)
|
||||
record('R2/R5 alarm-driven JSON ping parsed by shipped client, pong keeps control alive',
|
||||
main.events.pings >= 2 && main.client.isLive(), `pings=${main.events.pings} live=${main.client.isLive()}`)
|
||||
|
||||
// Phone connect -> conn-open (strict, shipped parser) -> host data -> relay-hello (shipped parser).
|
||||
const phone = openPhone(ctx)
|
||||
const helloOk = await waitFor(() => phone.hello !== null, 5000)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5527,7 +5527,6 @@
|
||||
"src/renderer/src/components/settings/developer-permissions/TerminalTccAttributionNotice.test.tsx": 401,
|
||||
"src/renderer/src/components/settings/voice/VoiceMicrophoneSetting.test.tsx": 957,
|
||||
"src/renderer/src/components/settings/voice/VoicePane.test.tsx": 1042,
|
||||
"src/renderer/src/components/settings/voice/VoiceSpeechModelSection.test.tsx": 503,
|
||||
"src/renderer/src/components/settings/accounts/sign-in/account-add-cancel-target.test.ts": 217,
|
||||
"src/renderer/src/components/settings/accounts/usage/accounts-pane-opencode-credentials.test.ts": 519,
|
||||
"src/renderer/src/lib/agent-session/launch/agent-settings-update-queue.test.ts": 249,
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
// @vitest-environment happy-dom
|
||||
import { act } from 'react'
|
||||
import { createRoot, type Root } from 'react-dom/client'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { SpeechModelManifest, SpeechModelState } from '../../../../../shared/speech-types'
|
||||
import { getDefaultVoiceSettings } from '../../../../../shared/constants'
|
||||
|
||||
const toastErrorMock = vi.hoisted(() => vi.fn())
|
||||
|
||||
vi.mock('sonner', () => ({
|
||||
toast: {
|
||||
error: toastErrorMock
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@/i18n/i18n', () => ({
|
||||
getIntlLocale: () => 'en',
|
||||
translate: (_key: string, fallback: string, values?: Record<string, string>) =>
|
||||
values ? fallback.replace('{{value0}}', values.value0) : fallback
|
||||
}))
|
||||
|
||||
import { VoiceSpeechModelSection } from './VoiceSpeechModelSection'
|
||||
|
||||
const localModel: SpeechModelManifest = {
|
||||
id: 'model-a',
|
||||
label: 'Local Model',
|
||||
provider: 'local',
|
||||
language: 'en',
|
||||
languages: ['en'],
|
||||
type: 'transducer',
|
||||
streaming: true,
|
||||
sampleRate: 16000,
|
||||
sizeBytes: 123_000_000,
|
||||
files: ['encoder.onnx']
|
||||
}
|
||||
|
||||
const secondLocalModel: SpeechModelManifest = {
|
||||
...localModel,
|
||||
id: 'model-b',
|
||||
label: 'Second Local Model'
|
||||
}
|
||||
|
||||
function renderSection(args: {
|
||||
deleteModel: (modelId: string) => Promise<void>
|
||||
downloadModel?: (modelId: string) => Promise<void>
|
||||
catalog?: SpeechModelManifest[]
|
||||
modelStates?: SpeechModelState[]
|
||||
refreshModelStates?: () => void
|
||||
}): { container: HTMLDivElement; root: Root } {
|
||||
Object.assign(window, {
|
||||
api: {
|
||||
speech: {
|
||||
deleteModel: vi.fn(args.deleteModel),
|
||||
downloadModel: vi.fn(args.downloadModel ?? (() => Promise.resolve()))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const container = document.createElement('div')
|
||||
document.body.appendChild(container)
|
||||
const root = createRoot(container)
|
||||
const voiceSettings = { ...getDefaultVoiceSettings(), enabled: true, sttModel: localModel.id }
|
||||
const catalog = args.catalog ?? [localModel]
|
||||
const modelStates = args.modelStates ?? [{ id: localModel.id, status: 'ready' }]
|
||||
act(() => {
|
||||
root.render(
|
||||
<VoiceSpeechModelSection
|
||||
voiceSettings={voiceSettings}
|
||||
catalog={catalog}
|
||||
modelStates={modelStates}
|
||||
onUpdateVoiceSettings={vi.fn()}
|
||||
ratingLanguage="en"
|
||||
onOpenCloudSetup={vi.fn()}
|
||||
onRefreshModelStates={args.refreshModelStates ?? vi.fn()}
|
||||
cloudSettings={null}
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
||||
return { container, root }
|
||||
}
|
||||
|
||||
describe('VoiceSpeechModelSection', () => {
|
||||
beforeEach(() => {
|
||||
toastErrorMock.mockReset()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = ''
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
it('keeps another row delete disabled until its own request finishes', async () => {
|
||||
const deleteResolvers = new Map<string, () => void>()
|
||||
const refreshModelStates = vi.fn()
|
||||
const { container, root } = renderSection({
|
||||
refreshModelStates,
|
||||
catalog: [localModel, secondLocalModel],
|
||||
modelStates: [
|
||||
{ id: localModel.id, status: 'ready' },
|
||||
{ id: secondLocalModel.id, status: 'ready' }
|
||||
],
|
||||
deleteModel: (modelId) =>
|
||||
new Promise<void>((resolve) => {
|
||||
deleteResolvers.set(modelId, resolve)
|
||||
})
|
||||
})
|
||||
const firstDeleteButton = container.querySelector<HTMLButtonElement>(
|
||||
'button[aria-label="Delete Local Model"]'
|
||||
)
|
||||
const secondDeleteButton = container.querySelector<HTMLButtonElement>(
|
||||
'button[aria-label="Delete Second Local Model"]'
|
||||
)
|
||||
|
||||
await act(async () => {
|
||||
firstDeleteButton!.dispatchEvent(new MouseEvent('click', { bubbles: true }))
|
||||
})
|
||||
await act(async () => {
|
||||
secondDeleteButton!.dispatchEvent(new MouseEvent('click', { bubbles: true }))
|
||||
})
|
||||
|
||||
expect(firstDeleteButton!.disabled).toBe(true)
|
||||
expect(secondDeleteButton!.disabled).toBe(true)
|
||||
|
||||
await act(async () => {
|
||||
deleteResolvers.get(localModel.id)!()
|
||||
await Promise.resolve()
|
||||
})
|
||||
|
||||
expect(firstDeleteButton!.disabled).toBe(false)
|
||||
expect(secondDeleteButton!.disabled).toBe(true)
|
||||
|
||||
await act(async () => {
|
||||
deleteResolvers.get(secondLocalModel.id)!()
|
||||
await Promise.resolve()
|
||||
})
|
||||
|
||||
expect(refreshModelStates).toHaveBeenCalledTimes(2)
|
||||
root.unmount()
|
||||
})
|
||||
})
|
||||
@@ -1,41 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { speechModelQuality, speechModelRatingLanguage } from './speech-model-quality'
|
||||
import type { SpeechModelErrorRate } from './speech-types'
|
||||
|
||||
const rate = (language: string, percent: number): SpeechModelErrorRate => ({
|
||||
language,
|
||||
percent,
|
||||
metric: 'wer',
|
||||
test: 'fleurs',
|
||||
clips: 5,
|
||||
measuredOn: '2026-11-09'
|
||||
})
|
||||
|
||||
describe('speechModelQuality', () => {
|
||||
it('rates by the approved word scale, inclusive at each ceiling', () => {
|
||||
const tiers = [3, 3.1, 6, 10, 20, 20.1].map((percent) => {
|
||||
const quality = speechModelQuality(
|
||||
{ languages: ['de'], errorRates: [rate('de', percent)] },
|
||||
'de'
|
||||
)
|
||||
return quality.kind === 'rated' ? quality.tier : quality.kind
|
||||
})
|
||||
expect(tiers).toEqual([5, 4, 4, 3, 2, 1])
|
||||
})
|
||||
|
||||
it('tells an unsupported language from a supported one nobody measured', () => {
|
||||
const model = { languages: ['en', 'fr'], errorRates: [rate('en', 4)] }
|
||||
expect(speechModelQuality(model, 'ko').kind).toBe('unsupported')
|
||||
expect(speechModelQuality(model, 'fr').kind).toBe('unmeasured')
|
||||
})
|
||||
})
|
||||
|
||||
describe('speechModelRatingLanguage', () => {
|
||||
it('uses the dictation language, else the system locale’s language', () => {
|
||||
expect(speechModelRatingLanguage('de', 'ja-JP')).toBe('de')
|
||||
expect(speechModelRatingLanguage('auto', 'zh-Hant-TW')).toBe('zh')
|
||||
expect(speechModelRatingLanguage('auto', 'pt_BR')).toBe('pt')
|
||||
expect(speechModelRatingLanguage('auto', 'nb-NO')).toBe('no')
|
||||
expect(speechModelRatingLanguage('auto', undefined)).toBeUndefined()
|
||||
})
|
||||
})
|
||||
@@ -35,24 +35,6 @@ const catalog = [
|
||||
]
|
||||
|
||||
describe('suggestSpeechModel', () => {
|
||||
it('on a fast GPU, picks the most accurate measured model', () => {
|
||||
const pick = (language: string) =>
|
||||
suggestSpeechModel(catalog, language, { favorAccuracy: true })?.id
|
||||
expect(pick('ko')).toBe('turbo')
|
||||
expect(pick('fr')).toBe('turbo')
|
||||
expect(pick('cy')).toBe('turbo')
|
||||
expect(pick('xx')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('elsewhere follows the fast rule: named model, the default, then the best measured', () => {
|
||||
const pick = (language: string) =>
|
||||
suggestSpeechModel(catalog, language, { favorAccuracy: false })?.id
|
||||
expect(pick('ko')).toBe('sense')
|
||||
expect(pick('fr')).toBe('parakeet')
|
||||
expect(pick('tr')).toBe('turbo')
|
||||
expect(pick('xx')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('keeps the user’s own pick while it is offered', () => {
|
||||
const pick = (selectedModelId: string) =>
|
||||
suggestSpeechModel(catalog, 'tr', { selectedModelId, favorAccuracy: false })?.id
|
||||
|
||||
Reference in New Issue
Block a user