Regression test for the zero-length-emit tile corruption (companion to #84) #85

Closed
StoneCypher wants to merge 1 commit from StoneCypher/view:test-tile-corruption-regression into main
First-time contributor

Optional companion to #84 -- a regression test for the tile-tree corruption
that PR fixes. Kept as a separate PR so it can be adopted (or not)
independently of the fix.

Why it's a Node-side test, not a webtest

The corruption only reproduces under trusted input (a real drag).
Synthetic DOM events and programmatic dispatch({selection}) do not trigger
it, so an in-page webtest-* cannot catch it. This is a test-* (Node-side,
run by cm-runtests via Mocha) that drives a real pointer through Selenium's
Actions API. selenium-webdriver is already a dependency of
@marijn/testtool, and it needs a Chrome/chromedriver like the webtest suite.

What it checks

It builds a view with a whole-document mark (a lint diagnostic with no source
position) plus highlightActiveLine, performs a real drag-select + blank-line
click, and asserts the tile invariant:

state.doc.length - docView.tile.length

0 for a healthy tree; > 0 once a line's tile is dropped.

Status

  • Red against current main (the bug is still present) -- by design; this
    is the reproduction.
  • Green with #84 applied.

So the intended order is: merge #84, then this. Merging this alone will (
correctly) fail CI until the fix lands.

Notes

  • The file carries // @ts-nocheck: Node builtins and selenium-webdriver
    are untyped in this repo (no @types/node / @types/selenium-webdriver), so
    the Node-side test is transpiled, not type-checked. It compiles cleanly
    through cm-buildhelper as-is. Happy to type it properly instead if you'd
    prefer adding those dev types.
  • The gesture is probabilistic per click (~50%); the test runs a few fresh
    loads and stops at the first observed deficit, so it's fast when red and
    runs the full budget (~30s) when green.
Optional companion to #84 -- a regression test for the tile-tree corruption that PR fixes. Kept as a separate PR so it can be adopted (or not) independently of the fix. ## Why it's a Node-side test, not a webtest The corruption only reproduces under **trusted** input (a real drag). Synthetic DOM events and programmatic `dispatch({selection})` do not trigger it, so an in-page `webtest-*` cannot catch it. This is a `test-*` (Node-side, run by `cm-runtests` via Mocha) that drives a real pointer through Selenium's Actions API. `selenium-webdriver` is already a dependency of `@marijn/testtool`, and it needs a Chrome/chromedriver like the webtest suite. ## What it checks It builds a view with a whole-document mark (a lint diagnostic with no source position) plus `highlightActiveLine`, performs a real drag-select + blank-line click, and asserts the tile invariant: ``` state.doc.length - docView.tile.length ``` 0 for a healthy tree; > 0 once a line's tile is dropped. ## Status - **Red against current `main`** (the bug is still present) -- by design; this is the reproduction. - **Green with #84 applied.** So the intended order is: merge #84, then this. Merging this alone will ( correctly) fail CI until the fix lands. ## Notes - The file carries `// @ts-nocheck`: Node builtins and `selenium-webdriver` are untyped in this repo (no `@types/node` / `@types/selenium-webdriver`), so the Node-side test is transpiled, not type-checked. It compiles cleanly through `cm-buildhelper` as-is. Happy to type it properly instead if you'd prefer adding those dev types. - The gesture is probabilistic per click (~50%); the test runs a few fresh loads and stops at the first observed deficit, so it's fast when red and runs the full budget (~30s) when green.
A Node-side test (run by cm-runtests via Mocha) that drives a real drag
through Selenium's Actions API against the built module. The corruption
only fires under trusted input, so it cannot be reproduced by an in-page
webtest (synthetic events and programmatic dispatch do not trigger it);
this drives real pointer input instead. selenium-webdriver is already a
dependency of @marijn/testtool.

It asserts the tile invariant state.doc.length - docView.tile.length:
0 for a healthy tree, > 0 once a line's tile is dropped. Currently fails
against main (which still has the bug) and passes with the openWidget fix
applied.
Owner

Thanks for the

Thanks for the
marijn closed this pull request 2026-07-06 08:53:48 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/view!85
No description provided.