Repository navigation
test(e2e): headless IME preedit-geometry coverage for Korean and CJK terminal input [NOT FOR MERGE] - #13290
Closed
nwparker wants to merge 5 commits into
Closed
test(e2e): headless IME preedit-geometry coverage for Korean and CJK terminal input [NOT FOR MERGE]#13290nwparker wants to merge 5 commits into
nwparker wants to merge 5 commits into
Conversation
nwparker
changed the base branch from
main
to
nwparker/ime-structural-forwarder
August 9, 2026 03:35
nwparker
force-pushed
the
nwparker/ime-e2e-korean-headless
branch
3 times, most recently
from
August 9, 2026 04:49
0c87b5f to
7c19638
Compare
nwparker
force-pushed
the
nwparker/ime-structural-forwarder
branch
from
August 9, 2026 08:17
39379d4 to
0b0aa25
Compare
nwparker
force-pushed
the
nwparker/ime-e2e-korean-headless
branch
from
August 9, 2026 08:18
d46e339 to
fc54888
Compare
…input Both IME defects that shipped and were reverted walked through a suite of ~3000 passing assertions, because every one of them was about bytes reaching the PTY. A preedit rendered into a hidden overlay satisfies all of them while the user composes blind. The real-geometry coverage that would have caught it existed but was headful, env-gated and macOS-only, so it never ran in CI. Drives composition through CDP Input.imeSetComposition instead of a native input source, which removes the accessibility grant and the system input source that forced the headful gate. The suite runs in the normal headless project in about 55s serially, and asserts the composition overlay's real bounding rect — the one property an overlay clipped to max-width:0 cannot fake and a DOM emulator cannot produce. Three tests are red on main and marked test.fail() so they stay visible in CI and flip loud when their fix lands: the preedit resumed by a bare compositionupdate, and full-width punctuation and digits committed from a keydown that still carries the ASCII layout key. Co-authored-by: Orca <[email protected]>
Validated on real macOS hardware: with the two fixes below this layer, all three report "Expected to fail, but passed". Korean preedit renders at non-zero geometry through every jamo, and an Apple pinyin source sends ef bc 8c e3 80 82 to the pty where main sends ASCII. Worth recording why the punctuation case looked green on main once: an input source whose id happens to contain an allowlist term, as Sogou's does, satisfies the old gate. Correctness there depended on which IME the user had selected. Co-authored-by: Orca <[email protected]>
The ten headless IME specs on this branch all decided ownership through a macOS user-agent override, so the two platforms whose failure mode is a *dropped* character rather than a downgraded one had no coverage at all, and the one Windows-recorded trace already in the suite was replayed under whichever policy the runner happened to report — macOS locally, Linux on the CI shards. Adds four Linux specs and two Windows specs, every one of them replaying a native capture rather than a hand-authored ordering: - IBus/X11 Hangul mixed with literal ASCII. Its `compositionend` is EMPTY and the syllable arrives afterwards as a bare `insertText`, so reading the commit off `compositionend.data` — which the Windows capture rewards — drops every syllable on this framework. - fcitx5/Wayland Hangul. No keydown at all for a composing key, not even 229, and physically wrong `code` values on the literal keys. Any ownership rule reading 229 or `code` fails here. - Numeric pinyin candidate selection under both frameworks, with the ordinary digit kept as the negative control, so the two directions are pinned against each other rather than separately. - Windows Microsoft Korean captured with real scan codes, including the two lines committed with Shift held. Each asserts both sides of the boundary: the preedit's real geometry at every frame the user would see, and the exact byte stream the native run put on the PTY. The recorded `onData` the Windows/WSL fixture already carried is now asserted instead of sitting unused. Chinese moves up to first-class alongside Korean: pinyin preedit width is now pinned the way the Japanese phrase already was, and full-width punctuation is covered in the composition-session shape the Windows and Linux frameworks use, not only the macOS insertText shape. Two harness fixes fell out of the recorded traces and are why the IBus one passes. The replay applied each event's recorded textarea state *after* dispatch, one event too late for the handlers that read `textarea.value`; and it left a task boundary between `compositionend` and the `input` carrying the commit, which Chromium never inserts, letting xterm's deferred finalizer settle against a textarea the committed text had not reached yet. Co-authored-by: Orca <[email protected]>
…esising them The macOS coverage on this branch drives Chromium composition through CDP, which is genuine but hand-ordered, so it could not assert the one property that decides the macOS rule: a composing keydown arrives with keyCode 229 while `key` is still the single translated character the input source produced — `ㅎ`, not `Process` — which is indistinguishable by length from an ordinary printable key. Three native captures were sitting unused in the evidence set. Adds a recorded 2-Set Korean session, including the syllable boundary where one composition closes and the next opens with no keydown between them, asserted against its own recorded byte stream. Adds the third failure mode, which had no coverage in any shape: an abandoned preedit leaking to the shell. Pinyin and Cangjie both backspace a composition away to nothing, and the assertion is not "the right bytes" but "no bytes". Both cancellation captures continue with a literal `ordinary` typed as bare keydowns, the recorder's own negative control. That tail carries no `input` events because the build it was captured on produced the byte from the keydown itself, so replaying it would measure the recorder rather than the product; the specs cut at the `compositionend` and say so. Co-authored-by: Orca <[email protected]>
… the suite Qingg matches none of the terms the pre-structural build enumerated, so on that build its bypass never installs. It is the one arm no headless spec can express, and the only test here that the pre-structural build cannot pass. Promoted from scratch with four changes, each forced by a measurement rather than by taste: - A non-attached input method is a refusal, not a negative result. macOS attaches per app instance and the attach can simply fail — 3 of 6 instances under exclusive host access, and re-selecting the source did not recover one of them across 9 keystrokes. That is now `test.skip()` with a reason naming the rerun, not a thrown error, and the suite does not gate on a fully green session. - Attachment is probed with a LETTER. Punctuation substitution emits no compositionstart and no keyCode 229 even under a fully attached source, so at the keydown it is indistinguishable from having no source at all. The punctuation arms are judged on PTY bytes alone. - The ASCII-layout control is now part of the spec rather than a side experiment. Without it a build that rewrote every `.` into `。` unconditionally would pass the Qingg arm and be badly wrong. - The assertion runs by default instead of behind a strict-mode flag, and gained a non-vacuity check: the input source must have committed something. That is the sharp end of the mechanism — on the old build the DOM carries only keydown and keyup, so nothing is committed at all and the character is destroyed before the source is asked. The verdict stays an equality between two measurements, never a comparison against a hardcoded glyph, so it holds whatever punctuation mode the operator's input source happens to be in. It reads `beforeinput`, not `input`: the forwarder consumes `input` in the capture phase on the pane element, so a probe on the helper textarea never sees it and a strict run fails with correct bytes underneath. Co-authored-by: Orca <[email protected]>
nwparker
force-pushed
the
nwparker/ime-e2e-korean-headless
branch
from
August 9, 2026 09:00
fc54888 to
3f43064
Compare
Contributor
Author
|
Superseded by #14500 ( Closing because its condition was met, not because it was wrong. The Not rebased: this branch still carried the preedit product commit that shipped as #13284, so replaying it onto Two things surfaced while landing it, recorded here since they came from this work:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft — not for merge. This is coverage-only. It adds no product code and changes no behaviour. It exists to become the acceptance criteria for the IME re-land stack, and three of its tests are red on
mainon purpose.Why
Both IME defects that shipped and were reverted walked straight through a suite of ~3000 passing IME assertions. Every one of those assertions was about bytes reaching the PTY, and a preedit rendered into a hidden overlay satisfies all of them while the user composes blind. The one arm that asserted real geometry correctly was
@headful, env-gated and macOS-only, so it never ran in CI and was deleted with the revert.What changed
Composition is driven through CDP
Input.imeSetCompositionrather than a native input source, which removes the accessibility grant, the system input source and the visible window that forced the headful gate. The suite runs in the ordinaryelectron-headlessproject.The load-bearing assertion is the composition overlay's real bounding rect. Verified to have teeth: with
.composition-view.active { max-width: 0; overflow: hidden }injected — invisible on screen — theactiveclass, thetextContent,display: blockandcheckVisibility() === trueall still pass, and only the rect assertion fails.New files, all under
tests/e2e/:terminal-korean-preedit-visibility.spec.tsterminal-cjk-ime-committed-text.spec.tsterminal-ime-preedit-overlay-probe.tsterminal-ime-cdp-composition.tsterminal-ime-recorded-dom-trace-replay.tsfixtures/windows-wsl-2set-hangul-dom-trace.jsonResults on this commit
10 tests, 55.4s serially on macOS. 7 green, 3
test.fail().maincompositionupdateThe three red ones carry
test.fail()and an@ime-known-brokentag, so they run in CI, stay visible in the report, and fail the run the moment their fix lands — which forces the marker to be removed rather than the test to be forgotten.Findings worth reading before the re-land
The recorded Windows/WSL capture does not contain the resume-without-
compositionstartordering. The source recorder logged every event twice — once on dispatch, once as a batched next-frame snapshot. Replaying both copies makes acompositionupdatefollow an already-replayedcompositionend, which manufactures the shape. Filtering to the dispatch-phase records leaves 11 balanced start/end pairs and all 37 updates inside them: zero resumes. The fixture here keeps only the dispatch phase, and the resumed-preedit test is therefore synthesised and says so — the shape is still reachable, because xterm adds.activeonly in itscompositionstarthandler and itscompositionupdatehandler never re-adds it, which this PR reproduces headlessly against a live overlay.The full-width punctuation regression is not testable while the bypass reads an input source. The keydown carries the plain Latin
,; the,exists only in the followinginputevent. The bypass that would prevent the ASCII byte is gated on the OS reporting an input source id matching a 23-term allowlist. That probe returnsnullon every non-macOS host andcom.apple.keylayout.*on a macOS runner with no CJK source selected, and the preload API surface is frozen so no spec can stub it. Correctness here is not expressible as a test until the gate goes away — which is an argument for the structural rule independent of the ones already made for it.event.key-rewritten punctuation is not regression coverage. xterm's own key handler emitsevent.key, so that shape passes with or without a forwarder and would have passed throughout the regression. It is kept, and labelled as such.Not covered
Made with Orca 🐋