Files
2026-08-31 16:15:32 -07:00

84 lines
3.7 KiB
Markdown

# GPUI accessibility and input probe
This independent workspace answers one narrow question: can the GPUI version
currently used by Zed expose the minimum semantic tree Lumbridge needs for a
workspace and terminal pane, while accepting real platform IME input?
## Reproducibility
- Upstream: `https://github.com/zed-industries/zed`
- Commit: `ce48461eaadd16c65c31f835511ab96bd3b6e746`
- GPUI license at this commit: Apache-2.0
- Rust: 1.97.1, matching the upstream `rust-toolchain.toml`
Both `gpui` and `gpui_platform` are pinned to the full commit. This directory is
an independent Cargo workspace, so its toolchain and dependency graph do not
change Lumbridge's root MSRV or release graph.
## Semantics under test
The rendered tree contains:
- an application named `Lumbridge accessibility probe`;
- a stable, externally identifiable `Region` named `Lumbridge workspace`;
- a stable, focusable `Pane` named `Local terminal pane`;
- `selected = true` on the pane;
- real GPUI keyboard focus tracked on the pane;
- the description `Needs input: choose whether to run the proposed command`;
- a `Terminal` child named `Terminal output` for the pane's content.
Current GPUI exposes these through its AccessKit integration using `role`,
`accessibility_id`, `aria_label`, `aria_description`, `aria_selected`,
`focusable`, and `track_focus`. The deterministic unit test checks the exact
AccessKit role and properties. The binary compile-checks GPUI's element wiring;
a platform screen reader remains necessary for end-to-end AT-SPI/VoiceOver
validation.
## Input and IME proof
The focused pane also installs a real `ElementInputHandler<ImeTextReceiver>`
during element paint. `ImeTextReceiver` implements GPUI's
`EntityInputHandler`, including text queries, UTF-16 selection, marked-text
composition, replacement, unmarking, selection updates, editable length, and
IME candidate bounds. This is the code path GPUI's platform adapters call for
composed operating-system text input.
The backing buffer stores UTF-8 only at valid scalar boundaries and translates
the platform's UTF-16 ranges before mutation. Deterministic tests cover:
- replacing a selected decomposed `e` plus combining acute accent with `é`;
- a marked decomposed-accent IME composition and commit;
- inserting, selecting, and replacing the multi-codepoint grapheme `👩🏽‍💻`;
- collapsed selection placement after every replacement.
These tests prove range conversion and composed-text preservation without
splitting UTF-8. An actual keyboard IME on X11/Wayland and macOS remains an
end-to-end platform test, not a unit-test claim.
## Commands
```bash
cargo check --locked
cargo test --locked
cargo clippy --locked --all-targets -- -D warnings
```
The first command installs the pinned Rust toolchain if rustup does not already
have it and downloads Zed's GPUI dependency closure.
On Ubuntu hosts that have only the runtime libraries, checks work with
`RUST_FONTCONFIG_DLOPEN=1`. Linking a test or binary additionally needs the
unversioned linker names normally installed by `libxcb1-dev`,
`libxkbcommon-dev`, and `libxkbcommon-x11-dev`. The amd-server validation used
temporary symlinks under the ignored `target/native-libs` directory and set
`LIBRARY_PATH` to that directory; no system packages or root files changed.
## Observed local cost
On amd-server, the first successful check required roughly 90 seconds after
installing/fetching, with some Cargo-cache contention from concurrent work. The
lockfile contains 691 packages. After check, test, Clippy, and a debug build,
the isolated target directory was 4.4 GiB and the debug binary was 535 MiB. The
minimal Rust 1.97.1 toolchain occupies 624 MiB. These are development costs, not
optimized release measurements.