Skip to content

test(e2e): close the captured line for a chord that emits no terminator - #13277

Closed
kunsanglee wants to merge 1 commit into
stablyai:mainfrom
kunsanglee:fix/korean-chord-e2e-csiu-line-flush
Closed

kunsanglee wants to merge 1 commit into
stablyai:mainfrom
kunsanglee:fix/korean-chord-e2e-csiu-line-flush

Conversation

@kunsanglee

Copy link
Copy Markdown
Contributor

What

terminal-macos-korean-chord-commit-native.spec.ts › commits the preedit before physical Ctrl+Enter has never passed. Its sibling row, Shift+Enter, always has.

Why it could not pass

terminal-ime-byte-reader.ts emits a capture only when it finds a newline, and
it splits on nothing else:

let newlineIndex = pending.indexOf(0x0a)
while (newlineIndex >= 0) { ... }

The Shift+Enter row ends in CR, the tty converts it to LF, the line closes, one
capture. Ctrl+Enter sends CSI-u (ESC [ 13 ; 5 u), which carries no line
terminator at all — so the line never closes and the reader times out at zero
captures no matter what the product sent. Expected: 1, Received: 0.

This is a harness defect, not a product one. The bytes were always arriving.

Bisect

It stays green in CI because the spec is gated behind
ORCA_E2E_NATIVE_MACOS_KOREAN=1, which CI does not set. It only runs for someone
who opts in locally, which is why it took a second machine reporting it to
surface.

The fix

A plain Return follows the chord for the row whose bytes do not end a line, and
the expectation carries the LF it produces. Sending it unmodified is safe because
the chord already committed the preedit — the assertion's leading 하 하 하 is
what proves that, since a surviving preedit would eat the Return and put its own
commit ahead of the chord's bytes.

This is the same idiom the parked-terminal and cursor-chord specs use to get a
line out of this reader.

Also drops the renderer field from the chord table. Its comment claimed both
forms were asserted; nothing ever read it. The CR-to-LF evidence that comment was
reaching for is exactly what the pty expectation's trailing LF already carries,
so the claim now matches the code.

Verification

Run by hand on macOS 26.5.1 with 2-Set Korean and Accessibility granted:
2/2 passed on three consecutive runs. Before the change, the same machine
reproduced the reported failure at all three commits above.

oxlint, pnpm typecheck, and check:max-lines-ratchet clean.

Test-only. No product code touched.

`commits the preedit before physical Ctrl+Enter` has never passed. It fails the
same way at stablyai#13128's own commit, which introduced it, as it does on today's
main: `Expected: 1, Received: 0`.

The cause is the harness, not the product. `terminal-ime-byte-reader` emits a
capture only when it finds `0x0a`, and it splits on nothing else. The Shift+Enter
row ends in CR, the tty converts it, the line closes. Ctrl+Enter sends CSI-u,
which carries no line terminator at all, so the line never closes and the reader
times out at zero captures however correct the bytes were.

A plain Return now follows the chord for that row, and the expectation carries
the LF it produces. Sending it unmodified is safe because the chord already
committed the preedit — the assertion's leading `하 하 하` is what proves it, since
a surviving preedit would eat the Return and put its own commit ahead of the
chord's bytes.

Also drops the `renderer` field. Its comment claimed both forms were asserted,
but nothing ever read it; the CR-to-LF evidence the comment was reaching for is
what the `pty` expectation's trailing LF already carries.

The spec is gated behind `ORCA_E2E_NATIVE_MACOS_KOREAN=1`, which CI does not set,
so this only ever ran for someone who opted in locally. Verified by hand on macOS
26.5.1 with 2-Set Korean: 2/2 on three consecutive runs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mu6j33LNsd4Mvv8a1NuFoo
@kunsanglee
kunsanglee marked this pull request as ready for review August 9, 2026 00:34
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 546422a0-5a09-43fd-8719-a12e322fab93

📥 Commits

Reviewing files that changed from the base of the PR and between 05c3016 and f559aa2.

📒 Files selected for processing (1)
  • tests/e2e/terminal-macos-korean-chord-commit-native.spec.ts

📝 Walkthrough

Walkthrough

The macOS Korean chord test now documents PTY capture requirements and adds a flushesOwnLine flag for chord cases. Shift+Enter is marked as line-flushing, while Ctrl+Enter is not. The test sends an unmodified Return after non-flushing chords so the captured PTY bytes include a trailing line feed. Renderer-output expectations were removed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the failure and fix, but it omits the required template sections for screenshots, checklist testing, AI review, security audit, and notes. Add the required headings and complete the screenshots, testing checklist, AI review, security audit, and notes sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the test fix: closing the captured line for a chord without a terminator.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@kunsanglee

Copy link
Copy Markdown
Contributor Author

Closing: obsolete, not deferred.

17cfc968cf (#13282) reverted #13128 wholesale, and that revert deleted tests/e2e/terminal-macos-korean-chord-commit-native.spec.ts outright. The spec this PR repairs no longer exists on main, so the merge here is a modify/delete conflict against a file that is gone.

The harness defect itself is worth remembering if the spec ever comes back: terminal-ime-byte-reader.ts splits on 0x0a only, so a chord whose bytes carry no line terminator (CSI-u ESC [ 13 ; 5 u) never closes the captured line and the reader times out at zero captures. The fix is to follow such a chord with a plain Return.

@kunsanglee kunsanglee closed this Aug 9, 2026
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.

1 participant