fix(common/models): lm-worker context resets didn't properly manage context cache 🐵#10185
Merged
jahorton merged 3 commits intofeature-gesturesfrom Dec 8, 2023
Merged
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
mcdurdin
approved these changes
Dec 8, 2023
jahorton
commented
Dec 8, 2023
| const priorMatchState = this.item(i); | ||
| if(transformDistribution && transformDistribution.length > 0) { | ||
| const priorTaggedContext = priorMatchState.taggedContext; | ||
| if(priorTaggedContext && transformDistribution && transformDistribution.length > 0) { |
Contributor
Author
There was a problem hiding this comment.
We shouldn't need the null-guard now, but... just in case. Don't want a mistake causing spurious keyboard errors in the mobile apps.
jahorton
commented
Dec 8, 2023
Comment on lines
-744
to
-746
| let tokenizedContext = models.tokenize(this.lexicalModel.wordbreaker || wordBreakers.default, context); | ||
| let contextState = correction.ContextTracker.modelContextState(tokenizedContext.left, null, this.lexicalModel); | ||
| this.contextTracker.enqueue(contextState); |
Contributor
Author
There was a problem hiding this comment.
The original form here served to "force" the context tracking to not consider any previous cached entries... but did nothing to clear them. There's no longer a need to "force" it if we've actually cleared the cache, as they're no longer available in that case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #10136.
The first commit, in particular, is the actual fix. Examining the changeset of #9855, I had made no changes whatsoever to
model-compositor.ts'sresetContextmethod... despite now tagging all context states with their context when built - a clear oversight. It did not tag the context on a context reset, which is what gave rise to thenullcases for the Sentry events.While fixing this, I noticed that the
ContextManagerisn't actually reset on aresetContextcall. I decided to fix that while I was at it, which results in better centralization of the related code. That sort of state management was otherwise encapsulated withinContextTracker, and this change removes that "otherwise" caveat.@keymanapp-test-bot skip