Skip to content

#171 M2: text and clipboard through one verified paste route; linux-engine-v0.2.0 - #233

Merged
SSFSKIM merged 43 commits into
mainfrom
feat/171-m2
Oct 30, 2026
Merged

SSFSKIM merged 43 commits into
mainfrom
feat/171-m2

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Part of #171 (M2 of the own-Linux-engine spec; the ticket stays open until M6b).

M2 of the own-Linux-engine spec: text and clipboard through one verified paste route in cua's own Linux engine, released as linux-engine-v0.2.0. The default Linux engine stays vendor. cua's engine runs only when CUA_NATIVE_ENGINE=cua (or "engine": "cua" in ~/.config/cua/engine.json) selects it.

  • The clipboard core (M2.1, native/linux-engine/src/clipboard/):
    • the CLIPBOARD owner, with its targets and INCR serving;
    • the two-selection lock (CUA_CLIPBOARD_LOCK, then the vendor's SKY_CLIPBOARD_LOCK);
    • the bounded snapshot, the serving generations and the guarded cleanup;
    • clipboard_read and clipboard_release, and the 64 MiB limits.
  • The paste route (M2.2): type_text and clipboard_write through the design's six steps.
    • The field is observed, the chord dispatched once, and the result confirmed. The prior clipboard is restored only when the engine still owns it.
    • Answers come in three outcomes, with their sentences.
    • Each family's chord and verified route live in families.rs. GTK 4 takes the foreground route in dedicated mode only; xterm is refused.
    • type_characters follows the newest vendor build's rules.
    • Every request records its route on --stats.
  • The branch review's two fixes in the engine:
    • The take checks CLIPBOARD's owner generation (XFIXES) atomically under a server grab, so a copy made after the snapshot is never overwritten.
    • The 10 s window after an unconfirmed paste is display-wide: a root-window property, CUA_CLIPBOARD_QUARANTINE, that outlives the engine that set it.
  • The differential harness's text proof (M2.3), on Linux only:
    • text scenes and paste safety cases, and gnome-terminal in the family matrix;
    • a witness keyed to the route the harness expects, with restack, focus and activation events recorded in order, and a foreground audit;
    • an effect required on every text sample;
    • Acceptance 3's bounded noise rule, and desktop groups topped up to 20 fresh-engine samples.
  • The facade suites' text cases are positive: scripts/repl-parity.mjs --suite native and scripts/native-baseline.mjs.
    • M1b's temporary candidate expectations are removed.
    • The vendor engine's x64 failure is declared.
    • scripts/accept/linux-native.mjs types with typeText.
  • Docs: node --test runs name test files by glob, not the bare directory (a28617a).
  • Evidence: docs/evidence/2026-10-28-own-linux-engine/m2/.

What 0.19.0 changes on macOS

The plugin bumps to 0.19.0, and the marketplace updates every Mac's installed plugin. On macOS it changes exactly this:

  • The version numbers. .claude-plugin/plugin.json and .claude-plugin/marketplace.json go from 0.18.0 to 0.19.0.

Nothing else reaches a Mac:

  • Unchanged: cua serve, install, doctor, the host, browser routing, secrets, the sandbox, runtime pins, hooks, skills and the extension.
  • Linux-only: the engine, the differential harness, the Linux acceptance fixture, the native Linux scenarios and the evidence. The Linux engine pin (runtime/engine/linux-engine.json) moves to 0.2.0; macOS installation and selection never read it.
  • Internal: the shared parity and comparison tooling and its tests. That covers the removal of candidateExpectations from parity bookkeeping, the stronger Linux engine declarations, the Linux baseline's text requirements, and the test-command globs in docs.

The whole-branch review checked this inventory against the full changed-file list.

Validation Evidence

  • The release: linux-engine.yml was dispatched with publish: true on the reviewed head 8b49b68.
  • Acceptance 9 (x86-64), fresh CUA_HOME:
    • cua install --engine printed installed cua's Linux engine 0.2.0 (linux-engine-v0.2.0) at <home>/engine/linux/cua-engine.
    • file reports static-pie linked.
    • --version reports cua-engine 0.2.0 (8b49b6825ae5), and sha256sum equals the pin.
    • CUA_NATIVE_ENGINE=cua cua doctor reports PASS engine … the pinned cua-engine 0.2.0 (linux-engine-v0.2.0) … SHA-256 2a0036ac….
    • The arm64 install is M5's, on the arm64 VM. The release tested that asset natively on ubuntu-24.04-arm.
  • Acceptance 1: CUA_NATIVE_ENGINE=cua node scripts/accept/linux-native.mjs on the installed engine, with no CUA_LINUX_ENGINE_BIN, → PASS, 11/11 steps. The marker was typed with typeText and read back once.
    • A 50 ms process sampler (3,369 samples) saw at most 0 sky_linux processes.
    • The one cua-engine was ~/.local/share/cua/engine/linux/cua-engine, a child of src/repl-host/trusted-worker.mjs (m2/release/).
  • Acceptance 6, and 2–5 for the text and clipboard commands: the differential verdict run m2-final on the build being released → run valid; every verdict PASS, exit 0 (m2/diff/).
    • The text of Acceptance 6 was read back exactly in gedit, Chrome's textarea and gnome-text-editor (dedicated), and its single line in the address bar.
    • cua made 0 PasteText, InsertText and SetTextContents calls.
    • cua was at or below the faster vendor build on every text and clipboard command. gedit type_text was 166 ms warm against the newest build's 924, and the pinned build failed after 10.2 s. clipboard_release warm passed as same within noise, interval [0, 0.04] ms under the 1 ms bound.
    • Every desktop group was judged on 20 or more fresh-engine samples an engine.
    • All 20 paste safety-case trials passed: a focus change, an external takeover, a silent owner, concurrent pastes, lock contention, a late page, an ignored page, a stalled INCR transfer, a late conversion, an unreadable field, a placed caret, and a refused restore.
    • The witness's negative controls failed as they should: a raise-and-restore, the same coalesced under a server grab, and a focus-and-activation switch under a grab.
    • The family matrix is complete, with Acceptance 5 holding on every family.
  • Acceptance 10's facade suites, on the build being released (m2/parity/, m2/baseline/):
    • repl-parity native: the vendor lane is RECORDED_VENDOR_DEFECT (the two declared x64 text cases), the cua lane PASS with 33 cases (the text cases positive), and the diff ok with 0 differences.
    • native-baseline compare --engines → VERDICT: PASS: typeText 169 ms against the vendor's 10.2 s failure, the gedit tree read 96 ms against 519.
  • Unit and live tests:
    • engine: cargo test --release 166 passed; under Xvfb with --features live, 198/198 unit and 19/19 integration;
    • harness: node --test test/linux-engine-diff/*.test.mjs 169/169;
    • xprobe: 8/8.
      The engine fixes' regressions failed against the earlier code and pass now.
  • npm test on the VM (M2.3's run): the failures match the base apart from two names that are flaky at the base too. They come from macOS-only fixtures and this VM's umask 077 (npm test on Linux VMs: ~50 cases fail on umask 077 and macOS-only fixtures (local check unusable) #232). The hosted macOS test gate passes.
  • CI: ci-gate on the PR head 95df423 → GREEN, all five gates PASS (test, sandbox-live, engine-linux, plugin, parity-browser), https://github.com/SSFSKIM/cua/actions/runs/41092463164.
  • Reviews:
    • Each of the three loop tasks was reviewed clean by the task reviewer: M2.1 after three fix rounds, M2.2 after one, M2.3 after two.
    • The whole branch was reviewed by doperpowers:reviewer-high (7023047..a422ebf). Its first verdict was "incorrect": two clipboard faults and two harness gaps, each reproduced on a private Xvfb. After the fixes, the re-review of 1ea029a..8b49b68 was "correct" with no material findings, and it checked m2-final's recorded engine hash against the build.
    • The design session checked the fixes' design choices.

Unresolved Review Findings

  • GTK ATK_IS_TEXT criticals on an unreadable field (native/linux-engine/src/field.rs, observe on an element without the Text interface).
    • The engine reads Text methods before knowing the interfaces, and GTK prints criticals. The answer is still right (no text, so unconfirmed).
    • Left because checking the interfaces first costs one more serial bus call on every first observation.
    • Raised by the M2.3 task review and kept deferred by the branch review.
  • The M2.1 clear-race test's timing-based rendezvous (native/linux-engine/src/clipboard/tests.rs). Being timed rather than synchronized, it could fail on a loaded runner; it passed in every engine-linux gate run of this branch. Kept deferred by the branch review as nonblocking.

Residue

  • Chrome drops the focusing click on its address bar, 1 in 18, root cause unknown. It happened on cua's cold paste into the address bar right after another engine's pastes into another window of the same Chrome. The engine now clicks at most twice, with nothing sent before the field has focus. Finding the cause would let the engine drop the second click, or find a state it should avoid (spec, Surprises, M2.3).

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)

…ute lands in M2's engine, the facade's dedicated-mode case with M3)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…Acceptance 6's dedicated case through the facade (design session)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…nd clipboard_release

The engine gets its clipboard (native/linux-engine/src/clipboard/), on connections of its own:

- the display's lock: CUA_CLIPBOARD_LOCK, then the vendor's SKY_CLIPBOARD_LOCK, each a compare-and-set under a
  server grab with the owner read again, retried every 5 ms for at most 5 s, else `clipboard busy`;
- the snapshot within its bounds (500 ms for TARGETS, 500 ms per format's first answer, 2 s between INCR chunks,
  5 s overall, 64 MiB), the owner unchanged throughout;
- the persistent CLIPBOARD owner and its thread: text as UTF8_STRING, text/plain, text/plain;charset=utf-8 and
  STRING for Latin-1 text, snapshots format by format, INCR above 64 KiB, a transfer dropped after 2 s without a
  chunk or past 10 s;
- serving generations: after a paste's cleanup its own timestamps, and CurrentTime for 10 s after an unconfirmed
  paste, are refused, so a late requestor never receives the restored snapshot as the paste;
- the guarded cleanup on every exit path, which never calls SetSelectionOwner: it serves the snapshot while the
  engine still owns CLIPBOARD and does nothing after a SelectionClear;
- the handles: the vendor's name, 32 at most, 256 MiB.

clipboard_read copies through the window's focused element (copy.rs: EditableText.CopyText of its one selection,
else its context menu's Copy item), then snapshots CLIPBOARD under a handle; clipboard_release frees one. The paste
route (type_text, clipboard_write) is M2.2's, on this core.

Tests: unit tests for the serving rules, handles, the menu label and the focus walk; live tests with hostile X
clients (a silent owner, an owner stalling mid-INCR, a requestor stalling INCR acknowledgements, a requestor delaying
its ConvertSelection, an external takeover, engines contending for the lock), and clipboard_read over the wire on
the gate's yad window.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
On the CI runner the yad window came up without the input focus, so its text view had no focused state and
clipboard_read answered "window <id> has no focused element to Copy from" (engine-linux, run 40979628268). Copy goes
through the window's focused element, as the vendor's does; the test now activates its window on its own display
and waits for the text view to report the focus before it copies.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…onfirmed window, the clipboard core's choices)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…'s X client; its refusal a declared deviation (design session)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ver race and refusal eviction

The task review of 125c876 found four places where the core's safety guarantees did not hold:

- The snapshot's 64 MiB cap: an INCR owner could send a byte past the remaining budget, and the next format's
  budget would underflow. Every property read now asks for one unit more than the budget allows and refuses
  anything over it, and the budget is subtracted checked.
- The cleanup's estimate of the server's time started its clock after the ownership timestamp was read, so a pause
  in between ended the refused window early. The clock now starts before the timestamp is read, and the estimate
  errs late (plus 1 ms and one per thousand for drift).
- A SelectionClear handled late could mark a new paste's ownership lost after the engine had taken CLIPBOARD back.
  The owner thread now takes CLIPBOARD itself, at the request thread's asking, so a take and a clear never
  interleave.
- After 32 cleanups the oldest paste's timestamps were served again. Older pastes now merge into one refused span,
  from the oldest merged ownership to the newest merged cleanup (at most half the server clock), with their
  CurrentTime refusal kept.

Watch also lists each request with its requestor window, target, time and outcome, for M2.2's attribution to the
target's X client. A TARGETS conversion the server refuses because the owner has just gone now reads as a change.
The lock-contention test keeps both engines alive until both finish: an engine's exit took CLIPBOARD down under the
other's snapshot.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…me; an abandoned take is cleaned up

- A paste merged out of the 32 kept generations kept only its ownership-to-cleanup span and lost its explicit
  Ctrl+V timestamp, which comes from the input session's own clock and can fall just outside that span. The merged
  span now widens to the Ctrl+V's time. Which of two times is earlier is judged only for times within 60 s of each
  other; beyond that, the paste merged later counts as the later one.
- A take whose caller stopped waiting after the owner thread had dequeued it could still take CLIPBOARD later, with
  no Paste to clean it up: its text could be served indefinitely and the snapshot was never restored. A take now
  carries its own token and restore. An abandoned take that completes runs the guarded cleanup itself, and an
  outcome is matched to its take by token.
- The clear-race test waits for the owner thread's signal that it reached the pause before it asks for the retake,
  instead of sleeping. Tests wait 1 s for a take, not 5 s.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…d; snapshots use only settled content

An abandoned take set the shared content to its payload before it took CLIPBOARD and checked whether its caller had
gone. Meanwhile the snapshot's fast path, which trusted any content while the engine owned CLIPBOARD, could copy the
abandoned text, and the next paste then restored it as the person's clipboard.

- The owner thread now takes CLIPBOARD and reads it back first. It then decides and publishes the take's outcome in
  one step under the lock: content, the active generation and ownership together. An abandoned take never
  publishes its payload; its cleanup serves its snapshot.
- While a take is pending or settling, the snapshot's fast path waits for it, at most the TARGETS bound. It trusts
  only a settled generation's content: owned, with no paste being served.
- `Clipboard::owns` reads ownership directly instead of through the fast path.

Regression: a snapshot taken while an abandoned take sits between taking CLIPBOARD and its outcome holds the original
clipboard, and the next paste restores the original.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…s M2.2 relies on)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
cua's Linux engine answers type_text and clipboard_write through one route on
M2.1's clipboard core: observe the field (inside the window's input session),
click a named element only when it lacks the focus and put its caret or
selection back, take the lock, snapshot and own CLIPBOARD, revalidate the field
and the desktop focus, send the family's paste chord once, confirm the inserted
segment (20 ms polls, 2 s), and end through the guarded cleanup. Answers:
success, a refusal with nothing sent, or "Paste was sent once and could not be
confirmed; read the field before retrying".

- families.rs: each family's paste route and ignored input kinds with their
  conditions (GTK 4 by ToolkitName and Version 4.x ignores the chord; VTE pastes
  with Ctrl+Shift+V; xterm has no verified route; Gecko's U+FEFF after
  characters beyond the BMP).
- The paste kind's foreground route in --desktop dedicated mode (activate, then
  XTEST), refused in shared mode with the Device mode sentence.
- The CurrentTime window opens only for an unconfirmed paste whose Ctrl+V went
  out and whose target's X client was not served in full; while it runs a new
  paste is refused (declared in deviations.mjs).
- Text over 64 MiB is refused before anything is sent.
- clipboard_read closes a context menu it opened that has no Copy (Escape).
- tests/live.rs: the gate's paste assertions (Unicode type_text, a preselected
  range replaced, the clipboard restored, clipboard_write read back, a named
  element landing at its own caret, a third client's read neither starting nor
  completing the paste).

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…signed, the dedicated-mode witness)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…indowless paste's six steps (design session)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…n on the stats line

type_characters {window, text} types the characters the keyboard layout
produces at level 1, or level 2 with Shift_L (letters included), as the newest
build does: its session opens, the whole text is resolved before any key, and
the first character it cannot produce (a control character, a keysym on no
key, one only at AltGr's level) refuses the text with
"Character '<c>' is not on the keyboard layout", nothing typed. It answers the
number of characters sent.

- families.rs lists the keys kind for GTK 4 and xterm; the route choice is
  shared with the paste route (engine/way.rs): refused in shared mode, the
  foreground route in dedicated mode. type_characters reads it; press_key
  from M3.
- Every paste and type_characters records the route it took ("route" on the
  --stats line), for the dedicated-mode witness keyed to it.
- A windowless type_text finds the focused top-level window when no window
  manager set WM_STATE; a live test shows it runs the six steps.
- The events experiment judges six type_characters scenarios against the
  newest build: the same events, the refusal sentence declared.
- type_characters leaves the harness's refusals.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…d; the route on the stats line

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ted; the confirmation bounded by its deadline

The paste chord's keys are pressed one at a time. Only a press the X server
answered with an X error naming it (so the chord's last key never arrived)
answers "nothing was pasted". A press whose acknowledgement never came (a lost
connection) may have arrived: the paste counts as dispatched, goes through
confirmation, and when unconfirmed takes the unconfirmed cleanup with its
CurrentTime window. Every key that may be down is released, an unacknowledged
one included, a failed release tried once more, no press sent again; a key
still held is reported in the answer, success included.

The confirming read waits no later than the 2 s deadline (Bus::calls_until,
an absolute deadline whatever the bus's silence timeout, late replies
discarded), and its result counts only if it came before the deadline.

Tests: fault injection on both routes' key sends (test builds only), with
live tests for a lost acknowledgement of the V and of the Ctrl, a rejected V
and a failing release; a bus provider whose reply trickles past the deadline;
a confirming GetText delayed past it. The request log now names each
requestor window, for the attribution evidence.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… releases reported, the absolute confirmation deadline)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ery milestone (design session)

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ectory

Since Node 21, `node --test` takes each argument as a file or a glob, so a bare
directory fails with MODULE_NOT_FOUND, and executors keep copying that form. The
commands in the M9 Chrome evidence, the browser-service and REPL-host specs, and
the run comment of the original-Chrome prototype tests now use
`<dir>/*.test.mjs`. Run once each: the prototype tests 41/41, browser-parity
280/280, repl-parity 674 of 677 (the two failures are environment ones the base
has too, #232). The two lines that record the old failure keep it.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
… and VTE in the matrix

The harness now proves the text and clipboard commands (Acceptance 2-6) the way
it proves the rest, and M1a's refusals leave deviations.mjs.

- Text operations (text.mjs) on each engine's own window: type_text into gedit,
  the textarea page, a Chrome address bar (single line, read back exactly) and
  gnome-text-editor (cua in dedicated mode, the foreground route); a
  preselected range replaced; type_characters; clipboard_read, clipboard_write
  and clipboard_release on gedit. Each sample's prior clipboard is the
  harness's own (xprobe clip-own), the field is read through AT-SPI, and the
  clipboard after the request is read with a real timestamp (xprobe
  clip-read). The bar comes from the vendor samples that succeeded; cua must
  answer success, take effect and keep the clipboard on every sample.
- The witness keyed to the route the engine reports: a foreground request may
  activate its target and move the pointer, nothing else, nothing after it,
  no grab left; dedicated gedit takes the background route and must leave the
  witness clean.
- A bus pass per text operation and engine counts PasteText, InsertText and
  SetTextContents; cua's must be 0.
- Paste safety cases (safety.mjs), cua alone: a focus change during the
  snapshot, the same with an external takeover, concurrent pastes, lock
  contention, a late-applying page, an ignored paste, a stalled INCR
  requestor, late conversions, an unreadable field (pages/paste-target.py, a
  GTK 3 window whose conversions the harness controls), a placed caret, and
  gnome-text-editor's refused restore.
- deviations.mjs: M1a's text and clipboard refusals removed; cua's success
  where no vendor build applies text, and clipboard_write's restore, declared.
- The family matrix: gnome-terminal joins, and cua's type_text runs beside the
  vendor builds'.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
With M2's paste route, cua's engine types into gedit, so the facade suites
stop accepting M1b's temporary refusal and ask for the real outcome.

- repl-parity's native text cases (typeText, paste) now require a successful
  return, the marker exactly once in the window's text and the window alive.
  The x64 vendor engine's failure of them (`editable Paste did not insert text`
  after its 10 s PasteText attempt, the marker absent) is declared as its
  defect; arm64's outcome is measured and declared at M5.
- M1b's temporary candidate expectations and the baseline's method-case
  outcomes (until M2) are removed from expected/native-linux.json and the code
  that read them; the diff between the two engine lanes accepts exactly the
  declared vendor defect against cua's pass on the two cases.
- native-baseline compare --engines: every cua typeText and paste sample must
  return without an error, survive and read back; the ordinary better-outcome
  rule accepts the improvement over the vendor engine, with no waiver.
- scripts/accept/linux-native.mjs types its marker with typeText and reads it
  back exactly once.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
M2's engine (the verified paste route, the clipboard commands and
type_characters) is released as linux-engine-v0.2.0; this is the version the
release workflow builds from the reviewed head. The plugin takes the next minor,
since the release changes what `cua install` installs on Linux.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…given back after a foreground paste

safety-judge.mjs holds the pure judges and sentences, safety.mjs the cases that
run, as matrix-judge.mjs and matrix.mjs divide the matrix. After a
gnome-text-editor sample, whose foreground route leaves its window active, the
harness's front window takes the focus back outside every span, so later
operations still address background windows.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…y no longer stops the run

- silent_owner (chrome-textarea): the prior owner never answers the engine's
  snapshot TARGETS (xprobe clip-own's new `silence`). cua refuses within the
  bound with `clipboard capture timed out: …; nothing was sent`, the field
  unchanged, and the next paste goes in, so both locks were released.
- The handle that clipboard_write and clipboard_release need is read with a
  companion clipboard_read, tried twice. In the first verdict run the pinned
  build's Copy failed in its own gedit window ("editable element has no
  selected text to Copy") and the exception ended the run. Now such an engine
  is sent a handle it never issued, and its sample records why
  (`prepare_error`). A candidate failing there still fails its verdict.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…e focusing click's latency on the stats line

The first full M2 verdict run failed two cells:

- clipboard_release, warm 0.12 ms against the bar's 0.11. A release is a map
  removal in every engine; at a sustained rate cua answers in 0.0424 ms
  against 0.0418 and 0.0446 for the vendor builds (1,500 samples each). The
  differential verdict now applies Acceptance 3's rule: a median above the bar
  whose bootstrap 95% interval of the median difference includes 0 passes as
  "same within noise", listed with its interval, when both sides have at least
  20 samples in the series. clipboard_release takes 10 warm samples a block so
  that its warm series has them.
- One cold address-bar paste of 18 answered `element did not take the focus
  when clicked; nothing was sent`: the address bar did not report the focus
  within 500 ms of the focusing click. 60 later address-bar pastes, 30 of them
  cold, saw the focus 10-21 ms after the click. The engine now records that
  time (`paste.focus_ms` on the --stats line), so a recurrence shows how long
  it took. A settle before the click was tried and dropped: the address bar
  never reported the focus before a click in 36 tries.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
The differential run's address-bar case failed the same way in two full
sittings and in a reduced one: in block 2, where cua's cold paste into its
window's address bar follows the newest vendor build's pastes into another
window of the same Chrome, the focusing click never gave the address bar the
focus. The answer was `element did not take the focus when clicked; nothing
was sent`, and with a 3 s wait instead of 500 ms the focus still never came.
Every other address-bar paste saw the focus 9-27 ms after its click.

The paste route now makes the focusing click once more when the focus has not
shown after the 500 ms wait (`click_for_focus`, at most two clicks). The
second click comes after the wait, past any double-click time, and nothing
has been sent yet, so it risks nothing the first did not. With it, the
reduced sitting's block-2 paste took the focus 37 ms after the second click
and landed exactly. The --stats line records `paste.clicks` and
`paste.focus_ms`.

Tests (unit, test-first): a dropped first click is repeated once, past the
double-click time; never a third click; a click that focused is not
repeated; a refused click ends the request. With one click allowed, both
failed.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…oard commands, on x86-64

On the #171 VM, the engine at e0168c6 (cua-engine 0.2.0, the local build
before the release):

- The differential run (m2-wire): every text and clipboard verdict passes,
  each at or below the bar built from the vendor samples that succeeded
  (gedit type_text 160 ms warm against the newest build's 930; the pinned
  build fails it after 10 s), the clipboard kept on every cua paste, no
  PasteText, InsertText or SetTextContents from cua, and every paste safety
  case passes. The one failing cell is M1a's desktop-screenshot cold parity
  listing, unchanged.
- The witness keyed to the route: dedicated gedit stayed on the background
  route with a clean witness; dedicated gnome-text-editor took the foreground
  route, the activation its only change.
- The family matrix with gnome-terminal and cua's type_text.
- repl-parity's native suite: the cua lane PASS with the text cases positive,
  the vendor lane its two declared defects, the diff ok.
- The native baseline: compare --engines VERDICT: PASS.
- scripts/accept/linux-native.mjs: 11 of 11, typing with typeText.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…e covers every speed verdict

The harness's text proof as built (the paste-target scene, the sharpened
late-conversion case, the focus-change injection, the route-keyed
witness, the bus trace's reach), the engine's second focusing click,
and four observations: Chrome's dropped address-bar click, the vendor
builds' clipboard_read and textarea failures, the VM's clipboard
watchers, GTK 4's missing GrabFocus.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…of the bar, 1 ms)

The design session's bound on Acceptance 3's noise rule, on every speed
verdict, the desktop route's included: a wider interval is undetermined,
gets more samples, and fails or stands as a declared speed gap if it
stays wide. No current verdict changes.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…d, noise bound, parity, cleanup

The review of the M2.3 harness, and the design session's bound on
Acceptance 3's noise rule:

- The witness records the stacking order on both sides of every change,
  read after each PropertyNotify (xprobe), and the foreground allowance
  judges each change: only the target's raise. Another window raised and
  the order restored now fails, and a run with a foreground request runs
  that as a live negative check (foregroundNegativeCheck).
- The route each cua text request must take is known beforehand
  (text.mjs expectedRoute: foreground for dedicated gnome-text-editor,
  background for every other scene, gedit's dedicated case included).
  The allowance needs the expected and the reported route both
  foreground; a different or missing route record fails the witness, and
  the audit is skipped by the expected route.
- A cua sample whose preparation failed (prepare_error) fails its verdict,
  and no engine's such sample is in the medians.
- Each safety case runs guarded: every engine, clipboard owner and target
  window it started ends however it ends, a half-done setup included; a
  text sample's owner ends with the sample; an owner that never took
  CLIPBOARD is stopped.
- A noise pass needs the interval's upper end within max(5% of the bar,
  1 ms), in the differential verdicts and the desktop groups; a wider
  interval is undetermined: the desktop groups get up to two top-ups of
  rounds, then fail or stand as a declared gap, and the differential
  verdict fails.
- deviations.mjs PARITY lists the cold desktop screenshot (Decision Log,
  M1a.4): above the bar it is parity, not a pass, while cua's median lies
  within the bar build's spread of samples in the run; the run's last
  line lists it apart and it does not fail the run.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
A text sample's row kept the witness's changes only when the witness
failed; a foreground sample that passed left no record of the stacking
transitions its allowance judged. It now keeps them wherever the
allowance excused a change, each stacking change with its orders.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
m2/diff gains three runs on the same engine build: m2-review (the full
verdict run on the reviewed harness), m2-review-launch (desktop
launch_app alone, 21 blocks) and m2-review-foreground (gnome-text-editor's
dedicated type_text and restore_refused, each sample keeping the stacking
changes its allowance judged). Every cua text request took its expected
route; every text verdict and safety case passes; the foreground negative
check failed the allowance in each run. m2-review's one failure is
launch_app's cold request on three samples a side, which the 21-block run
passes. The README states the runs, the verdict lines, m2-wire's cold
screenshot re-judged as parity, and the noise passes against the bound.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…; failed cleanups fail the case

The re-review found two gaps:

- The stacking property is read after its notify, so two quick changes
  coalesce: another window raised and restored under one server grab gave
  two notifies, no recorded transition, and a clean foreground verdict.
  The witness now selects SubstructureNotify on the root, snapshots the
  root's children when a span begins, and records every ConfigureNotify,
  CirculateNotify, map, unmap, creation, destruction and reparenting of
  one in order (xprobe/src/restack.rs). judgeRestacks replays them: only
  the target's top-level (its window manager frame, xprobe toplevel) may
  move, and only to the top; no record or no frame is a violation. The
  property stays a second record. The foreground checks gain the
  coalesced negative (xprobe restack-grabbed) and a positive raise,
  checked live on Openbox, where the events match the model.
- A cleanup that failed was swallowed as "already gone". Every disposal
  still runs; the failures fail the case (`cleanup failed: ...`), or ride
  on the case's own error. Engine.close and a target window's disposal
  establish "gone" themselves (exited; process group answering ESRCH).

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ts, the cases again

Two runs on 6dc5257, the same engine build: m2-review2-foreground
(gnome-text-editor's dedicated type_text and restore_refused, every
sample keeping its restack events: one ConfigureNotify each, the target's
frame to the top, witness clean 18/18) and m2-review2-cases (every paste
safety case, no cleanup failure, every verdict PASS). In both the
foreground checks held: the spaced and the server-grab raise-and-restore
failed, the target's raise passed. The README states them.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Expected routes set by the harness, the foreground allowance judged on
ordered restack events, failed preparations and cleanups failing,
the noise bound in the verdicts, the declared parity list, and the
verdict run's one M1a listing on three samples.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…on medians (design session)

M2's evidence cites a verdict run that exits 0, and that run gates the
release and the merge.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…he take; a display-wide unconfirmed window kept in the X server)

Both clipboard rulings agreed by the design session with its
conditions; the foreground witness's activation evidence and the text
operations' effect obligation; the macOS inventory; two Minors kept
deferred.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…nconfirmed-paste window is the display's

P1-a. A copy made between the snapshot and the take was overwritten, and the older snapshot then restored. A
snapshot now carries the owner generation: the XFIXES reports of CLIPBOARD's owner being set, counted on the owner's
own connection, re-assertions by the same owner included. The owner thread takes CLIPBOARD under a server grab: a
round trip that delivers every earlier report, the generation compared, SetSelectionOwner, the owner read back,
UngrabServer. A change refuses the take with CLIPBOARD untouched (`the clipboard changed after it was read`). The
paste answers `…; nothing was sent`, and both locks are released.

P1-b. The 10 s window after an unconfirmed paste lived in one engine, so a second engine could serve its text to the
first's late conversion. The window is now a root-window property, CUA_CLIPBOARD_QUARANTINE: its end in server time
and the target's X client. The cleanup writes it and every engine reads it before a paste, a clipboard_write or a
clipboard_read's Copy, under CUA_CLIPBOARD_LOCK. It outlives the engine that wrote it and expires by its own end,
compared on the wrapping clock. A vendor engine does not read it.

Regressions:
- a different owner's copy, and the same owner's re-copy, between the snapshot and the take are refused, and the
  newer copy survives;
- a second engine sees the first's window, also after the first has gone;
- over the wire, engine B's Copy and paste are refused while A's window runs and after A exits, and A's target is
  never served B's text.

Tests that paste now clear the display's record first.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…dit, effects required, desktop top-up, the display's window

The whole-branch review's harness findings and the design session's
top-up:

- The foreground witness records every FocusIn, FocusOut and
  _NET_ACTIVE_WINDOW activation request in order (xprobe/src/focus.rs:
  FocusChange on the root and every root child, followed as they appear),
  and judgeFocus allows only the target to be activated or take the
  focus. An active-window notify passes only beside clean evidence. The
  foreground checks gain the coalesced switch-and-restore under one grab
  (xprobe focus-grabbed), which fails, and an activation through the
  window manager, which passes. The foreground route is audited too:
  only the target's activation, raise and focus and XTEST input
  (auditForeground).
- Every text operation reads an independent effect; one it could not
  read is a miss (effect_unread), whatever the other samples read.
  clipboard_release declares why it has none.
- Desktop-route groups under 20 samples an engine are topped up in fresh
  engines, and the judge never decides a desktop group on fewer.
- The display-wide unconfirmed-paste window is waited out before every
  text sample, safety case and late-conversion trial (xprobe quarantine),
  never removed. The declared refusal names the display-wide scope and
  clipboard_read's Copy.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…n m2-final exits 0

Every m2/ run is now on cua-engine 0.2.0 (de4802a), the build being
released, with the harness at 426e25f; the earlier sittings on older
builds are removed (they stay in history at 5a229a0 and before).

- diff/ m2-final: run valid, every verdict PASS, exit 0. The desktop
  groups were topped up to 20 cold samples an engine; launch_app cold
  passes on twenty (4.0 against 4.4). Every cua text request took its
  expected route, every effect was read, the foreground samples carry
  restack and focus events, the foreground audit is clean, the
  foreground checks held, every safety case passed.
- matrix/ m2-final-matrix, parity/ (both lanes and the diff),
  baseline/ (compare --engines: VERDICT PASS), accept/ (PASS, 11/11),
  all on the build.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
Released by linux-engine.yml run 41090954823 on the reviewed head
8b49b68; both attestations verified by scripts/linux-engine-pin.mjs.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ux-engine-v0.2.0

Fresh-home install of the pinned static-pie asset (version line and
SHA-256 equal to the pin), doctor's engine row, and the Linux acceptance
fixture 11/11 on the installed engine with no sky_linux process and
cua-engine the trusted worker's child.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
…ixes, outcome and report

Progress ticks M2; the Decision Log records the branch review's fixes
as built and the release; Outcomes & Retrospective and the execution
report gain M2.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
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.

1 participant