diff --git a/config/scripts/rich-markdown-comment-scan-benchmark.mjs b/config/scripts/rich-markdown-comment-scan-benchmark.mjs index 29c52e4b761..873cee842df 100644 --- a/config/scripts/rich-markdown-comment-scan-benchmark.mjs +++ b/config/scripts/rich-markdown-comment-scan-benchmark.mjs @@ -25,7 +25,10 @@ async function load(contents) { })) bundler.onLoad({ filter: /.*/, namespace: 'bench' }, (args) => ({ contents: args.path.endsWith('markdown-round-trip') - ? 'export const getRichMarkdownRoundTripOutput = (content) => content' + ? `export const getRichMarkdownRoundTripOutput = (content) => content + export const getRichMarkdownPassthroughOutput = () => { + throw new Error("unexpected editor passthrough") + }` : 'export const translate = (_key, fallback) => fallback', loader: 'js' })) diff --git a/config/scripts/rich-markdown-line-scan-benchmark.mjs b/config/scripts/rich-markdown-line-scan-benchmark.mjs index a480c5f54d7..286166b7b52 100644 --- a/config/scripts/rich-markdown-line-scan-benchmark.mjs +++ b/config/scripts/rich-markdown-line-scan-benchmark.mjs @@ -25,7 +25,10 @@ async function load(contents) { })) bundler.onLoad({ filter: /.*/, namespace: 'bench' }, (args) => ({ contents: args.path.endsWith('markdown-round-trip') - ? 'export const getRichMarkdownRoundTripOutput = () => { throw new Error("unexpected editor round trip") }' + ? `export const getRichMarkdownRoundTripOutput = () => { throw new Error("unexpected editor round trip") } + export const getRichMarkdownPassthroughOutput = () => { + throw new Error("unexpected editor passthrough") + }` : 'export const translate = (_key, fallback) => fallback', loader: 'js' })) diff --git a/mobile/src/transport/mobile-relay-pairing-reply.test.ts b/mobile/src/transport/mobile-relay-pairing-reply.test.ts index abdbfff2226..fe366f44aeb 100644 --- a/mobile/src/transport/mobile-relay-pairing-reply.test.ts +++ b/mobile/src/transport/mobile-relay-pairing-reply.test.ts @@ -11,7 +11,7 @@ import type { RpcResponse } from './types' // changed only where the refusal is raised. function success(result: unknown): RpcResponse { - return { ok: true, result } + return { id: 'reply-1', ok: true, result } } const installed = { @@ -62,7 +62,11 @@ describe('the endpoints reader is the endpoints contract', () => { }) it('still raises the host code and message on a refusal, ahead of the reader', () => { - const refusal: RpcResponse = { ok: false, error: { code: 'forbidden', message: 'no' } } + const refusal: RpcResponse = { + id: 'reply-1', + ok: false, + error: { code: 'forbidden', message: 'no' } + } expect(() => relayPairingEndpointsRead.interpret(refusal)).toThrow('forbidden: no') }) }) diff --git a/mobile/src/transport/mobile-web-bundle-range-decode.test.ts b/mobile/src/transport/mobile-web-bundle-range-decode.test.ts index 59680a265e0..28a5047a1eb 100644 --- a/mobile/src/transport/mobile-web-bundle-range-decode.test.ts +++ b/mobile/src/transport/mobile-web-bundle-range-decode.test.ts @@ -78,7 +78,9 @@ describe('decoding a bundle range', () => { vector.outputLimit - 1 ) ).toString('hex') - } catch { + } catch (error) { + expect(error, vector.name).toBeInstanceOf(MobileWebBundleFetchError) + expect(error, vector.name).toMatchObject({ refusal: 'range-undecodable' }) actual = null } expect(actual, vector.name).toBe(vector.js) diff --git a/mobile/src/transport/mobile-web-page-version-floor.test.ts b/mobile/src/transport/mobile-web-page-version-floor.test.ts index 284e136e7cc..3a8bd8b14e1 100644 --- a/mobile/src/transport/mobile-web-page-version-floor.test.ts +++ b/mobile/src/transport/mobile-web-page-version-floor.test.ts @@ -1,9 +1,46 @@ import { describe, expect, it } from 'vitest' -import { MOBILE_WEB_PAGE_VERSION } from '../../../src/shared/mobile-web-bundle/manifest-contract' -import { MOBILE_WEB_PAGE_VERSION_FLOOR } from './mobile-web-bundle-compat' +import { + MOBILE_WEB_BUNDLE_SCHEMA_VERSION, + MOBILE_WEB_PAGE_VERSION +} from '../../../src/shared/mobile-web-bundle/manifest-contract' +import { MOBILE_WEB_BUNDLE_CAPABILITY } from '../../../src/shared/mobile-web-bundle/mobile-web-bundle-capability' +import { + MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION, + MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, + RUNTIME_PROTOCOL_VERSION +} from '../../../src/shared/protocol-version' +import { + evaluateMobileWebBundleCompat, + MOBILE_WEB_PAGE_VERSION_FLOOR +} from './mobile-web-bundle-compat' describe("the shell's page floor", () => { - it('never requires a page newer than the one built beside this shell', () => { - expect(MOBILE_WEB_PAGE_VERSION_FLOOR).toBeLessThanOrEqual(MOBILE_WEB_PAGE_VERSION) + it('accepts the page built beside this shell and refuses a page below its floor', () => { + const input = { + hostCapabilities: [MOBILE_WEB_BUNDLE_CAPABILITY], + hostStatus: { + protocolVersion: RUNTIME_PROTOCOL_VERSION, + minCompatibleMobileVersion: MIN_COMPATIBLE_RUNTIME_CLIENT_VERSION + }, + manifest: { + schemaVersion: MOBILE_WEB_BUNDLE_SCHEMA_VERSION, + runtimeProtocolVersion: RUNTIME_PROTOCOL_VERSION, + minCompatibleRuntimeProtocolVersion: MIN_COMPATIBLE_RUNTIME_SERVER_VERSION, + pageVersion: MOBILE_WEB_PAGE_VERSION + } + } + expect(evaluateMobileWebBundleCompat(input)).toEqual({ kind: 'ok', manifestChecked: true }) + expect( + evaluateMobileWebBundleCompat({ + ...input, + manifest: { ...input.manifest, pageVersion: MOBILE_WEB_PAGE_VERSION_FLOOR - 1 } + }) + ).toEqual({ + kind: 'blocked', + reason: 'bundle-incompatible', + side: 'desktop', + pageVersion: MOBILE_WEB_PAGE_VERSION_FLOOR - 1, + requiredPageVersion: MOBILE_WEB_PAGE_VERSION_FLOOR + }) }) }) diff --git a/mobile/tests-typecheck-baseline.txt b/mobile/tests-typecheck-baseline.txt index 2904150e0f8..093b76ffb8a 100644 --- a/mobile/tests-typecheck-baseline.txt +++ b/mobile/tests-typecheck-baseline.txt @@ -94,7 +94,6 @@ src/transport/mobile-relay-background-lifecycle.test.ts src/transport/mobile-relay-direct-upgrade.test.ts src/transport/mobile-relay-e2ee-link.test.ts src/transport/mobile-relay-pairing-recovery.test.ts -src/transport/mobile-relay-pairing-reply.test.ts src/transport/mobile-relay-physical-client.test.ts src/transport/mobile-relay-reconnect-controller.test.ts src/transport/mobile-relay-resume-director.test.ts diff --git a/src/renderer/src/lib/agent-skill-cli-prerequisite.test.ts b/src/renderer/src/lib/agent-skill-cli-prerequisite.test.ts index ea948d6e8c7..856cb058cfa 100644 --- a/src/renderer/src/lib/agent-skill-cli-prerequisite.test.ts +++ b/src/renderer/src/lib/agent-skill-cli-prerequisite.test.ts @@ -123,14 +123,16 @@ describe('ensureOrcaCliAvailableForAgentSkillTerminal', () => { }) const pending = ensureOrcaCliAvailableForAgentSkillTerminal({ registrationPromptDelayMs: 700 }) - await vi.waitFor(() => { - expect(toast.message).toHaveBeenCalledWith(CLI_PREREQUISITE_REGISTRATION_TOAST, { - description: CLI_PREREQUISITE_REGISTRATION_TOAST_DESCRIPTION - }) + await Promise.resolve() + expect(toast.message).toHaveBeenCalledWith(CLI_PREREQUISITE_REGISTRATION_TOAST, { + description: CLI_PREREQUISITE_REGISTRATION_TOAST_DESCRIPTION }) expect(install).not.toHaveBeenCalled() - await vi.advanceTimersByTimeAsync(700) + await vi.advanceTimersByTimeAsync(699) + expect(install).not.toHaveBeenCalled() + + await vi.advanceTimersByTimeAsync(1) await expect(pending).resolves.toBe(installed) expect(install).toHaveBeenCalledTimes(1) }) diff --git a/src/renderer/src/lib/agent-verdict-status-line.test.ts b/src/renderer/src/lib/agent-verdict-status-line.test.ts index 74aa1ebba74..c402603e38d 100644 --- a/src/renderer/src/lib/agent-verdict-status-line.test.ts +++ b/src/renderer/src/lib/agent-verdict-status-line.test.ts @@ -13,7 +13,7 @@ describe('agentVerdictStatusLine', () => { ...FAILED, agentType: 'rsync', lastAssistantMessage: 'rsync failed', - programStatus: { state: 'error', message: 'rsync failed', observedAt: 1 } + programStatus: { state: 'error', message: 'Transfer interrupted', observedAt: 1 } }) ).toBe('Failed: rsync failed') })