Skip to content

change(web): generalize determineSuggestionRange 🚂 🔪#15992

Open
jahorton wants to merge 2 commits into
epic/boundary-correctionfrom
change/web/rework-suggestion-range
Open

change(web): generalize determineSuggestionRange 🚂 🔪#15992
jahorton wants to merge 2 commits into
epic/boundary-correctionfrom
change/web/rework-suggestion-range

Conversation

@jahorton

@jahorton jahorton commented May 21, 2026

Copy link
Copy Markdown
Contributor

The changes of this PR facilitate using the same suggestion-application-range logic for all model types, not just the first-class ones that implement LexiconTraversals. This way, we may standardize the logic used when constructing multi-token suggestions.

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

@keymanapp-test-bot

keymanapp-test-bot Bot commented May 21, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

  • Web
    • KeymanWeb Test Home - build : all tests passed (no artifacts on BuildLevel "build")

@github-actions github-actions Bot added web/ web/predictive-text/ change Minor change in functionality, but not new labels May 21, 2026
@keymanapp-test-bot keymanapp-test-bot Bot changed the title change(web): generalize determineSuggestionRange change(web): generalize determineSuggestionRange 🚂 May 21, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S29 milestone May 21, 2026
@keyman-server keyman-server modified the milestones: A19S29, A19S30 May 23, 2026
@jahorton

jahorton commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

#15907 has some changes to this method that should be moved up to this PR.

@keymanapp-test-bot keymanapp-test-bot Bot changed the title change(web): generalize determineSuggestionRange 🚂 change(web): generalize determineSuggestionRange 🚂 🔪 May 29, 2026
@jahorton jahorton force-pushed the change/web/rework-suggestion-range branch 2 times, most recently from 2828e50 to fb485cb Compare June 1, 2026 17:23
@keyman-server keyman-server modified the milestones: A19S30, A19S31 Jun 8, 2026
@jahorton jahorton force-pushed the refactor/web/drop-token-addinput branch 5 times, most recently from 4dda830 to cc1aca6 Compare June 11, 2026 15:04
To facilitate using the same suggestion-application-range logic for all model types, not just the first-class ones that implement LexiconTraversals.

Build-bot: skip build:web
Test-bot: skip
@jahorton jahorton force-pushed the change/web/rework-suggestion-range branch from fb485cb to 9d35d3d Compare June 11, 2026 15:08
@jahorton

jahorton commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

From devin.ai:

web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts:R450-456

deleteLeftCalc returns incorrect value when predictCount > 1

The deleteLeftCalc helper at web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts:450-456 only returns the last token's codepointLength when predictCount > 1, rather than summing all tokens to remove. This is acknowledged with a TODO comment but means the deleteLeft field in SuggestionReplacement will be incorrect for multi-token prediction scenarios (e.g., the 'large variation in intermediate tokens' test would compute deleteLeft = 3 for 'dog' instead of the expected sum of 17 for 'over the lazy dog'). Since this function isn't called in production yet and the test assertions don't validate deleteLeft, this is currently dormant but will need to be fixed before activating multi-tokenization.

This is done this way to preserve existing unit test functionality; multi-token corrections are not put in place at this stage. It should be fully implemented in a later PR, though exactly which PR has yet to be fully determined, with #15897 #16072 appearing to be a good candidate.

@jahorton jahorton marked this pull request as ready for review June 11, 2026 19:36
@jahorton jahorton requested a review from ermshiperete June 11, 2026 19:36
Comment thread web/src/engine/predictive-text/worker-thread/src/main/correction/context-token.ts Outdated
Base automatically changed from refactor/web/drop-token-addinput to epic/boundary-correction June 12, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants