Files
orca/tests/e2e/helpers/remote-terminal-source-range-contract-fixture.unit.test.ts
mirror 34fa2cd5ca
Skill update round trip / roundtrip (false, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, latest) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
source snapshot 2026-09-02
2026-09-02 02:03:16 +08:00

48 lines
1.7 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import type { TerminalOutputSourceRange } from '../../../src/shared/terminal-output-source-range'
import {
createRemoteTerminalSourceRangeContractFixture,
type RemoteTerminalContractTopology
} from './remote-terminal-source-range-contract-fixture'
function sourceRange(): TerminalOutputSourceRange {
return {
id: 'pty-1',
spanId: 'span-1',
providerGeneration: 8,
clientGeneration: 5,
ownerGeneration: 3,
ptyIncarnation: 'incarnation-1',
deliveryToken: 'token-1',
sourceStartSu: 0,
sourceEndSu: 4,
displayStart: 0,
displayEnd: 4,
splittable: true,
transform: { transformed: false, rawLengthSu: 4, scalarSafe: true }
}
}
describe.each<RemoteTerminalContractTopology>(['headed-desktop-server', 'headless-serve'])(
'%s remote terminal source-range contract',
(topology) => {
it('keeps host identity and rejects a stale client generation after reconnect', () => {
const fixture = createRemoteTerminalSourceRangeContractFixture(topology)
const oldGeneration = fixture.connect()
fixture.accept(4, [sourceRange()])
fixture.detach()
const generation = fixture.connect()
fixture.accept(4, [sourceRange()])
expect(fixture.hostPtyIdentity).toBe('host-owned-pty')
expect(fixture.evidence).toBe('deterministic-contract-fixture')
expect(fixture.acknowledge(oldGeneration, 4).status).toBe('stale-generation')
expect(fixture.acknowledge(generation, 4).status).toBe('accepted')
expect(fixture.snapshot()).toMatchObject({
settled: [{ spanId: 'span-1' }],
transferred: [{ spanId: 'span-1' }]
})
})
}
)