Repository navigation
test(terminal): preserve Windows IME Shift commits - #12276
Conversation
Co-authored-by: yoke233 <[email protected]>
📝 WalkthroughWalkthroughAdds Windows IME support to the end-to-end terminal test harness. The harness can record raw PTY input and inspect xterm composition text. New helpers dispatch Windows Process and Shift events through CDP and read JSONL PTY logs. A regression test creates a Pinyin preedit, commits it with Shift, verifies that the composition closes without submission, and confirms that only the committed text reaches the PTY. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 29b9d12a-a18b-4714-84d5-ca563e879f08
📒 Files selected for processing (2)
tests/e2e/chinese-ime-chat-input-repro.spec.tstests/e2e/helpers/windows-ime-native-events.ts
| await setImeComposition(session, 's') | ||
| const inputCountBeforeShift = readPtyInputCount(inputLogPath) | ||
| await dispatchWindowsImeShiftToggle(session) | ||
|
|
||
| await waitForLivePrompt(orcaPage, 's') | ||
| await expect.poll(() => readActiveCompositionText(orcaPage)).toBe('') | ||
| await expect.poll(async () => (await readPromptState(orcaPage))?.submitted).toEqual([]) | ||
| await expect | ||
| .poll(() => readPtyInputs(inputLogPath).slice(inputCountBeforeShift)) | ||
| .toEqual(['s']) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Assert the pre-toggle preedit and PTY state.
The baseline can hide a failed preedit setup or text that reached the PTY before Shift. The test can then pass after Input.insertText even when it did not commit an active preedit exactly once.
Wait for composition text 's'. Assert that the PTY log is empty. Then assert the complete log equals ['s'].
Proposed fix
await setImeComposition(session, 's')
- const inputCountBeforeShift = readPtyInputCount(inputLogPath)
+ await expect.poll(() => readActiveCompositionText(orcaPage)).toBe('s')
+ await expect.poll(() => readPtyInputCount(inputLogPath)).toBe(0)
await dispatchWindowsImeShiftToggle(session)
await waitForLivePrompt(orcaPage, 's')
await expect.poll(() => readActiveCompositionText(orcaPage)).toBe('')
await expect.poll(async () => (await readPromptState(orcaPage))?.submitted).toEqual([])
- await expect
- .poll(() => readPtyInputs(inputLogPath).slice(inputCountBeforeShift))
- .toEqual(['s'])
+ await expect.poll(() => readPtyInputs(inputLogPath)).toEqual(['s'])Co-authored-by: OrcaWin <[email protected]> Co-authored-by: yoke233 <[email protected]>
Summary
The production regression was introduced by #11293's broad
Process/229 modified-Enter classification. Currentmainalready restores this behavior through #12265 and #12273; this PR adds the missing end-to-end contract so it cannot silently regress again.Adapted from #11550 by @yoke233, who is credited as co-author.
Fixes #11946
Testing
pnpm exec oxfmt --check tests/e2e/chinese-ime-chat-input-repro.spec.ts tests/e2e/helpers/windows-ime-native-events.tspnpm exec oxlint tests/e2e/chinese-ime-chat-input-repro.spec.ts tests/e2e/helpers/windows-ime-native-events.ts --deny-warningspnpm exec tsc --noEmit -p config/tsconfig.node.json --pretty falsepnpm run check:max-lines-ratchetpnpm exec playwright test tests/e2e/chinese-ime-chat-input-repro.spec.ts --config tests/playwright.config.ts --project=electron-headless --workers=1 --grep "commits the active Pinyin preedit"git diff --check