Skip to content

Conversation

@jahorton
Copy link
Contributor

@jahorton jahorton commented Oct 22, 2025

Upon investigation into the code being removed, multiple paths to the same search correction mostly occur whenever an empty transform appeares in the input - during a context reset, at initialization, or when a deadkey is typed. (Deadkeys aren't sent to the pred-text engine.) This is generally not a common case within the engine, and even then, there exists other filtering to prevent displaying duplicated search results to our users.

Suppose a token that begins tagged with an empty transform. When the search performs an 'insertion' to better lookup words down a lexical path, the 'insertion' is identical whether before or after an empty transform. Similarly, insertions after a deletion appear no different than substitutions (or the same insertion before the deletion, then the deletion itself).

The prior anti-duplication code likely didn't gain us much, as it likely carried some performance overhead - it built a large object that required memory and lookup time that involved constructing and processing strings for hashing.

This change is not actually dependent on autocorrect and could easily be 🍒-picked to master if we so desire. It's here largely because the changes made here also helps with streamlining the SearchPath / SearchSpace / etc rework happening on epic/autocorrect.

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

@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Oct 22, 2025

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): remove duplicate correction-search path filtering change(web): remove duplicate correction-search path filtering 🚂 Oct 22, 2025
@keymanapp-test-bot keymanapp-test-bot bot added this to the A19S14 milestone Oct 22, 2025
@github-actions github-actions bot added web/ web/predictive-text/ change Minor change in functionality, but not new labels Oct 22, 2025
@jahorton jahorton force-pushed the change/web/remove-duplicate-path-filtering branch from 8af2407 to 3f3382a Compare October 22, 2025 20:59
@darcywong00 darcywong00 modified the milestones: A19S14, A19S15 Oct 24, 2025
@jahorton jahorton force-pushed the refactor/web/search-batcher branch from fac1c30 to 9920f5e Compare October 27, 2025 19:04
@jahorton jahorton force-pushed the change/web/remove-duplicate-path-filtering branch from 3f3382a to 1f3b029 Compare October 27, 2025 19:07
@keyman-server keyman-server modified the milestones: A19S15, A19S16 Nov 8, 2025
@jahorton jahorton force-pushed the refactor/web/search-batcher branch from 9920f5e to 7e5d78c Compare November 10, 2025 18:40
@jahorton jahorton force-pushed the change/web/remove-duplicate-path-filtering branch from 1f3b029 to 9c197bd Compare November 10, 2025 18:44
@jahorton jahorton changed the base branch from refactor/web/search-batcher to feat/web/search-space-identifiers November 10, 2025 18:44
@jahorton jahorton marked this pull request as ready for review November 12, 2025 20:00
Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

Apart from the negatively-named variable, the rest looks fine. Approving with the inversion of the variable name please (and obviously fixing up usage)

* Notes if the most recent edit processed in the node's represented search path
* was not a deletion. Root nodes are considered to meet this condition.
*/
readonly nonDeletion: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid variables with negative names:

Suggested change
readonly nonDeletion: boolean;
readonly isDeletion: boolean;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #15399.

@keyman-server keyman-server modified the milestones: A19S16, A19S17 Nov 22, 2025
@keyman-server keyman-server modified the milestones: A19S17, A19S18 Dec 6, 2025
@keyman-server keyman-server modified the milestones: A19S18, A19S19 Dec 21, 2025
@keyman-server keyman-server modified the milestones: A19S19, A19S20 Jan 3, 2026
@jahorton jahorton marked this pull request as draft January 5, 2026 17:48
@jahorton jahorton force-pushed the feat/web/search-space-identifiers branch from d2d5c67 to 43f5498 Compare January 5, 2026 21:25
@jahorton jahorton force-pushed the change/web/remove-duplicate-path-filtering branch 2 times, most recently from 86fc4ef to 8043ef3 Compare January 6, 2026 18:01
Upon investigation into the code being removed, this mostly triggered whenever an empty transform appeared in the input - during a context reset, at initialization, or when a deadkey is typed.  (Deadkeys aren't sent to the pred-text engine.)  This is generally not a common case within the engine, and there exists other filtering that helps prevent duplicating search results.

Suppose a token that begins tagged with an empty transform.  When the search performs an 'insertion' to better lookup words down a lexical path, the 'insertion' is identical whether before or after an empty transform.  Similarly, insertions after a deletion appear no different than substitutions (or the same insertion before the deletion, then the deletion itself).

The code likely didn't gain us much, as it likely carried some performance overhead - it built a large object that required memory and lookup time that involved constructing and processing strings for hashing.

Build-bot: skip build:web
Test-bot: skip
@jahorton jahorton force-pushed the feat/web/search-space-identifiers branch from f26fd31 to db77619 Compare January 9, 2026 16:59
@jahorton jahorton force-pushed the change/web/remove-duplicate-path-filtering branch from 0bc1f96 to 4f98dbf Compare January 9, 2026 17:03
@jahorton jahorton marked this pull request as ready for review January 14, 2026 21:27
@keyman-server keyman-server modified the milestones: A19S20, A19S21 Jan 16, 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.

5 participants