mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
test: remove redundant metadata checks and strengthen runtime coverage (#33611)
* test: remove redundant metadata checks and strengthen runtime coverage * test: prune removed real-time wait allowance --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -385,7 +385,6 @@
|
||||
1 test-no-real-time-wait:src/main/runtime/workspaces/persisted-surfaces/restored-terminal-placement.test.ts
|
||||
4 test-no-real-time-wait:src/main/runtime/worktree-teardown-unstopped-pty.test.ts
|
||||
3 test-no-real-time-wait:src/main/skills/skill-bundle-process-termination.integration.test.ts
|
||||
1 test-no-real-time-wait:src/main/skills/skill-candidate-concurrency.test.ts
|
||||
1 test-no-real-time-wait:src/main/skills/skill-cloud-direct-upload.test.ts
|
||||
1 test-no-real-time-wait:src/main/skills/skill-process-contention-child.test.ts
|
||||
1 test-no-real-time-wait:src/main/skills/skill-process-contention.integration.test.ts
|
||||
|
||||
@@ -2,11 +2,16 @@ import { describe, expect, it } from 'vitest'
|
||||
import { readPromotedSettingValuesFromContent } from './config-toml-promoted-setting-values'
|
||||
|
||||
describe('readPromotedSettingValuesFromContent', () => {
|
||||
it('reads bare, dotted and table-body keys by structured path', () => {
|
||||
it('reads values and multiline flags by structured path', () => {
|
||||
const values = readPromotedSettingValuesFromContent(
|
||||
'model = "o4"\ntui.theme = "dark"\n\n[features]\ndaemon_auto_start = false\n'
|
||||
'model = "o4"\ntui.theme = "dark"\ntui.status_line = [\n "model"\n]\n\n[features]\ndaemon_auto_start = false\n'
|
||||
)
|
||||
expect([...values.keys()]).toEqual(['model', 'tui.theme', 'features.daemon_auto_start'])
|
||||
expect([...values]).toEqual([
|
||||
['model', { raw: '"o4"', multiline: false }],
|
||||
['tui.theme', { raw: '"dark"', multiline: false }],
|
||||
['tui.status_line', { raw: '[', multiline: true }],
|
||||
['features.daemon_auto_start', { raw: 'false', multiline: false }]
|
||||
])
|
||||
})
|
||||
|
||||
it('does not read a quoted key containing a dot as a table key', () => {
|
||||
|
||||
@@ -14,6 +14,10 @@ it('keeps a replacement incarnation closed when its report beats its spawn reply
|
||||
it('forgets a closed incarnation once a reply names a different live one', () => {
|
||||
const closed = new DaemonPtyInputClosedIncarnations()
|
||||
closed.record('pty', 'old')
|
||||
expect(closed.isClosed('pty', 'old')).toBe(true)
|
||||
expect(closed.isClosed('pty', undefined)).toBe(true)
|
||||
closed.sync('pty', { isNew: true, incarnationId: 'replacement' })
|
||||
expect(closed.isClosed('pty', 'replacement')).toBe(false)
|
||||
expect(closed.isClosed('pty', 'old')).toBe(false)
|
||||
expect(closed.isClosed('pty', undefined)).toBe(false)
|
||||
})
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ vi.mock('../../../shared/remote-runtime-socket-liveness', async (importOriginal)
|
||||
import { retryRemoteRuntimeSharedControlConnectionsNow } from './runtime-environment-request-connections'
|
||||
|
||||
describe('retryRemoteRuntimeSharedControlConnectionsNow', () => {
|
||||
it('probes every remote runtime socket even when no reconnect is pending', () => {
|
||||
it('requests a socket-liveness probe even when no reconnect is pending', () => {
|
||||
retryRemoteRuntimeSharedControlConnectionsNow()
|
||||
|
||||
expect(probeAllRemoteRuntimeSocketsNow).toHaveBeenCalledTimes(1)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Older clients may leave unsupported approvals actionable; gate new subject kinds by client capability.
|
||||
|
||||
import { expect, it } from 'vitest'
|
||||
import { AGENT_JOURNAL_APPROVAL_SUBJECT_KINDS } from '../../../shared/agent-session-journal-schemas'
|
||||
|
||||
const SUBJECT_KINDS_EVERY_CLIENT_DRAWS = ['plan']
|
||||
// Future capability-gated kinds belong here (STA-9262).
|
||||
const CAPABILITY_GATED_SUBJECT_KINDS: string[] = []
|
||||
|
||||
it('adds no approval subject kind without a client-capability gate', () => {
|
||||
const ungated = [...AGENT_JOURNAL_APPROVAL_SUBJECT_KINDS]
|
||||
.filter((kind) => !CAPABILITY_GATED_SUBJECT_KINDS.includes(kind))
|
||||
.sort()
|
||||
expect(
|
||||
ungated,
|
||||
'New approval subject kinds need a client-capability gate first: older clients would let ' +
|
||||
'users approve it blind. See https://linear.app/stably/issue/STA-9262'
|
||||
).toEqual(SUBJECT_KINDS_EVERY_CLIENT_DRAWS)
|
||||
})
|
||||
@@ -10,8 +10,19 @@ describe('managed server capability', () => {
|
||||
it('is advertised only where the desktop registered the managed-server actions', () => {
|
||||
registerManagedServerActions(null)
|
||||
expect(createRuntime().getStatus().capabilities).not.toContain('managedServer.v1')
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: getStatus only checks that actions are registered.
|
||||
registerManagedServerActions({} as ManagedServerActions)
|
||||
const unusedAction = async (): Promise<never> => {
|
||||
throw new Error('Capability discovery must not invoke managed-server actions')
|
||||
}
|
||||
const actions: ManagedServerActions = {
|
||||
status: unusedAction,
|
||||
update: unusedAction,
|
||||
rollback: unusedAction,
|
||||
recover: unusedAction,
|
||||
stop: unusedAction,
|
||||
cancelStop: unusedAction,
|
||||
forget: unusedAction
|
||||
}
|
||||
registerManagedServerActions(actions)
|
||||
try {
|
||||
expect(createRuntime().getStatus().capabilities).toContain('managedServer.v1')
|
||||
} finally {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { CLAUDE_STRUCTURED_AGENT } from '../claude/claude-structured-agent-definition'
|
||||
import { CODEX_STRUCTURED_AGENT } from '../codex/codex-structured-agent-definition'
|
||||
import {
|
||||
CLAUDE_STRUCTURED_HANDLE_NAMESPACE,
|
||||
CODEX_STRUCTURED_HANDLE_NAMESPACE
|
||||
} from '../../shared/agent-session-provider-handle-encoding'
|
||||
|
||||
describe('what the shipped definitions let a record store', () => {
|
||||
it('pins what every older build wrote', () => {
|
||||
expect(CLAUDE_STRUCTURED_AGENT).toMatchObject({
|
||||
handleTransport: CLAUDE_STRUCTURED_HANDLE_NAMESPACE.transport,
|
||||
accountHomeVariable: 'CLAUDE_CONFIG_DIR'
|
||||
})
|
||||
expect(CODEX_STRUCTURED_AGENT).toMatchObject({
|
||||
handleTransport: CODEX_STRUCTURED_HANDLE_NAMESPACE.transport,
|
||||
accountHomeVariable: 'CODEX_HOME'
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -3,19 +3,33 @@ import { runSkillCandidateTasks } from './skill-candidate-concurrency'
|
||||
|
||||
describe('runSkillCandidateTasks', () => {
|
||||
it('bounds concurrency and preserves task order', async () => {
|
||||
const gates = Array.from({ length: 12 }, () => Promise.withResolvers<number>())
|
||||
const fifthStarted = Promise.withResolvers<void>()
|
||||
const started: number[] = []
|
||||
let active = 0
|
||||
let maxActive = 0
|
||||
const results = await runSkillCandidateTasks(
|
||||
Array.from({ length: 12 }, (_, index) => async () => {
|
||||
const pending = runSkillCandidateTasks(
|
||||
gates.map((gate, index) => async () => {
|
||||
started.push(index)
|
||||
if (index === 4) {
|
||||
fifthStarted.resolve()
|
||||
}
|
||||
active += 1
|
||||
maxActive = Math.max(maxActive, active)
|
||||
await new Promise((resolve) => setTimeout(resolve, 12 - index))
|
||||
const result = await gate.promise
|
||||
active -= 1
|
||||
return index
|
||||
return result
|
||||
})
|
||||
)
|
||||
|
||||
expect(started).toEqual([0, 1, 2, 3])
|
||||
gates[3].resolve(3)
|
||||
await fifthStarted.promise
|
||||
expect(started).toEqual([0, 1, 2, 3, 4])
|
||||
gates.forEach((gate, index) => gate.resolve(index))
|
||||
|
||||
expect(await pending).toEqual(Array.from({ length: 12 }, (_, index) => index))
|
||||
expect(maxActive).toBe(4)
|
||||
expect(results).toEqual(Array.from({ length: 12 }, (_, index) => index))
|
||||
expect(active).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,12 +2,24 @@ import { describe, expect, it } from 'vitest'
|
||||
import { resampleToRate } from './stt-audio-resample'
|
||||
|
||||
describe('resampleToRate', () => {
|
||||
it('normalizes changing capture rates before audio enters the native recognizer', () => {
|
||||
const first = resampleToRate(new Float32Array(480), 48000, 16000)
|
||||
const second = resampleToRate(new Float32Array(441), 44100, 16000)
|
||||
it('resamples changing capture rates onto the same 16 kHz timeline', () => {
|
||||
const first = resampleToRate(
|
||||
Float32Array.from({ length: 480 }, (_, index) => index / 480),
|
||||
48000,
|
||||
16000
|
||||
)
|
||||
const second = resampleToRate(
|
||||
Float32Array.from({ length: 441 }, (_, index) => index / 441),
|
||||
44100,
|
||||
16000
|
||||
)
|
||||
|
||||
expect(first).toHaveLength(160)
|
||||
expect(second).toHaveLength(160)
|
||||
expect(first[1]).toBeCloseTo(0.00625, 6)
|
||||
expect(first[80]).toBeCloseTo(0.5, 6)
|
||||
expect(second[1]).toBeCloseTo(0.00625, 6)
|
||||
expect(second[80]).toBeCloseTo(0.5, 6)
|
||||
})
|
||||
|
||||
it('keeps same-rate chunks unchanged', () => {
|
||||
|
||||
Reference in New Issue
Block a user