Restore main's formatting on files reformatted by the local pre-commit hook during the merge

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
brennanb2025
2026-07-09 14:13:39 -07:00
co-authored by Orca
parent 975e2aa39b
commit 4ae02ee745
8 changed files with 31 additions and 46 deletions
@@ -1,5 +1,8 @@
import { randomUUID } from 'node:crypto'
import type { OrcaCloudCapabilities, OrcaCloudOrgSummary } from '../../shared/orca-profiles'
import type {
OrcaCloudCapabilities,
OrcaCloudOrgSummary
} from '../../shared/orca-profiles'
import type { OrcaCloudSessionExchangeResponse } from './profile-cloud-session-exchange'
const DEV_SESSION_TTL_MS = 7 * 24 * 60 * 60 * 1000
@@ -138,7 +138,9 @@ describe('Orca cloud profile auth-failure retry', () => {
safeStorageMock.encryptString.mockReset()
safeStorageMock.isEncryptionAvailable.mockReset()
safeStorageMock.decryptString.mockImplementation((value: Buffer) => value.toString('utf-8'))
safeStorageMock.encryptString.mockImplementation((value: string) => Buffer.from(value, 'utf-8'))
safeStorageMock.encryptString.mockImplementation((value: string) =>
Buffer.from(value, 'utf-8')
)
safeStorageMock.isEncryptionAvailable.mockReturnValue(true)
vi.unstubAllEnvs()
vi.stubEnv('ORCA_CLOUD_API_URL', '')
@@ -123,7 +123,9 @@ describe('Orca cloud profile service session refresh', () => {
safeStorageMock.encryptString.mockReset()
safeStorageMock.isEncryptionAvailable.mockReset()
safeStorageMock.decryptString.mockImplementation((value: Buffer) => value.toString('utf-8'))
safeStorageMock.encryptString.mockImplementation((value: string) => Buffer.from(value, 'utf-8'))
safeStorageMock.encryptString.mockImplementation((value: string) =>
Buffer.from(value, 'utf-8')
)
safeStorageMock.isEncryptionAvailable.mockReturnValue(true)
vi.unstubAllEnvs()
vi.stubEnv('ORCA_CLOUD_API_URL', '')
@@ -114,7 +114,9 @@ describe('Orca cloud profile service', () => {
safeStorageMock.encryptString.mockReset()
safeStorageMock.isEncryptionAvailable.mockReset()
safeStorageMock.decryptString.mockImplementation((value: Buffer) => value.toString('utf-8'))
safeStorageMock.encryptString.mockImplementation((value: string) => Buffer.from(value, 'utf-8'))
safeStorageMock.encryptString.mockImplementation((value: string) =>
Buffer.from(value, 'utf-8')
)
safeStorageMock.isEncryptionAvailable.mockReturnValue(true)
revokeOrcaCloudSessionMock.mockResolvedValue(undefined)
vi.unstubAllEnvs()
@@ -55,15 +55,11 @@ describe('terminal IME candidate key release guard', () => {
it('does not guard fresh keydowns, other keys, modified keypresses, or expired keypresses', () => {
const releases = createTerminalImePendingCandidateKeyReleases()
armTerminalImePendingCandidateKeyRelease(releases, event({ key: '2' }), 10)
expect(shouldApplyTerminalImePendingCandidateKeyRelease(event({ key: '2' }), releases, 20)).toBe(
false
)
expect(
shouldApplyTerminalImePendingCandidateKeyRelease(event({ key: '2' }), releases, 20)
).toBe(false)
expect(
shouldApplyTerminalImePendingCandidateKeyRelease(
event({ type: 'keyup', key: '3' }),
releases,
20
)
shouldApplyTerminalImePendingCandidateKeyRelease(event({ type: 'keyup', key: '3' }), releases, 20)
).toBe(false)
expect(
shouldApplyTerminalImePendingCandidateKeyRelease(
@@ -161,18 +157,10 @@ describe('terminal IME candidate key release guard', () => {
armTerminalImePendingCandidateKeyRelease(releases, event({ key: '2' }), 10)
armTerminalImePendingCandidateKeyRelease(releases, event({ key: '3' }), 12)
expect(
shouldApplyTerminalImePendingCandidateKeyRelease(
event({ type: 'keyup', key: '2' }),
releases,
20
)
shouldApplyTerminalImePendingCandidateKeyRelease(event({ type: 'keyup', key: '2' }), releases, 20)
).toBe(true)
expect(
shouldApplyTerminalImePendingCandidateKeyRelease(
event({ type: 'keyup', key: '3' }),
releases,
20
)
shouldApplyTerminalImePendingCandidateKeyRelease(event({ type: 'keyup', key: '3' }), releases, 20)
).toBe(true)
// The first key's keyup no longer strands the second key's pending release.
clearTerminalImePendingCandidateKeyRelease(releases, event({ type: 'keyup', key: '2' }))
@@ -11,10 +11,7 @@ type TrackerHarness = {
tracker: TerminalImeCompositionTracker
element: HTMLElement
advance: (ms: number) => void
composition: (
type: 'compositionstart' | 'compositionupdate' | 'compositionend',
data: string
) => void
composition: (type: 'compositionstart' | 'compositionupdate' | 'compositionend', data: string) => void
input: (inputType: string) => void
blur: () => void
}
@@ -166,11 +166,7 @@ describe('shouldSuppressTerminalImeKeyboardEvent — Windows/Linux', () => {
// Post-compositionend guard: the tracker is already inactive but the
// committing key's trailing press/release must still be absorbed.
const linuxPostCompositionGuard = { ...linuxIdle, candidateKeyGuardActive: true }
const windowsComposing = {
...windowsIdle,
compositionActive: true,
candidateKeyGuardActive: true
}
const windowsComposing = { ...windowsIdle, compositionActive: true, candidateKeyGuardActive: true }
it('suppresses keyboard events while Chromium reports active IME composition', () => {
for (const options of [windowsIdle, linuxIdle]) {
@@ -272,9 +268,9 @@ describe('shouldSuppressTerminalImeKeyboardEvent — Windows/Linux', () => {
it('suppresses Space and digit keydowns and keyups while the candidate guard is active', () => {
for (const options of [linuxComposing, linuxPostCompositionGuard]) {
for (const key of [' ', '0', '2', '9']) {
expect(shouldSuppressTerminalImeKeyboardEvent(event({ key, code: '' }), options)).toBe(
true
)
expect(
shouldSuppressTerminalImeKeyboardEvent(event({ key, code: '' }), options)
).toBe(true)
expect(
shouldSuppressTerminalImeKeyboardEvent(event({ type: 'keyup', key, code: '' }), options)
).toBe(true)
@@ -300,10 +296,7 @@ describe('shouldSuppressTerminalImeKeyboardEvent — Windows/Linux', () => {
it('leaves Space and digits alone once the guard has expired', () => {
for (const type of ['keydown', 'keyup', 'keypress']) {
expect(
shouldSuppressTerminalImeKeyboardEvent(
event({ type, key: ' ', code: 'Space' }),
linuxIdle
)
shouldSuppressTerminalImeKeyboardEvent(event({ type, key: ' ', code: 'Space' }), linuxIdle)
).toBe(false)
expect(
shouldSuppressTerminalImeKeyboardEvent(
@@ -343,7 +336,10 @@ describe('shouldSuppressTerminalImeKeyboardEvent — Windows/Linux', () => {
it('does not apply the Linux/Sogou candidate guard to Windows', () => {
expect(
shouldSuppressTerminalImeKeyboardEvent(event({ key: ' ', code: 'Space' }), windowsComposing)
shouldSuppressTerminalImeKeyboardEvent(
event({ key: ' ', code: 'Space' }),
windowsComposing
)
).toBe(false)
expect(
shouldSuppressTerminalImeKeyboardEvent(
@@ -394,10 +390,7 @@ describe('shouldSuppressTerminalImeKeyboardEvent — Windows/Linux', () => {
shouldPreventDefaultTerminalImeCandidateKey(event({ key: ' ', code: 'Space' }), linuxIdle)
).toBe(false)
expect(
shouldPreventDefaultTerminalImeCandidateKey(
event({ key: 'a', code: 'KeyA' }),
linuxComposing
)
shouldPreventDefaultTerminalImeCandidateKey(event({ key: 'a', code: 'KeyA' }), linuxComposing)
).toBe(false)
expect(
shouldPreventDefaultTerminalImeCandidateKey(
@@ -629,9 +629,7 @@ test.describe('Chinese IME terminal chat input repro', () => {
const postCompositionLog = await readImeEventLog(orcaPage)
const postCompositionEndIndex = postCompositionLog.findIndex(
(entry, index) =>
index >= postCompositionLogStart &&
entry.type === 'compositionend' &&
entry.data === '再见'
index >= postCompositionLogStart && entry.type === 'compositionend' && entry.data === '再见'
)
const postCompositionSelectorIndex = postCompositionLog.findIndex(
(entry, index) =>