Skip to content

macOS engine: type_text's plain read-back can confirm one key early when inserted text coincides with the typed text (needs #414's dwell) #421

Open

Description

@SSFSKIM

Problem

#354's value read-back confirms as soon as a poll reads the expected value. Keys are posted 250 µs apart, so the poll can run while the app is still draining its queue. Usually that is harmless: before the last key is consumed, no value equals the expected one. But it can be harmful when text the app inserts on its own coincides with the typed text.

Example. Literal "zz" typed into an empty plain field whose page prepends a "z" on the first key. Before the last key lands, the field reads exactly "zz". The poll accepts it, and the call confirms. When the last key lands, the field holds "zzz".

#414 found and closed the same race for password fields' length confirmation. See ruling 1ea561bc:842, and the hosted AppKit and Electron reproductions in #414's qualification. Its fix is a quiet window: a match confirms only once the same reading has held for typeReadbackLengthDwellMs, sized from the measured per-lane drain gaps. Any change in the window means unconfirmed.

What to do

Apply the same dwell to the plain path's equality match:

  • concealed and literal requests;
  • checkpoints before a Tab or Return.

Reuse #414's constant and loop: one 5 ms poll inside the 1 s budget, so the plain path's schedule stays independent of the secret. A plain field's value moves on from a final match only if something changed it, so a change in the window is a mismatch, as on the password path.

Cost: one dwell of latency on every confirmed type_text.

Check

  • Stub: a field that prepends a character and drains its last key late confirms on main and answers unconfirmed with the fix, both literal and concealed.
  • Hosted: a synchronous-insert fixture on CfT and AppKit gives 0/20 confirmations.
  • No regression: ordinary plain typing still confirms 20/20.

Found by #414's review round 3.

Activity

  1. added
    bug
    status:ready-for-implementer
    priority:P3
    on Nov 18, 2026
  2. SSFSKIM commented on Nov 18, 2026

    @SSFSKIM
    OwnerAuthor

    Related, from #414's final report: #354's plain-field focus check (readbackStillFocused, unbounded) treats any failed read as a moved focus (fieldChanged). #414 found the same shape on its concealed path, where a final focus call that never went out answered fieldChanged on 78/150 exact controls, and fixed it with a three-state check: focused, moved (needs a positive answer) or unknown (the check couldn't finish; it never confirms, and the reason comes from the last reading). When this ticket adds the dwell to the plain path, adopt the same three-state focus check there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P3status:ready-for-implementer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions