Skip to content

[lexical-y] A NodeState value set as a held composition ends is lost when a collaborator joins the held code line into the line before #9865

Open

Description

@zurfyx

Description

In the randomized carry lane (packages/lexical-y/src/__tests__/unit/LaneFuzz.test.ts), a NodeState value that the update ending a held composition sets does not stay on the characters it changed when a collaborator, concurrently, joins the held code line into the paragraph before it (Backspace at the start of the code block). The lane reports it as the known-open class carry:target-value (for example k-b (scalar, last set) on "C": "s1", intended "s3").

It reproduces on main (c4bfbfc) with no block added after the join, gc off and on. Histories that also add a block after the join used to hit other findings first on main (decorator-lost and others, because the old line's marker went to the added block, the bug #9860 fixes); with #9860 they reach this path too, so #9860 raises the class's known-open rate from 7.2 to 9.8 per 1,000 histories (71 more histories in 13,000 per gc setting, each of which fails identically on main without the added block).

Repro

LANE_STRICT=1 LANE_REPLAY=<file> pnpm exec vitest run --project unit packages/lexical-y/src/__tests__/unit/LaneFuzz.test.ts with this history (carry lane, seed 300269, gc off, untouched: 'none'):

{
 "cfg": {
  "codeInit": [
   "s2",
   "s2",
   {
    "a": 1
   }
  ],
  "format": [
   1,
   0,
   8
  ],
  "init": [
   [
    null,
    "s1",
    {
     "a": 1
    }
   ],
   [
    "s1",
    "s2",
    null
   ],
   [
    null,
    null,
    null
   ]
  ],
  "keys": [
   {
    "flatHl": false,
    "flatText": true,
    "name": "k-b",
    "shape": "scalar"
   },
   {
    "flatHl": false,
    "flatText": false,
    "name": "style",
    "shape": "scalar"
   },
   {
    "flatHl": false,
    "flatText": false,
    "name": "ownFoo",
    "shape": "object"
   }
  ],
  "ops": [
   {
    "e": 0.5039403676055372,
    "ki": 0,
    "kind": "set",
    "s": 0.31510786176659167,
    "val": "s3"
   }
  ],
  "ownFoo": [
   "pay2",
   "MISSING",
   "pay1"
  ],
  "split": [
   2,
   4,
   6
  ],
  "storedCls": [
   "plain",
   "cls",
   "plain"
  ],
  "style": [
   "",
   "",
   "color: red"
  ],
  "tokenizer": {
   "base": "Prism",
   "created": "cls",
   "kind": "preserve"
  },
  "decor": true,
  "deleteHeld": false,
  "hlScope": "all",
  "untouched": "none",
  "untouchedVals": [
   null,
   null,
   null
  ],
  "variant": "join"
 },
 "gc": false,
 "ids": [
  2,
  1
 ],
 "lane": "carry",
 "seed": 300269
}

On main:

target-value: k-b (scalar, last set) on "C": "s1", intended "s3"
target-value: k-b (scalar, last set) on "D": "s1", intended "s3"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions