Skip to content

fix(cua-driver): preserve snapshot-owned screenshot transforms - #3942

Draft
f-trycua wants to merge 4 commits into
mainfrom
fix/snapshot-owned-screenshot-transforms
Draft

f-trycua wants to merge 4 commits into
mainfrom
fix/snapshot-owned-screenshot-transforms

Conversation

@f-trycua

@f-trycua f-trycua commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Refs #3630

Problem

A later screenshot can replace the coordinate transform used by an earlier
observation. A client can then send a valid pixel coordinate that Driver
silently interprets in another capture's scale.

Change

  • Publish screenshot scale and zoom interpretation data with the authoritative
    runtime-owned snapshot.
  • Resolve coordinate actions against the calling session's current snapshot and
    refuse stale, cross-session, ambiguous, or retired context.
  • Retire screenshot and zoom context on replacement, explicit removal,
    session end, eviction, and late-completion races.
  • Bound retired-snapshot tombstones and fail closed after overflow until the
    cache is cleared.
  • Preserve coordinate-less button release using the stored native hold point.
  • Convert persistent Wayland press and drag coordinates from window-local to
    compositor output space.
  • Release session-owned persistent Wayland holds through the fallible cleanup
    hook, retaining failed releases for bounded retry.
  • Add focused shared and platform harness regressions for cross-client
    replacement, independent windows, stale zoom, late completion, and
    Windows native-coordinate dispatch.

This preserves the current public action shapes and latest-read replacement
behavior. It does not add historical screenshot IDs or the future perception
capture registry.

Attribution

Salvaged from #3628. The initial implementation commit preserves
Co-authored-by: injaneity <[email protected]>.

Validation

Current head: de0e5ff5c634baf63f5ac9e913e5de6f77a4e094

  • cargo test -p cua-driver-core element_cache::tests --lib: 27 passed
  • cargo test -p platform-linux --lib: 23 host-platform tests passed
  • cargo check --workspace: passed with existing warnings
  • cargo fmt --all -- --check: passed
  • git diff --check origin/main...HEAD: passed
  • cua-driver-platform.test.ts: 6 passed
  • Generator routing assertions: passed
  • Native Linux/Windows zoom references independently reviewed against their Rust contracts: no findings
  • Exact-head Linux Rust: run 35242959146 passed
  • Exact-head Windows Rust: run 35242959092 passed
  • Exact-head native references: run 35242959101 passed on macOS, Linux, and Windows
  • Exact-head contract/SDK: run 35242959283 passed
  • Exact-head Nix: run 35242959129 passed
  • Independent final diff review: no findings

Remaining draft gates

  • The repository-wide CI: Test Scripts / test job still carries the inherited
    CI: release-wiring test rejects deduplicated AGENTS guidance #3935 release-guidance regression; this PR does not change the affected files.
  • Canonical macOS, Windows, and Linux desktop E2E on the exact stable candidate
    before this PR is made ready or merged.

This PR remains draft and unmerged.

f-trycua and others added 4 commits September 17, 2026 09:07
Refs #3630.

Publish, resolve, and retire screenshot coordinate transforms with the runtime-owned snapshot lifecycle. Refuse stale cross-session image coordinates while preserving latest-read replacement and platform delivery limitations.

Salvaged from #3628

Co-authored-by: injaneity <[email protected]>
Keep snapshot and zoom retirement fail-closed, preserve bounded tombstones, and release persistent Wayland holds through retryable session cleanup.
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