diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index 3dd335a9d08..a85534aa961 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -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 diff --git a/src/main/codex/config-toml-promoted-setting-values.test.ts b/src/main/codex/config-toml-promoted-setting-values.test.ts index b125240da85..c057917bf37 100644 --- a/src/main/codex/config-toml-promoted-setting-values.test.ts +++ b/src/main/codex/config-toml-promoted-setting-values.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', () => { diff --git a/src/main/daemon/daemon-pty-input-closed-incarnations.test.ts b/src/main/daemon/daemon-pty-input-closed-incarnations.test.ts index 268648eeda2..d4f00f00e03 100644 --- a/src/main/daemon/daemon-pty-input-closed-incarnations.test.ts +++ b/src/main/daemon/daemon-pty-input-closed-incarnations.test.ts @@ -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) }) diff --git a/src/main/ipc/runtime-environments/runtime-environment-retry-connections-probe.test.ts b/src/main/ipc/runtime-environments/runtime-environment-retry-connections-probe.test.ts index eb4f78ad216..10c77cea9ab 100644 --- a/src/main/ipc/runtime-environments/runtime-environment-retry-connections-probe.test.ts +++ b/src/main/ipc/runtime-environments/runtime-environment-retry-connections-probe.test.ts @@ -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) diff --git a/src/main/native-chat/agent-session-journal/journal-approval-subject-kinds.test.ts b/src/main/native-chat/agent-session-journal/journal-approval-subject-kinds.test.ts deleted file mode 100644 index a0135bfe296..00000000000 --- a/src/main/native-chat/agent-session-journal/journal-approval-subject-kinds.test.ts +++ /dev/null @@ -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) -}) diff --git a/src/main/runtime/orca-runtime-tests/managed-server-capability.spec.ts b/src/main/runtime/orca-runtime-tests/managed-server-capability.spec.ts index 89c63cee9be..ccccf518ea4 100644 --- a/src/main/runtime/orca-runtime-tests/managed-server-capability.spec.ts +++ b/src/main/runtime/orca-runtime-tests/managed-server-capability.spec.ts @@ -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 => { + 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 { diff --git a/src/main/runtime/structured-agent-stored-definitions.test.ts b/src/main/runtime/structured-agent-stored-definitions.test.ts deleted file mode 100644 index 9640907cead..00000000000 --- a/src/main/runtime/structured-agent-stored-definitions.test.ts +++ /dev/null @@ -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' - }) - }) -}) diff --git a/src/main/skills/skill-candidate-concurrency.test.ts b/src/main/skills/skill-candidate-concurrency.test.ts index c3fd515a4fa..2ebffa58466 100644 --- a/src/main/skills/skill-candidate-concurrency.test.ts +++ b/src/main/skills/skill-candidate-concurrency.test.ts @@ -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()) + const fifthStarted = Promise.withResolvers() + 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) }) }) diff --git a/src/main/speech/stt-worker.test.ts b/src/main/speech/stt-worker.test.ts index 8ea3ee4bdf8..588ab88be72 100644 --- a/src/main/speech/stt-worker.test.ts +++ b/src/main/speech/stt-worker.test.ts @@ -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', () => {