Skip to content

change(web): prepare suggestion-application for whitespace fat-finger handling 🚂#15775

Open
jahorton wants to merge 3 commits intofeat/web/transition-tokenization-clusteringfrom
change/web/prep-suggestion-application
Open

change(web): prepare suggestion-application for whitespace fat-finger handling 🚂#15775
jahorton wants to merge 3 commits intofeat/web/transition-tokenization-clusteringfrom
change/web/prep-suggestion-application

Conversation

@jahorton
Copy link
Copy Markdown
Contributor

@jahorton jahorton commented Mar 20, 2026

In particular, this PR prepares suggestion-application for operation in whitespace fat-fingering scenarios. Since these scenarios may support multiple different ways to tokenize the active context, the engine should track the tokenization pattern that matches what the user sees and ensure that suggestions are applied to that pattern, rather than to others.

Suggestions should always apply to the context the user actually sees, modifying the context to match the result from applying the suggestion to the state underlying the suggestion. (The suggestion should be constructed with this in mind; prep work for this can be found in #15781 and #15782, among other PRs.)

No 'insert' or 'delete' edit alternatives should be considered when applying suggestions - only the suggestion-application itself.

Build-bot: skip build:web
Test-bot: skip

@keymanapp-test-bot
Copy link
Copy Markdown

keymanapp-test-bot bot commented Mar 20, 2026

User Test Results

Test specification and instructions

User tests are not required

@keymanapp-test-bot keymanapp-test-bot bot changed the title change(web): prepare suggestion-application for whitespace fat-finger handling change(web): prepare suggestion-application for whitespace fat-finger handling 🚂 Mar 20, 2026
@keymanapp-test-bot keymanapp-test-bot bot added this to the A19S25 milestone Mar 20, 2026
@github-actions github-actions bot added web/ web/predictive-text/ change Minor change in functionality, but not new labels Mar 20, 2026
@keyman-server keyman-server modified the milestones: A19S25, A19S26 Mar 28, 2026
@jahorton jahorton force-pushed the refactor/web/split-analyze-transition branch 3 times, most recently from 0e29439 to 938d5ed Compare April 9, 2026 20:31
@jahorton jahorton force-pushed the change/web/prep-suggestion-application branch from aa03f2b to 3802382 Compare April 9, 2026 20:43
@jahorton jahorton changed the base branch from refactor/web/split-analyze-transition to feat/web/transition-tokenization-clustering April 9, 2026 20:44
… handling

Build-bot: skip build:web
Test-bot: skip
@jahorton jahorton force-pushed the change/web/prep-suggestion-application branch from 3802382 to 0e33686 Compare April 9, 2026 20:47
@jahorton jahorton requested a review from ermshiperete April 9, 2026 21:06
@jahorton jahorton marked this pull request as ready for review April 9, 2026 21:06
Comment thread web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts Outdated
const resultingTransition = new ContextTransition(baseState, transformToApply.id);
resultingTransition.finalize(resultingState, inputDistribution);
resultingTransition.revertableTransitionId = suggestion.transformId;
resultingTransition._transitionId = transformToApply.id;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

devin.ai notes this:

_transitionId now uses suggestion.transform.id instead of suggestion.transformId

The old code set resultTransition._transitionId = suggestion.transformId (old line 173). The new code at context-transition.ts:188 sets resultingTransition._transitionId = transformToApply.id where transformToApply = suggestion.transform. These are semantically different fields: transformId is the suggestion-level transition identifier, while transform.id is the ID on the transform object itself. They are aligned by the new code in finalizeSuggestions at predict-helpers.ts:1049-1051 (except when the reported bug with transformId == 0 applies). This creates a coupling between the two codepaths: applySuggestion now implicitly requires that finalizeSuggestions was called first to establish transform.id == transformId. This coupling is fragile if suggestions are constructed without going through finalizeSuggestions (as some tests do).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added documentation as to why this is done.

@keyman-server keyman-server modified the milestones: A19S26, A19S27 Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change Minor change in functionality, but not new epic-autocorrect web/predictive-text/ web/

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants