Skip to content

test(terminal): preserve Windows IME Shift commits - #12276

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/windows-ime-shift-commit
Aug 3, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/windows-ime-shift-commit

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add an Electron integration regression for the native Microsoft Pinyin Shift-toggle sequence
  • verify the active preedit commits exactly once, the composition overlay clears, and no newline reaches the PTY
  • preserve the event-trace contribution from fix(terminal): reconcile Windows IME deletion and Shift toggle #11550 without taking its separate deletion-path changes

The production regression was introduced by #11293's broad Process/229 modified-Enter classification. Current main already 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.ts
  • pnpm exec oxlint tests/e2e/chinese-ime-chat-input-repro.spec.ts tests/e2e/helpers/windows-ime-native-events.ts --deny-warnings
  • pnpm exec tsc --noEmit -p config/tsconfig.node.json --pretty false
  • pnpm run check:max-lines-ratchet
  • pnpm 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

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds 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)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes a clear summary and testing details but omits the required Screenshots, AI Review Report, Security Audit, and Notes sections. Add all missing template sections and state No visual change where applicable, with AI review, security, and platform-compatibility details.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the terminal regression test for preserving Windows IME Shift commits.
Linked Issues check ✅ Passed The regression test covers the linked issue by verifying one preedit commit, cleared composition, and no newline or extra PTY input.
Out of Scope Changes check ✅ Passed The changes are limited to Windows IME end-to-end coverage and test helpers that directly support the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e9640c and 41c88a2.

📒 Files selected for processing (2)
  • tests/e2e/chinese-ime-chat-input-repro.spec.ts
  • tests/e2e/helpers/windows-ime-native-events.ts

Comment on lines +622 to +631
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'])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: Microsoft Pinyin Shift mode toggle inserts a newline in terminal TUI apps

1 participant