mirror of
https://github.com/stablyai/orca.git
synced 2026-10-08 08:02:32 +00:00
* Improve mobile terminal streaming performance Co-authored-by: Orca <help@stably.ai> * Add mobile clear terminal action Co-authored-by: Orca <help@stably.ai> * Fix terminal connection test mock Co-authored-by: Orca <help@stably.ai> * WIP: mobile markdown tabs before rebase Co-authored-by: Orca <help@stably.ai> * Add mobile markdown editing Co-authored-by: Orca <help@stably.ai> * Harden mobile tab and markdown sync Co-authored-by: Orca <help@stably.ai> * Fix mobile terminal reconnect loading race Co-authored-by: Orca <help@stably.ai> * Polish mobile terminal keyboard behavior Co-authored-by: Orca <help@stably.ai> * Simplify mobile markdown editor chrome Co-authored-by: Orca <help@stably.ai> * Move mobile markdown actions to top Co-authored-by: Orca <help@stably.ai> * Use app modals for markdown discard Co-authored-by: Orca <help@stably.ai> * Dismiss keyboard before markdown confirmations Co-authored-by: Orca <help@stably.ai> * Add mobile file explorer Co-authored-by: Orca <help@stably.ai> * Fix mobile file explorer type narrowing Co-authored-by: Orca <help@stably.ai> * Fix mobile files navigation param Co-authored-by: Orca <help@stably.ai> * Show mobile files connection wait state Co-authored-by: Orca <help@stably.ai> * Preview text files on mobile Co-authored-by: Orca <help@stably.ai> * Simplify mobile file previews Co-authored-by: Orca <help@stably.ai> * Clarify unavailable mobile file types Co-authored-by: Orca <help@stably.ai> * Fix mobile subscription and preview review issues Co-authored-by: Orca <help@stably.ai> * Keep fallback terminals visible on mobile Co-authored-by: Orca <help@stably.ai> * Keep mobile terminal tap active Co-authored-by: Orca <help@stably.ai> * Preserve mobile terminal fallback order Co-authored-by: Orca <help@stably.ai> * Fix mobile session tab authority Co-authored-by: Orca <help@stably.ai> * Run mobile tests in mobile CI lane Co-authored-by: Orca <help@stably.ai> * Bump mobile app version to 0.0.7 Co-authored-by: Orca <help@stably.ai> * Allow main window IPC wiring size Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
125 lines
4.0 KiB
TypeScript
125 lines
4.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { evaluateCompat } from './protocol-compat'
|
|
import { DESKTOP_PROTOCOL_VERSION, MIN_COMPATIBLE_MOBILE_VERSION } from './protocol-version'
|
|
|
|
const MOBILE_V = 1
|
|
|
|
describe('evaluateCompat', () => {
|
|
it('returns ok when both desktop fields are undefined and constants are wide-open', () => {
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 0,
|
|
desktopProtocolVersion: undefined,
|
|
desktopMinCompatibleMobileVersion: undefined
|
|
})
|
|
expect(verdict).toEqual({ kind: 'ok' })
|
|
})
|
|
|
|
it('returns ok when desktop reports version equal to mobile', () => {
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 0,
|
|
desktopProtocolVersion: MOBILE_V,
|
|
desktopMinCompatibleMobileVersion: 0
|
|
})
|
|
expect(verdict).toEqual({ kind: 'ok' })
|
|
})
|
|
|
|
it('returns ok when desktop reports a newer version (additive changes assumed safe)', () => {
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 0,
|
|
desktopProtocolVersion: MOBILE_V + 5,
|
|
desktopMinCompatibleMobileVersion: 0
|
|
})
|
|
expect(verdict).toEqual({ kind: 'ok' })
|
|
})
|
|
|
|
it('blocks with mobile-too-old when desktop requires a newer mobile', () => {
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 0,
|
|
desktopProtocolVersion: 5,
|
|
desktopMinCompatibleMobileVersion: MOBILE_V + 1
|
|
})
|
|
expect(verdict).toEqual({
|
|
kind: 'blocked',
|
|
reason: 'mobile-too-old',
|
|
desktopVersion: 5,
|
|
requiredMobileVersion: MOBILE_V + 1
|
|
})
|
|
})
|
|
|
|
it('coerces undefined desktopVersion to 0 in the verdict payload', () => {
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 0,
|
|
desktopProtocolVersion: undefined,
|
|
desktopMinCompatibleMobileVersion: MOBILE_V + 1
|
|
})
|
|
expect(verdict).toMatchObject({
|
|
kind: 'blocked',
|
|
reason: 'mobile-too-old',
|
|
desktopVersion: 0
|
|
})
|
|
})
|
|
|
|
it('blocks with desktop-too-old when desktop reports below the local minimum', () => {
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 5,
|
|
desktopProtocolVersion: 3,
|
|
desktopMinCompatibleMobileVersion: 0
|
|
})
|
|
expect(verdict).toEqual({
|
|
kind: 'blocked',
|
|
reason: 'desktop-too-old',
|
|
desktopVersion: 3,
|
|
requiredDesktopVersion: 5
|
|
})
|
|
})
|
|
|
|
it('mobile-too-old wins precedence when both constraints would fire', () => {
|
|
// Why: documents the intended kill-switch precedence — desktop's
|
|
// refusal of a too-old mobile takes priority over mobile's local
|
|
// refusal of a too-old desktop.
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 99,
|
|
desktopProtocolVersion: -1,
|
|
desktopMinCompatibleMobileVersion: MOBILE_V + 1
|
|
})
|
|
expect(verdict.kind).toBe('blocked')
|
|
expect((verdict as { reason: string }).reason).toBe('mobile-too-old')
|
|
})
|
|
|
|
it('with minCompatibleDesktopVersion = 0 every reported desktop passes', () => {
|
|
for (const v of [0, 1, 2, 99]) {
|
|
expect(
|
|
evaluateCompat({
|
|
mobileProtocolVersion: MOBILE_V,
|
|
minCompatibleDesktopVersion: 0,
|
|
desktopProtocolVersion: v,
|
|
desktopMinCompatibleMobileVersion: 0
|
|
})
|
|
).toEqual({ kind: 'ok' })
|
|
}
|
|
})
|
|
|
|
it('hard-blocks protocol-1 mobile for the binary terminal stream cutover', () => {
|
|
const verdict = evaluateCompat({
|
|
mobileProtocolVersion: 1,
|
|
minCompatibleDesktopVersion: DESKTOP_PROTOCOL_VERSION,
|
|
desktopProtocolVersion: DESKTOP_PROTOCOL_VERSION,
|
|
desktopMinCompatibleMobileVersion: MIN_COMPATIBLE_MOBILE_VERSION
|
|
})
|
|
|
|
expect(verdict).toEqual({
|
|
kind: 'blocked',
|
|
reason: 'mobile-too-old',
|
|
desktopVersion: DESKTOP_PROTOCOL_VERSION,
|
|
requiredMobileVersion: MIN_COMPATIBLE_MOBILE_VERSION
|
|
})
|
|
})
|
|
})
|