Skip to content

Conversation

@jahorton
Copy link
Contributor

@jahorton jahorton commented Jan 21, 2026

Continuing from #15508, this defines a method useful for determining if one SearchQuotientNode is a 100% match and duplicate for another node. While .isSameNode is only leveraged in unit tests within this PR, it sees use in runtime code starting with #15031.

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

@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Jan 21, 2026

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 feat(web): add isSameSpace, enhances merging of previously-split tokens feat(web): add isSameSpace, enhances merging of previously-split tokens 🚂 Jan 21, 2026
@keymanapp-test-bot keymanapp-test-bot bot added this to the A19S21 milestone Jan 21, 2026
@jahorton jahorton force-pushed the refactor/web/complex-search-space-reuse branch from 403721b to fbe4bec Compare January 22, 2026 20:13
@jahorton jahorton force-pushed the change/web/add-same-edge-detection branch from a295e51 to bb2c119 Compare January 23, 2026 18:31
@jahorton jahorton force-pushed the refactor/web/complex-search-space-reuse branch from 1d44f26 to 6306f5e Compare January 28, 2026 17:15
@jahorton jahorton force-pushed the change/web/add-same-edge-detection branch from bb2c119 to e69bb62 Compare January 28, 2026 19:22
@jahorton jahorton changed the base branch from refactor/web/complex-search-space-reuse to feat/web/spur-edge-key January 28, 2026 19:22
@jahorton jahorton changed the title feat(web): add isSameSpace, enhances merging of previously-split tokens 🚂 feat(web): add isSameNode, enhances merging of previously-split tokens 🚂 Jan 28, 2026
@jahorton jahorton changed the title feat(web): add isSameNode, enhances merging of previously-split tokens 🚂 feat(web): add isSameNode for duplicate quotient-node detection Jan 28, 2026
@keymanapp-test-bot keymanapp-test-bot bot changed the title feat(web): add isSameNode for duplicate quotient-node detection feat(web): add isSameNode for duplicate quotient-node detection 🚂 Jan 28, 2026
@jahorton jahorton force-pushed the feat/web/spur-edge-key branch from 0c4a793 to 92546fa Compare January 28, 2026 21:36
@jahorton jahorton force-pushed the change/web/add-same-edge-detection branch from e69bb62 to 71df397 Compare January 28, 2026 21:36
@jahorton jahorton force-pushed the feat/web/spur-edge-key branch from 92546fa to 240b1f6 Compare January 29, 2026 17:57
@jahorton jahorton force-pushed the change/web/add-same-edge-detection branch from 71df397 to 1f4897f Compare January 29, 2026 17:59
@jahorton jahorton force-pushed the feat/web/spur-edge-key branch from 240b1f6 to 76b3479 Compare January 29, 2026 18:55
@jahorton jahorton force-pushed the change/web/add-same-edge-detection branch from 1f4897f to 56d7a8f Compare January 29, 2026 18:58
@keyman-server keyman-server modified the milestones: A19S21, A19S22 Jan 31, 2026
@jahorton jahorton force-pushed the feat/web/spur-edge-key branch from 76b3479 to 2127072 Compare February 5, 2026 16:38
@jahorton jahorton force-pushed the change/web/add-same-edge-detection branch from 56d7a8f to d4f3a18 Compare February 5, 2026 16:46
@jahorton jahorton force-pushed the change/web/add-same-edge-detection branch from d4f3a18 to 1755556 Compare February 5, 2026 16:48
if(this.model != space.model) {
return false;
}
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these not have parents to check for match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the 'root' node - there is no parent here.

Copy link
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@ermshiperete ermshiperete left a comment

Choose a reason for hiding this comment

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

LGTM

}

isSameNode(space: SearchQuotientNode): boolean {
// Easiest cases: when the instances or their ' `spaceId` matches, we have
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Easiest cases: when the instances or their ' `spaceId` matches, we have
// Easiest cases: when the instances or their `spaceId` matches, we have

Comment on lines +198 to +202
// We need to check if the parents match. Done naively in the manner below, this is O(N^2).
// Granted, we shouldn't have _that_ many incoming paths.
if(this.parents.find((path) => !space.parents.find((path2) => path.isSameNode(path2)))) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have to check that this and space have the same number of parents?

Suggested change
// We need to check if the parents match. Done naively in the manner below, this is O(N^2).
// Granted, we shouldn't have _that_ many incoming paths.
if(this.parents.find((path) => !space.parents.find((path2) => path.isSameNode(path2)))) {
return false;
}
if(this.parents.length != space.parents.length) {
return false;
}
// We need to check if the parents match. Done naively in the manner below, this is O(N^2).
// Granted, we shouldn't have _that_ many incoming paths.
if(this.parents.find((path) => !space.parents.find((path2) => path.isSameNode(path2)))) {
return false;
}

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.

4 participants