Skip to content

feat(zgx): add rake-zgx backend (phase 1) - #118

Merged
1bye merged 5 commits into
mainfrom
t3/rake-zgx
Nov 29, 2026
Merged

1bye merged 5 commits into
mainfrom
t3/rake-zgx

Conversation

@1bye

@1bye 1bye commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add crates/rake-zgx, an experimental phase-one zgx desktop backend using only rake-core plus zgx/zgx-desktop, with no GPUI, rake-gpui or rake-app dependency.
  • Add the public unstable App/AppBuilder host API and the narrow ZgxRouteMount contract, with keyed retained route presentation, native WindowHost open/close/activate wiring, guarded close/quit forwarding and headless host/router tests.
  • Port the spike to examples/zgx-hello: one window and route, managed HEAD request, diagnostics count, typed last-status storage and local-control commands.
  • Document the two previously hidden native-backend hooks as public rake-core APIs: Router::set_host_attached and Router::request_host_close. No GPUI behavior changed.
  • Move/update the spike notes in docs/backends/zgx.md, and add dependency isolation plus macOS build/clippy/test CI coverage.

Design decisions

  • Mount contract: fallible asynchronous preparation produces owned PreparedPage data; synchronous zgx mount construction consumes it and returns a declarative zgx View; the backend wraps that view in a disposable retained mount handle for router rollback, history retention and disposal.
  • Loop ownership: zgx owns the platform event loop. Rake's router driver and optional local control server run in an application-owned local executor pumped by every open zgx window, so the driver is not tied to the first window.
  • Window lifecycle: zgx windows implement WindowHost. User close requests use Router::request_host_close; final-window close starts guarded application quit, and physical close is deferred until the router approves it or quit reaches QuitPhase::Ready.
  • Lockfile isolation: rake-zgx and examples/zgx-hello form a standalone Cargo workspace rooted at crates/rake-zgx with crates/rake-zgx/Cargo.lock. They are excluded from the main workspace so zgx-taffy 0.9 and wgpu 29 do not join the main resolution beside the existing wgpu 28/30 and taffy 0.15 lines. zgx-desktop 0.1.3 has a Linux-only exact blocking = 1.6.2 pin that Cargo resolves even on macOS, so rake-core now accepts blocking 1.6 or later; the main lockfile still selects 1.7.0 while the zgx lockfile selects 1.6.2.

Verified

  • cargo run -p rake-app-cli --locked -- format — pass.
  • cargo run -p rake-app-cli --locked -- format --check — pass.
  • cargo run -p rake-app-cli --locked -- lint — pass (860 Rust files; 0 diagnostics).
  • cargo fmt --manifest-path crates/rake-zgx/Cargo.toml --all -- --check — pass.
  • cargo build --manifest-path crates/rake-zgx/Cargo.toml -p rake-zgx -p rake-zgx-hello --locked — pass.
  • cargo clippy --manifest-path crates/rake-zgx/Cargo.toml -p rake-zgx -p rake-zgx-hello --all-targets --locked -- -D warnings — pass.
  • cargo test --manifest-path crates/rake-zgx/Cargo.toml -p rake-zgx --locked — pass (3 tests).
  • bash scripts/check-core-dependencies.sh — pass.
  • bash scripts/check-zgx-dependencies.sh — pass.
  • python3 scripts/check-example-lints.py — pass.
  • Portable CI checks for rake-client/http/protocol/diagnostics clippy and tests, macros no-default check, headless notes clippy/tests, portable Wasm checks and cargo check -p rake-core --target wasm32-unknown-unknown --locked — pass.
  • cargo clippy --workspace --all-targets --locked -- -D warnings — pass.
  • cargo clippy -p rake-app --features native-components --all-targets --locked -- -D warnings — pass.
  • cargo clippy -p rake-native --features native-tests --all-targets --locked -- -D warnings — pass.
  • cargo test -p rake-native --doc --locked — pass.
  • cargo test -p rake-native --features native-tests --test appkit --locked — pass.
  • cargo test --workspace --locked --no-fail-fast — pass.
  • Live macOS smoke with RAKE_DEV_CONTROL=1: tabs list showed the committed status route; commands run spike.last-status --args null returned null; commands run spike.fetch --args null committed; spike.last-status then returned 200; tasks list showed Fetch HTTP status as Completed. The control-driven fetch runs the same managed task and store write as the window button, avoiding synthetic OS input in the headless automation environment.

Gaps

Phase 1 is not GPUI feature parity. Remaining work includes zgx view! lowering, theme/widget parity, menus and shortcuts, inspection/devtools, development reload reattachment, window-state persistence, continuous minimize/occlusion visibility, and zgx-dom/web. zgx 0.1.3 does not expose a reactive minimize/occlusion signal, so this phase synchronizes attach/close visibility only. CI builds and tests the backend but cannot open a real window headlessly.

🤖 Generated with Claude Code

1bye and others added 5 commits November 29, 2026 18:39
Document the renderer-neutral host attachment and guarded close hooks so
non-GPUI window backends can implement the router lifecycle directly.
Accept blocking 1.6 or later so zgx-desktop 0.1.3's exact Linux-only 1.6.2
pin can resolve in the isolated zgx lockfile; the main lockfile still
selects 1.7.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the phase-one rake-zgx host with an application builder, zgx route
mount contract, retained keyed route presentation, WindowHost wiring and
an application-owned local executor pumped by open zgx windows. Keep the
crate outside the main workspace so zgx-taffy and wgpu 29 do not join the
GPUI workspace resolution.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Demonstrate one zgx-hosted route with managed HTTP work, diagnostics,
typed storage and local-control commands, including a control-driven fetch
for automated smoke verification. Move the spike design notes into the
phase-one backend documentation and record the remaining adapter gaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reject GPUI crates in the rake-zgx and example dependency graphs and build,
lint and test the standalone zgx workspace in the macOS native job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record that phase one synchronizes attach and close visibility while zgx
0.1.3 does not expose continuous minimize or occlusion changes to the
backend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1bye
1bye marked this pull request as ready for review November 29, 2026 20:52
@1bye
1bye merged commit c766d45 into main Nov 29, 2026
13 checks passed
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