chore(deps): upgrade to Electron 43, Vite 8, Vitest 5 and pin Node 24

Electron 33.4.11 -> 43.8.10, electron-vite 6, Vite 8.3.8, Vitest 5.1.0, Node engines 24.x.
Electron 43 made clipboard text read/write asynchronous, so text insertion, selected-text
capture and the popup copy channel now await it; includes the async restore regression test.
Evidence: docs/evidence/2026-11-17-backlog-operations.md (GAP-SEC-01).
This commit is contained in:
Yun Chan 2026-11-20 15:16:08 +09:00
parent 876e72ea2f
commit e0b1ceaa75
16 changed files with 2755 additions and 3544 deletions

View file

@ -42,7 +42,6 @@ import {
LEARNING_EXCLUDED_APPS,
isAppScopedLearning,
TERMINAL_APPS,
isAppExcluded,
isLearnablePhrase,
withoutPlaceholderText,
emptyFocusSnapshot

View file

@ -94,7 +94,7 @@ function makeKeyboard(clip: MemoryClipboard, pasted: string[], typed: string[]):
return {
backspace: vi.fn(async () => undefined),
paste: vi.fn(async () => {
pasted.push(clip.readText())
pasted.push(await clip.readText())
}),
type: vi.fn(async (text: string) => {
typed.push(text)
@ -129,6 +129,19 @@ describe('TextInsertService 클립보드 복원 (redteam r1-2)', () => {
expect(result.success).toBe(true)
})
it('비동기 클립보드 읽기가 끝난 뒤 원본을 복원한다', async () => {
const clip = new MemoryClipboard()
clip.text = 'original'
vi.spyOn(clip, 'readText').mockImplementation(() => Promise.resolve(clip.text))
const { service, pasted } = makeService(clip)
const result = await service.insertText('dictated', 'clipboard')
expect(pasted).toEqual(['dictated'])
expect(result.method).toBe('clipboard')
expect(clip.text).toBe('original')
})
it('Word/브라우저 서식(텍스트+HTML+RTF+이미지)을 모두 되돌린다', async () => {
const clip = new MemoryClipboard()
const img = new FakeImage(false, 'table-picture')
@ -293,12 +306,12 @@ describe('clipboard-snapshot 정책', () => {
expect(isStandardClipboardFormat('FileNameW')).toBe(false)
})
it('표준 내용이 있으면 함께 쓰고, 같이 쓸 수 없는 포맷은 dropped 로 보고한다', () => {
it('표준 내용이 있으면 함께 쓰고, 같이 쓸 수 없는 포맷은 dropped 로 보고한다', async () => {
const clip = new MemoryClipboard()
clip.text = 't'
clip.html = 'h'
clip.buffers.set('vscode-editor-data', Buffer.from('{}'))
const plan = planClipboardRestore(captureClipboard(clip))
const plan = planClipboardRestore(await captureClipboard(clip))
expect(plan).toEqual({
kind: 'write',
data: { text: 't', html: 'h' },
@ -306,37 +319,37 @@ describe('clipboard-snapshot 정책', () => {
})
})
it('사용자 정의 포맷이 여럿이면 되돌릴 수 없다고 판정한다 (clear 금지)', () => {
it('사용자 정의 포맷이 여럿이면 되돌릴 수 없다고 판정한다 (clear 금지)', async () => {
const clip = new MemoryClipboard()
clip.buffers.set('A', Buffer.from('a'))
clip.buffers.set('B', Buffer.from('b'))
expect(planClipboardRestore(captureClipboard(clip)).kind).toBe('unrestorable')
expect(planClipboardRestore(await captureClipboard(clip)).kind).toBe('unrestorable')
})
it('readBuffer 가 예외를 던지는 포맷은 읽지 못한 포맷으로 분류한다', () => {
it('readBuffer 가 예외를 던지는 포맷은 읽지 못한 포맷으로 분류한다', async () => {
const clip = new MemoryClipboard()
clip.opaque = ['weird']
vi.spyOn(clip, 'readBuffer').mockImplementation(() => {
throw new Error('nope')
})
const snap = captureClipboard(clip)
const snap = await captureClipboard(clip)
expect(snap.unreadable).toEqual(['weird'])
expect(planClipboardRestore(snap).kind).toBe('unrestorable')
})
it('availableFormats 가 실패하면 비어 있다고 가정하지 않는다', () => {
it('availableFormats 가 실패하면 비어 있다고 가정하지 않는다', async () => {
const clip = new MemoryClipboard()
vi.spyOn(clip, 'availableFormats').mockImplementation(() => {
throw new Error('locked')
})
const snap = captureClipboard(clip)
const snap = await captureClipboard(clip)
expect(snap.unreadable).toEqual([UNKNOWN_FORMATS])
expect(planClipboardRestore(snap).kind).toBe('unrestorable')
})
it('표준 포맷만 광고되고 내용이 비었으면 clear 로 되돌린다', () => {
it('표준 포맷만 광고되고 내용이 비었으면 clear 로 되돌린다', async () => {
const clip = new MemoryClipboard()
vi.spyOn(clip, 'availableFormats').mockReturnValue(['text/plain'])
expect(planClipboardRestore(captureClipboard(clip))).toEqual({ kind: 'clear' })
expect(planClipboardRestore(await captureClipboard(clip))).toEqual({ kind: 'clear' })
})
})