Skip to content

test(ui-test): press again the keys the IDE discards - #152

Merged
BartvHelvert merged 2 commits into
masterfrom
fix/escape-key-discarded-while-frozen
Nov 11, 2026
Merged

BartvHelvert merged 2 commits into
masterfrom
fix/escape-key-discarded-while-frozen

Conversation

@BartvHelvert

@BartvHelvert BartvHelvert commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

What this changes

Closes #113, and closes #153. The markdown cell's Escape is not lost by anything in CodeBridge — it is never
delivered, because the platform throws it away on purpose.

While the IDE waits on a lock it draws a freeze overlay, and for as long as that is up
SuvorovProgress installs an EventStealer whose IdeEventQueue post listener takes every key
press out of the queue and returns true. doPostEvent then drops the event before it is so much
as counted, let alone dispatched. SuvorovProgress never calls drainUndispatchedInputEvents, so
what it takes is gone. That is deliberate: a freeze must not end in a burst of input the user has
stopped meaning. The defaults make it ordinary —
ide.suvorov.progress.kind=[None|Bar|Overlay|NiceOverlay*],
ide.suvorov.progress.showing.delay.ms=1000.

The driver's robot posts into that same queue rather than driving the display
(driver.robot.use.input.events=true, which is also why the recorded pointer never moves off
960,540), so its keys are discarded alongside a user's.

That explains the one observation no other theory could. The stealer passes KEY_TYPED through
and takes only KEY_PRESSED and KEY_RELEASED. A character carries all three and the editor
inserts from the typed one, so typeText("# Top") lands and the readiness wait passes. Escape
carries no character, so it is taken whole — and the previous round's diagnostic had already shown
it reaching neither IDE's dispatcher with the cell focused, the frame focused, the robot holding
the input focus, no popup, no drag, and the client's EDT idle.

So pressing once and waiting cannot work: the key is gone, not late. pressUntil presses again
until the cell renders, which is what a user does when the IDE has eaten a keystroke. A key that
arrives and does nothing still fails at the timeout, having pressed rather than waited, so nothing
about what Escape is meant to do is hidden.

between is 15s, comfortably longer than rendering a cell, so a slow success is never pressed
over — a second press after the first has been acted on would be a keystroke the test never meant
to send.

The same key, in the snippet test

The second commit fixes a second site, found while reading #149's twenty-job batch. In
run 42728115535,
Snippet selection (windows-2025, repeat 8/10) observed
[first, PROBE Widgetbody {, , }] — body typed onto the end of the placeholder, the body
stop left empty. The Tab between them did nothing, after the step before had already confirmed
the typed placeholder on the backend.

Same signature, and the clearest confirmation of the mechanism outside the notebook: a key(...)
lost between two typeText(...) calls that both landed. key(VK_TAB) posts only KEY_PRESSED
and KEY_RELEASED, which is exactly what the stealer takes. Filed as #153.

There the Tab is pressed on its own, and waited on by the caret reaching the body stop, before the
body text is typed. That is also why pressUntil suits it: a Tab that never arrived can be
pressed again safely, whereas typing again would duplicate text.

Why a helper, and why it is not used everywhere

The hazard belongs to every synthetic keystroke in these tests, not to this one, so the reasoning
lives in one documented place rather than in a comment here. It is applied only at the site that
is known to fail; the rest are left alone rather than churned on a guess.

It may be worth re-reading some earlier fixes in this light —
989aec7 test(ui-test): choose switcher items without key input,
3cd7194 test(ui-test): activate cell menus with the keyboard,
740ddea test(ui-test): hand a page its undo keys on Windows — all worked around a key that did
not arrive. This is a mechanism that would produce exactly that, and
SplitModeSnippetsTest > a contributed snippet completes… is still failing intermittently. I have
not changed any of them: none has the evidence this one now has.

How it was tested

  • :ui-test:compileTestKotlin passes for both commits.
  • Not run locally: this machine cannot execute the downloaded JBR (exit value 127 under NixOS),
    and the failure has only ever appeared on CI.
  • The scenario failed 5 times in 22 runs before, and twice in the 11 runs of test(notebook): trace escape before keymap dispatch #135's diagnostic.
    Worth re-running the ci-flake/escape-* branches on this to confirm, rather than reading one
    green run as proof.
  • test(notebook): trace escape before keymap dispatch #135 carried the diagnostics that produced this; its question is answered, so it can be closed
    or trimmed to whichever of its readings are worth keeping.

Checklist

  • Nothing is special-cased for one extension.
  • A new feature has a UI test. A fix to an existing UI test.
  • No internal, override-only, obsolete or deprecated platform API. The fix reads no platform
    internals: SuvorovProgress and EventStealer are named in the explanation only, and the
    test presses a key through the driver as before.
  • docs/ is updated where behaviour changed, docs/status.md especially. No behaviour change.
  • Third-party material keeps its notice and is listed in NOTICE.md. None added.

The markdown cell's Escape never reached either IDE's key dispatcher,
with the cell's editor the focus owner, the frame focused, the robot
holding the input focus, no popup, no drag, and the client's EDT idle.
It was never delivered.

While the IDE waits on a lock it draws a freeze overlay, and for as
long as that is up `SuvorovProgress` installs an `EventStealer`, whose
`IdeEventQueue` post listener takes every key press out of the queue
and returns true, so the event is dropped before it is so much as
counted. It never puts them back. That is deliberate: a freeze must
not end in a burst of input the user has stopped meaning.

The driver's robot posts into that same queue -- it fabricates events
rather than driving the display -- so its keys are discarded with the
user's. The stealer passes `KEY_TYPED` through, which is why the
typing that goes in a second earlier lands and the readiness wait
passes; Escape carries no character, only `KEY_PRESSED` and
`KEY_RELEASED`, so it is taken whole and leaves no trace.

Pressing once and waiting cannot work, because the key is gone rather
than late. Press again until the cell renders, as a user does when the
IDE has eaten one. A key that arrives and does nothing still fails at
the timeout, so this hides nothing about what Escape is meant to do.

Closes #113
The snippet test sent Tab and the body text in one block. When the Tab
was discarded -- the IDE was waiting on a lock, so the freeze overlay's
stealer took the key press out of the queue -- the typing that followed
went in where the placeholder ended: `PROBE Widgetbody {`, with the
body stop left empty.

Press it on its own and wait for the caret to reach the body stop,
pressing again if it never arrives, before typing into it. Typing is
not affected, since a character carries the `KEY_TYPED` the stealer
leaves alone; see [pressUntil].

This is not #130, where the Tab arrived and overtook the typing. Here
the typing was already confirmed on the backend and the Tab did
nothing at all.

Closes #153
@BartvHelvert BartvHelvert changed the title test(notebook): press Escape again when the IDE ate it test(ui-test): press again the keys the IDE discards Nov 10, 2026
@BartvHelvert
BartvHelvert merged commit 283aa68 into master Nov 11, 2026
8 checks passed
@BartvHelvert
BartvHelvert deleted the fix/escape-key-discarded-while-frozen branch November 11, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snippet UI test's Tab can be discarded while the IDE waits on a lock Esc in a notebook markdown cell sometimes leaves it unrendered

1 participant