Repository navigation
Keep direct-delivery learning and keyval navigation consistent - #33
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🔵 Needs a closer look
The change's input-method editor text delivery and learning correctness hinges on real Chrome/IBus runtime behavior that cannot be executed or verified within this review container, requiring confirmation from the attached browser/native regression runs.
No open issues 🎉
What changed in this PR
This PR fixes two direct-delivery consistency defects (follow-up to #32). First, with autocorrect enabled, direct mode could deliver the originally-typed token (цар) while learning the autocorrected word (car), because the composing/dual-buffer branch of rewrite_allowed was not gated by the transport's ability to revise composing text. A new ephemeral composing_rewrite_supported capability (default true, forced false at startup, synced to !direct_delivery) now gates that branch. Second, a zero-keycode keypad navigation key (e.g. KP_Left with keycode 0) was misclassified as inert — since keycode 0 was in _NO_DELIVERY_KEYCODES — letting the caret move while a pending word lingered. Inert classification is now routed through the actual dispatch path (_direct_event_inert / _uses_raw_keycode) with a separate keyval table, and semantic forwarded characters continue the token via _direct_key_semantic_char.
Changes:
- Add
composing_rewrite_supportedcapability across the core → PyO3 →MasterLoop→ IBus adapter, gating the preedit-branch of post-commit rewrites so direct mode cannot learn an undelivered correction. - Replace keycode-
0-is-inert handling with route-aware inert classification (_NO_DELIVERY_KEYVALS,_direct_event_inert), delivering/retiring the pending word before navigation while keeping forwarded semantic chars continuing the token. - Replace the magic
self._caps & 1with the named_CAP_PREEDIT_TEXTconstant; add extensive Rust/Python regression tests.
| File | Description |
|---|---|
crates/smartkey-core/src/input.rs |
Adds composing_rewrite_supported field/setter (default true) and gates the preedit branch of rewrite_allowed at 3 sites; adds core regression tests. |
crates/smartkey-core/src/master_loop.rs |
Exposes set_composing_rewrite_supported, invalidating language choice like the external-rewrite setter. |
crates/smartkey-py/src/lib.rs |
PyO3 binding forwarding set_composing_rewrite_supported to MasterLoop. |
ibus/smartkey_engine.py |
Enforces composing-rewrite API at startup, syncs it to !direct_delivery, adds route-aware inert classification and semantic-char continuation, uses _CAP_PREEDIT_TEXT. |
ibus/test_direct_delivery.py |
Adds navigation-delivery, fallback-modifier, and composing-rewrite capability tests plus mock setter. |
ibus/test_native_key_contract.py |
Adds native-backed regressions for autocorrect boundary learning and zero-keycode navigation/continuation. |
ibus/test_external_rewrite_delivery.py |
Asserts startup refuses incompatible composing-rewrite API and emits the capability event in order. |
tests/test_o1_shim.py |
Adds set_composing_rewrite_supported to shim doubles. |
No blocking issues were found; the change is logically consistent and well covered by tests. Final real-editor (Chrome/IBus) behavior is best confirmed via the attached regression runs since it can't be executed in this review environment.
Review effort: Balanced
Direct delivery could learn an autocorrected word while delivering the original text: with autocorrect enabled, the synthetic
царboundary case deliveredцарbut learnedcar. Add an explicit composing-rewrite capability and disable it in direct mode before correction and learning; ordinary preedit restores that capability independently of surrounding-text support.Zero-keycode keypad navigation could also move the caret while an old word remained pending. Classify inert events using the actual dispatch route, deliver and retire before navigation, and preserve normal forwarded semantic-character continuation, including digits and punctuation. Use the existing named PREEDIT capability constant.
Follow-up to the two post-merge findings and the constant cleanup in #32. Regressions cover Space/Return/punctuation autocorrect, ordinary-preedit restoration, KP_Left with keycode zero, and literal
hello,abc1,abc!continuation. Existing modifier/release/phantom safeguards remain covered.Validation on clean build
f80a5aa: 982 core Rust tests passed (1 ignored), 307 native-backed Python tests plus 916 remaining Python tests passed, and 23/23 existing private Chrome/IBus regression assertions passed with the exact release module. Targeted regressions reproduced both reported failures before the fix and pass with the repaired native module. Independent source review and formatting passed. All seven GitHub CI checks passed. The Codex review of the exact head completed without findings. The Copilot review also completed with no open issues, explicitly deferring native editor verification to the independently executed browser/native regression runs described below.The browser run covers the established input/focus regressions; zero-keycode dispatch and correction/learning consistency are established by the actual native-core/adapter tests. General mouse-focus limitations documented in #32 remain outside this follow-up.