Skip to content

change(web): polish documentation + uses of transition ID in predictive text 🚂#16148

Open
jahorton wants to merge 2 commits into
epic/autocorrectfrom
change/web/transition-id-nomenclature
Open

change(web): polish documentation + uses of transition ID in predictive text 🚂#16148
jahorton wants to merge 2 commits into
epic/autocorrectfrom
change/web/transition-id-nomenclature

Conversation

@jahorton

Copy link
Copy Markdown
Contributor

Primary changes:

  • Drops the WET Suggestion.transformId field in favor of just reusing Suggestion.transform.id
    • Associated minor changes were needed in order to patch up the unit tests.
  • Updates documentation on .transform.id as a unique identifier of the transition, not specific to a single Transform.

Does not modify the .transform or .id properties because we've been publishing lexical model types, and that would change the public model API.

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

…ve text

- Drops the `Suggestion.transformId` field in favor of just reusing `.transform.id`
- Updates documentation on .transform.id as a unique identifier of the transition,
not specific to a single Transform.

Does not modify the `.transform` or `.id` properties because we've been publishing
lexical model types, and that would change the public model API.

Build-bot: skip build:web
Test-bot: skip
@keymanapp-test-bot

keymanapp-test-bot Bot commented Jun 26, 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")

@keymanapp-test-bot keymanapp-test-bot Bot changed the title change(web): polish documentation + uses of transition ID in predictive text change(web): polish documentation + uses of transition ID in predictive text 🚂 Jun 26, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S32 milestone Jun 26, 2026
@github-actions github-actions Bot added web/ common/ common/web/ web/predictive-text/ change Minor change in functionality, but not new labels Jun 26, 2026
Comment on lines +256 to 267
* Facilitates use of unique identifiers for tracking data about the context
* transition to which the Transform belongs. More than one Transform may
* hold the same `id` if they are alternate interpretations of the same
* transition event - say, the resulting effects of neighbor keys that may
* have been missed due to "fat fingering".
*
* Also note that the Transform reference cannot be preserved across WebWorker
* boundaries, but this ID may.
*
* This is *separate* from any LMLayer-internal identification values.
*/
id?: number;

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.

Would this be better named transitionId if it identifies the transition the transform belongs to? Transform.id suggests that it's the identifier of the transform itself.

Suggested change
* Facilitates use of unique identifiers for tracking data about the context
* transition to which the Transform belongs. More than one Transform may
* hold the same `id` if they are alternate interpretations of the same
* transition event - say, the resulting effects of neighbor keys that may
* have been missed due to "fat fingering".
*
* Also note that the Transform reference cannot be preserved across WebWorker
* boundaries, but this ID may.
*
* This is *separate* from any LMLayer-internal identification values.
*/
transitionId?: number;

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.

This is a publicly published api type for any potential Lexical Model, published via our NPM lexical-model-types package. I'd already be changing it if it weren't.

// used to add whitespace (if one existed), so reverting to the base ID's associated
// context also reverts the appendedTransform.
let originalTransition = this.contextTracker.findAndRevert(-reversion.transformId);
const baseTransitionId = -reversion.transform.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.

Why do we use the negated transform.id?

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.

Actual transition + transform IDs are always positive. Negating it indicates association with the original ID, but "reversal" - it "negates" an effect previously placed there.

There's a pretty decent chance we don't actually need to do the negation now, now that things have advanced a bit, but it's been a pattern since 12.0.

@mcdurdin mcdurdin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM; see @ermshiperete's questions. Appreciate the tightening up of the nomenclature.

IMHO, the most significant change here is the removal of Suggestion.transformId. I suggest that the title of the PR reflect that.

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