Skip to content

Send the real Shift state to the prediction worker - #915

Merged
enaboapps merged 4 commits into
mainfrom
907-shift-state
Sep 26, 2026
Merged

enaboapps merged 4 commits into
mainfrom
907-shift-state

Conversation

@enaboapps

@enaboapps enaboapps commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #907. First of the casing changes tracked in #914.

What changed

  • The private worker request carries Shift::{Off, Once, Locked} instead of a boolean. This is the in-process pipe message only; no persisted schema or protocol changes.
  • The keyboard reports its Shift modifier as that enum. An automatic Shift after a sentence end is still reported as off, because the worker capitalises there itself.
  • A new cased function in worker.rs decides the suffix case in one place:
    • Caps or Shift locked uppercase the whole completion, and together they cancel, as on typed letters.
    • Before any letter of the word is typed, Shift once flips only the first character, the way it would flip the next typed letter. So "Water" normally, and "wATER" under Caps. A sentence start capitalises the first letter without any modifier.
    • After typed letters, a pending Shift once is left for the next letter and does not change the completion.
  • The old test that asserted Shift once gives "WATER" now expects "Water", and a new test covers every Shift and Caps combination before and after typing.
  • docs/word-prediction.md describes the rule.
  • A follow-up commit keeps a name's capital in an unmodified suggestion: only an explicit Shift once flip lowers a first letter. The fake model gained "WhatsApp" and the test checks it survives.
  • A re-review found the doc sentence "modifiers still mirror typing at a sentence start" overclaimed, since Shift locked with Caps capitalises there where typing would not. The sentence now says only that Shift once under Caps gives a lowercase first letter, and a test covers Caps, Locked with Caps and Once with Caps at a sentence start.

Validation

Node 24.13.0, Rust 1.97.1:

  • npm run lint, npm test (244 Vitest tests and 5 Node tests) and npm run build passed. No frontend files changed.
  • cargo fmt --check and cargo clippy --all-targets -D warnings passed.
  • cargo test passed: 566 tests.

🤖 Generated with Claude Code

The worker saw only a yes/no shift flag, so Shift once and Shift locked
both uppercased the whole suggestion: Shift once before "water" inserted
"WATER". The keyboard now reports off, once or locked. Caps or Shift
locked uppercase the whole completion and cancel each other as on typed
letters. Before any letter of the word is typed, Shift once changes only
the first letter, as it would the next typed letter, and a sentence
start capitalises it without a modifier. After typed letters a pending
Shift once is left for the next letter.

Closes #907

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps enaboapps added this to the v1.0.0-rc.16 milestone Sep 25, 2026
OwenMcGirr and others added 2 commits September 25, 2026 20:02
Lowering the first letter whenever it was not to be capitalised also
lowered names like WhatsApp in an unmodified mid-sentence suggestion.
Only an explicit Shift once flip lowers a first letter now.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps
enaboapps marked this pull request as ready for review September 26, 2026 03:18
@enaboapps
enaboapps merged commit 23e291e into main Sep 26, 2026
6 checks passed
@enaboapps
enaboapps deleted the 907-shift-state branch September 26, 2026 08:13
@enaboapps enaboapps mentioned this pull request Sep 27, 2026
7 tasks done
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.

Send the real Shift state to the prediction worker

2 participants