Repository navigation
Recover inferred language choice and respect KDE Bulgarian layout - #29
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28e90cfe18
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🔵 Needs a closer look
It changes per-keystroke core scoring semantics and adds system DBus/IBus lifecycle integration whose real-session behavior cannot be fully validated automatically, warranting final human review.
No open issues 🎉
What changed in this PR
This PR fixes two independent defects in the SmartKey input method. First, an inferred language-prefix lock in the dual-buffer scorer could survive even after the growing word lost all corpus support on the locked side while the other language still had support, keeping the wrong script displayed/committed. The fix re-scores a non-explicitly-locked buffer only in that one-sided case, re-anchors the inferred lock to the new deciding prefix (so deleting it retracts the lock), and routes detector feeding through a new rescored flag. Second, selecting KDE's Bulgarian keyboard layout while SmartKey stayed active still applied automatic physical-key interpretation; the PR adds an optional, read-only KDE metadata observer so an explicit BG layout forwards ordinary keystrokes (retiring any owned prefix once) and returning to US resumes automatic interpretation.
Changes:
- Dual-buffer: recover an inferred lock when the current winner loses prefix support but the other side retains it, and re-anchor
inferred_lock_lenon a post-lock flip. - Add
ibus/kde_layout.pyread-only KDE layout observer plus engine wiring (_init_kde_layout_observer,_manual_layout_for_key,do_destroycleanup) that bypasses prediction/learning/tracing in manual BG mode. - Update existing Rust/Python tests to the corrected one-sided recovery output and add new Core integration and KDE/adapter tests.
| File | Description |
|---|---|
crates/smartkey-core/src/dual_buffer.rs |
Re-anchor inferred_lock_len to current length when a post-lock flip occurs, so deleting the new deciding prefix retracts the lock. |
crates/smartkey-core/src/input.rs |
Add one-sided unsupported_winner recovery in handle_dual_buffer_key; gate detector feed on a real rescored instead of !was_locked; update characterization tests. |
crates/smartkey-core/src/master_loop.rs |
Update terminal-alignment contract test to the recovered статия/статияx word. |
crates/smartkey-core/tests/language_phrase.rs |
New Core integration tests covering recovery, retraction/retype, explicit-accept survival, OOV ambiguity, and the todo case. |
crates/smartkey-core/tests/language_choice.rs |
Adjust fixture so EN keeps stat prefix support, isolating the one-sided boundary correction. |
ibus/kde_layout.py |
New optional read-only KDE DBus layout observer with metadata validation and subscription cleanup. |
ibus/smartkey_engine.py |
Wire the observer into init/focus/destroy and add manual-BG passthrough gating after the sensitive-field hard stop. |
ibus/test_kde_layout.py |
Contract tests for the observer (validation, owner loss, partial-subscription cleanup, bounded read-only DBus). |
ibus/test_manual_layout.py |
Adapter tests for manual-BG passthrough, resume-to-US, sensitive hard stop, and lifecycle. |
ibus/test_native_language_evidence.py |
Update expected suffix to the recovered статияx. |
I verified the recovery gating preserves prior behavior for explicitly-locked and still-supported buffers (only adding a per-keystroke score_both on inferred-locked buffers), that the manual-mode block is correctly placed after the fail-closed sensitive-field stop, that spurious zero-key events are still consumed rather than triggering mode transitions, and that observer cleanup is idempotent and guarded against late callbacks. I did not find concrete defects to comment on.
Review effort: Balanced
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7375340aa8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1208d6df5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c450d890b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
An inferred language choice could remain locked after later typed characters lost all prefix support in that language and gained support in the other. Reconsider that one-sided case, update prediction evidence, and anchor the inferred lock to the supporting suffix. Backspace now also updates the detector from the surviving corpus-supported prefix before choosing a completion. Explicitly accepted choices and ambiguous/OOV choices retain their contracts; English terms such as
todoremain valid in Bulgarian text.KDE layout selection and IBus engine selection are independent. Selecting KDE Bulgarian while SmartKey remained active previously entered automatic physical-key interpretation. An optional read-only KDE observer now forwards explicit BG keyboard input and resumes automatic interpretation on return to US. It retires the owned typed prefix once, using a Core/PyO3 delivery-only API that does not learn an unfinished word as completed. Real focus-loss behavior is unchanged.
The observer survives initial metadata failures and recovers through owner/layout signals or an unverified-only focus retry. Layout-list changes invalidate indexed metadata before refresh, so a failed read cannot route a new index through an obsolete list. Ordinary verified layout signals use the cache. Both package and flat-module entrypoints load the helper; startup validates the mandatory native handoff API before loading personal data or processing keys. No engine/layout/global configuration change is introduced.
Validation for exact head
9025850e353d1516aa849fe47e59fda9c2aeb83d:A failed refresh now withdraws observer verification while retaining the last manual routing value. The existing focus retry recovers without another KDE signal; successful validated metadata restores verification. Fourteen actual failing regressions now pass, including eight cases through the real adapter focus path. The complete related observer/adapter/startup group passes all 63 tests.
The separately reported duplicated-completion episode remains unresolved. Bounded private KWrite checks with a copied profile, matching completion settings, and queued Right/Tab input did not reproduce it. Source/package/private GUI evidence does not claim user-session acceptance.