Skip to content

docs(adr): ADR-0017 client UI stack and ADR-0018 apps workspace, with the Leptos vs Dioxus spike - #167

Closed
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1790293600-adr-0017-ui-stack-spike
Closed

devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1790293600-adr-0017-ui-stack-spike

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What changes for users

None. Docs and a benchmark workspace only; the root workspace, qq binary, and protocol are untouched.

Why / design

Resolves the pending client-UI-stack decision with evidence, as the first PR of the web-surface workstream.

ADR-0017 — client UI stack (docs/adr/0017-client-ui-stack.md), status Proposed — founder decision requested:

  • Recommendation: Leptos 0.8 (CSR) for the shell and the Sessions remote.
  • Remote contract is framework-neutral at the ES-module boundary, so Fleet/Approvals/Billing/Onboarding remotes can use any stack:
    default(init)                                       // wasm-bindgen initializer
    mount(root: HtmlElement, config: string) -> Result<(), JsValue>
    unmount() -> ()
    
  • Each wasm instance owns its own SessionClient + SSE subscription and reduces with qq-client::state; the shell owns server profiles, credentials, and the W3 ServerSet. State is shared by protocol, not by memory (separate wasm modules cannot share a store without re-serializing every event in-page).
  • U1 size gate refined from the plan's 1.5 MiB placeholder to 600 KB gzip per artifact (measured floor 348 KB is the client itself; Leptos adds 31 KB).
  • Tauri v2: the same Trunk static output is frontendDist; Leptos is an officially documented Tauri path.

ADR-0018 — apps/ is a separate Cargo workspace (docs/adr/0018-apps-workspace.md): own lockfile/profile/.cargo cfg, path deps on qq-protocol/qq-client with features = ["wasm"], own CI job; root gates untouched.

Spike (benchmarks/wasm-ui-spike/, its own workspace, not a root member): baseline (no framework, innerHTML), leptos (0.8.20), dioxus (0.7.10) share one spike-common crate — authenticated /v1/health, ServerConnection, SessionClient, snapshot, fetch SSE with reconnect, SessionStore reducer, rAF frame monitor — so the candidates differ only in rendering. host/index.html is a framework-free ES-module page that loads both as remotes. fake_model.py is a deterministic OpenAI-compatible streamer; drive.sh creates sessions through the real qq serve HTTP API; run_browser.py measures in Chrome over CDP. README has the reproduction steps.

Evidence summary (details and caveats in the ADR)

baseline Leptos Dioxus
wasm gzip 348 KB 379 KB 461 KB
JS glue raw 34 KB 37 KB 86 KB
live SSE, 300–600 ev/s, apply mean 0.003–0.005 ms 0.003–0.004 ms 0.003–0.004 ms
sustained long frames none none none
host import / init / mount — 5 / 8 / ≤3 ms 12 / 10 / ≤0.4 ms
unmount own UnmountHandle (supported) abort web::run future (undocumented)
Tauri v2 — official template + guide static build works; no official path

Streaming and remote loading do not separate the candidates; bundle size, glue size, a supported unmount, and the documented Tauri path do. Dioxus remains a viable override with the same contract.

Founder decision requested: accept ADR-0017 as recommended (Leptos), or override to Dioxus. U1 proceeds on whichever is chosen; nothing else in the ADR changes.

Deviations noted in the ledger: the plan attached the spike to W1, which shipped without it, so this is its own PR ahead of U1. Branch name follows the workstream's requested devin/<timestamp>-<slug> rather than AGENTS.md's type/ prefix.

Linear: ENG-
Slice: docs/plans/multi-surface-clients.md#u1 (ADR-0017, ADR-0018)

Screenshots

Leptos candidate, live against qq serve, focused session streaming (3 sessions, 300 deltas/s):

Leptos spike streaming a session

Dioxus candidate, same run:

Dioxus spike streaming a session

Framework-free host loading both remotes side by side through the mount() contract, with load timings:

Host page with Leptos and Dioxus remotes mounted

After unmount() on both (0 nodes left in the slots):

Host page after unmounting both remotes

How verified

Root workspace: docs and .gitignore only, no Rust changed.

  • cargo fmt --all -- --check (root)
  • Spike workspace: cargo fmt --all -- --check; cargo clippy --workspace --target wasm32-unknown-unknown -- -D warnings clean
  • Manual check: ./measure.sh (Trunk 0.21.14, wasm-opt version_123, Rust 1.97.1) produced the size table; qq serve --bind 127.0.0.1:9077 --allow-origin http://127.0.0.1:8090 with fake/stream routed to fake_model.py; python3 run_browser.py --workspace ~/spike-ws --sessions 3 and two --sessions 6 stress runs at 2000 deltas/s in Chrome; all three candidates reached conn live, rendered grouped sessions and the focused transcript, and the host mounted/unmounted both remotes with 0 residual nodes.

Impact

  • Performance: none on the kernel. Spike measurements are recorded in the ADR.
  • Compatibility: PROTOCOL / DESCRIPTOR / store schema unchanged.
  • Docs: docs/adr/0017-client-ui-stack.md, docs/adr/0018-apps-workspace.md, docs/adr/README.md, docs/plans/progress/root.md (allocation rows), docs/plans/progress/multi-surface-clients.md (entry 2026-09-24).

Link to Devin session: https://app.devin.ai/sessions/65d1540c06e44446b555b398b659de78
Open in Devin Desktop: https://app.devin.ai/desktop/session/65d1540c06e44446b555b398b659de78?variant=devin
Requested by: @integrate-your-mind

… the Leptos vs Dioxus spike

Spike workspace in benchmarks/wasm-ui-spike/ (baseline, leptos, dioxus on one
shared qq-client feed; plain ES-module host; measurement scripts). Evidence:
bundle size, live SSE streaming in Chrome, remote mount/unmount, Tauri v2 fit.
Recommends Leptos 0.8 behind a framework-neutral remote contract; founder
decision requested.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

2 participants