efc7db57a30b386dfd823632d7dc5dae6fd99f2d
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
efc7db57a3 |
voelin-gpui: closing the window gives the engine time to send the session closes
The window's close sends CloseSession for every session (AppState::shutdown) and ended the app straight into runtime.shutdown_timeout(2 s), which waits for blocking tasks only and drops the engine's async tasks: the commands could go with the runtime and leave ghost clients on the servers until they time out. voelin-ui sleeps 500 ms in that case before shutting its runtime down (app.rs after ui.run()); run() does the same now. shutdown() returns how many sessions it told the engine to close, the close handler keeps that number for run() (the App and its entities are gone once GPUI's loop has returned), and run() waits CLOSE_GRACE only when it is not zero. A comment in run() tells the slices that add another way to end the app to call shutdown() too. The GPUI window cannot open a session in this slice, so the wait is not seen end to end; the tests pin the count: with an engine a state holding a session answers 1 and a state with none 0, without an engine 0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
a4694e944b |
voelin-gpui: a window that cannot open ends the app with the reason, not a hang
When open_main_window failed (no usable Vulkan or GL driver), run() stored the
error and called cx.quit() inside the launch callback. GPUI's Linux platform
calls that callback before it starts its event loop, and calloop's
EventLoop::run clears its stop signal on entry, so the quit was lost: the
binary stayed alive with no window and no message (reproduced on a private
Xvfb with VK_DRIVER_FILES, __EGL_VENDOR_LIBRARY_DIRS and LIBGL_DRIVERS_PATH
pointing nowhere: exit 124 under `timeout`, nothing in the log after "Creating
colormap"), and the `failure` that main was to print was never returned. The
quit is a foreground task now, which runs inside the loop: the same run exits
with status 1 and "cannot open the main window / Failed to create surface".
With no display server at all GPUI starts its headless platform, whose
open_window succeeds with a window that draws nothing, so the same silent hang
came from there; open_main_window refuses a compositor named "headless" with
"no display: neither DISPLAY nor WAYLAND_DISPLAY names a display server".
tests/launch_failure.rs starts the built binary both ways (the driver case
under VOELIN_X11_TEST_DISPLAY, skipped where the machine's driver is found
anyway; the display case needs none) and fails when the process outlives two
minutes; with the old cx.quit() the driver test fails after 120 s, with the fix
both pass in a third of a second. docs/ui.md ("Running it") says what a missing
driver and a missing display look like; CHANGELOG.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
||
|
|
a2fad4569a |
voelin-gpui: the backdrop's GPUI gradient in one place (Backdrop::to_gpui)
GPUI's gradient has two colour stops and the Slint backdrop three, so what GPUI draws is the first and the last; that choice was written inline in the swatch page. It is a method of the token now (theme/mod.rs), with a test that it is the gradient of the first and the last stops and not of the middle one, and the swatch calls it. No change on screen. Checked on Rust 1.95.0: fmt, clippy -D warnings --no-deps (all targets), `cargo test -p voelin-gpui` (31 tests). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
109e1d1839 |
voelin-gpui: the cost meter as a development switch (VOELIN_METER=1), logged once a second
meter.rs is spike_common::meter of the GPUI spikes (spikes/gpui/common/src/meter.rs, docs/design/gpui-spikes.md) without the measuring run's summary and exit: once a second, on a thread of its own, a log line (target voelin_gpui::meter, level info) with the process's CPU in percent of one core, the resident memory, the CPU of each group of threads (a thread's name without its trailing number: `llvmpipe-12` is `llvmpipe`, which tells the software renderer's share, work a GPU would take, from GPUI's thread, the engine's runtime and the codecs; the busiest first, groups under 0.5 % left out), the app's own counters per second and the voice connections as a gauge: cpu 11.9% rss 250.4 MiB | threads llvmpipe 5.9 voelin-gpui 5.0 | engine_events 0.0/s ticks 1.0/s renders 1.0/s later_jobs 0.0/s | connections 0 The counters (`Counters`: engine events handled, ticks, renders, jobs run through `Later`, connections up) are shared with the root state and the main view, which count in `handle_event`, `tick`, the later task and `render`; the numbers come from /proc/self (a note and a warning say so where there is none; rustix's `param` for the page size and the clock tick, Linux only, no new package: the lock gains the edge). The line is a pure function with a test, as are the thread grouping and the stat parser (a name with spaces and parentheses), and one test reads this process and checks it has threads and memory. The root state's tests now also check the counters (events, the connection gauge, three ticks, a job from another thread). `VOELIN_METER=1` starts it (dev.rs parses it with the other switches). Running the debug binary on the swatch page on Xvfb :97 logs the lines above (about 12 % of a core when idle, the software renderer 6 to 11 % of it, one frame a second); the window closes with exit code 0. The default log filter now leaves out GPUI's "failed to load font .SystemUIFont" warning, which every start printed (gpui-component asks for the platform UI font before the theme names Inter; the text system falls back). Checked on Rust 1.95.0: fmt, clippy -D warnings --no-deps (all targets), `cargo test -p voelin-gpui` (30 tests), cargo deny, `scripts/notices.sh --check`. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
2690b8a802 |
voelin-gpui: VoelinTheme (every token of theme.slint, light and dark) written into gpui-component, Inter, the client's Lucide icons, the swatch page
Two layers, as the spikes' report settled: 1. `VoelinTheme`, a GPUI global (theme/tokens.rs): the 43 colour tokens of ui/theme.slint for light and dark (generated from the Slint file by a script, then checked by the test below), the backdrop gradient, and `Metrics`: the radii, spacing, type sizes, weights, control and shell sizes and the two durations at a text size factor (font-scale: the sidebar's `264 * max(1, scale)` and the top bar's `max(44, control + 8)` included). 2. gpui-component's `ThemeColor`, written on every change (theme/components.rs): the base of the report's table (background, foreground, border, input, ring, overlay; primary with hover, active and foreground from the client's accent; secondary and muted from surface-2 and its raised steps; gpui-component's "accent", which is a hover background, from surface-3; popover; list, table, sidebar, title and status bar, tabs, switch, slider, scrollbar, link, selection; danger, success, warning and info with a hover and active made by mixing and a text that is white or the window's ink, whichever contrasts more) and the 28 `button_*` fields a theme file would derive from them (without them the buttons keep the default theme's blue). The mixing, the WCAG contrast and `readable` are `Rgba` methods with tests. The window's background is bg-app; the backdrop and bg-rail stay in `VoelinTheme` (gpui-component has no rail, and GPUI's gradient has two stops against Slint's three: the swatch draws the first and the last and says so). The mode (`Choice`: system, light, dark) follows the window's appearance in `system` (`observe_window_appearance` calls `set_system_appearance`; a light or dark choice ignores the window) and sets the platform's window appearance where the platform draws the frame (macOS; a no-op elsewhere). The text size factor rewrites the metrics, the theme's font size (font-body) and radii. theme/slint_parity.rs reads ui/theme.slint at test time (`include_str!`) and compares every declaration of the `Theme` global with tokens.rs by name: the colours (dark and light), every length with the file's own arithmetic (a small evaluator of `*`, `+`, `max()` and token references) at four text sizes, the weights, durations, the font family and the backdrop's stops, and fails on a name on one side only or a declaration kind it does not know. A mutation check (accent, radius-md and the top bar's formula changed in tokens.rs) failed the tests with the names of the tokens, then was reverted. fonts.rs adds the five Inter TTFs of the Slint front end (`include_bytes!`) to GPUI's text system; the theme names the family. build.rs turns the 147 Lucide 1.48 SVGs of crates/voelin-ui/ui/assets/icons into a sorted table of `include_bytes!` (std only, no new dependency) that assets.rs serves as gpui-component's `icons/<name>.svg` before gpui-kit-assets' Lucide 1.43 catalogue (1,830 paths, which answers the rest and, as it does, an error for a path it lacks); a test checks that `mic.svg` is the client's, differs from the catalogue's, and that other icons fall through. Development switches (dev.rs): `VOELIN_OPEN=swatch`, `VOELIN_DEV_THEME= dark|light|system`, `VOELIN_FONT_SCALE`, `VOELIN_WINDOW_SIZE` (the Slint front end's names where they exist). swatch.rs is the page: the 43 colours in the groups of docs/ui.md's "Theme tokens" table with name and value (a test checks each token is in exactly one group), the backdrop, radii, spacing, the type scale, buttons, switches and checkboxes of gpui-component and 16 icons; it scrolls when the window is smaller. scripts/gpui-shot.sh makes the screenshot headless the way scripts/shots.sh does for Slint (xvfb-run, or GPUI_SHOT_HEADLESS=1 under headless.sh on NixOS; Wayland, the session bus and the XDG directories out of the environment), then closes the window with Alt+F4 and reports how the app ended. docs/ui/gpui-swatch-dark.png and -light.png are its output (Xvfb :97, openbox, lavapipe via wgpu's Vulkan backend, the debug binary, 1440x960, truecolour: a 256-colour reduction would change the tokens' values; the Slint pictures live in docs/screenshots/, the task asked for docs/ui/). Checked on Rust 1.95.0: fmt, clippy -D warnings --no-deps (all targets, the build script included), `cargo test -p voelin-gpui` 26 tests, cargo deny, `scripts/notices.sh --check`. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
27a13fcc7c |
voelin-gpui: the root Entity<AppState>, the engine's events through a foreground task, the one-second tick, later()
crates/voelin-gpui/src/app.rs holds the root entity: the toolkit-free voelin_ui_vm state (`AppState<Vec<ChatLine>>`) and `Social`, with `events::handle` as the one dispatch of an engine event (the entry point both front ends use; its Update's engine commands are sent, its warnings logged, the rest belongs to the slices that draw it). Three loops, spawned by `AppState::new` and ended when the entity is released: - the engine's events: a foreground task awaits the tokio receiver of the hosted engine (no reactor needed, as the plan says), `this.update` and `cx.notify()`: spike 3's hotkey task; - the tick: a loop of `background_executor().timer(1 s)`; - `Later`, for other threads: GPUI's `AsyncApp` holds an Rc-based weak handle and is not Send (read in gpui-pre's async_context.rs), so a thread that wants to touch the entity holds a Send handle that queues a boxed closure; a third foreground task, which owns the cloned AsyncApp, runs it with the entity. This is the Slint front end's `later(|app| ...)`. engine.rs repeats the ~25 lines of voelin-ui's `HostedEngine::start` (the engine on a tokio runtime, its events forwarded into an unbounded channel): that type lives in the Slint crate (crates/voelin-ui/src/app.rs), which this crate cannot depend on and this task does not touch. dev.rs reads VOELIN_WINDOW_SIZE. lib.rs `run()` logs through tracing (`VOELIN_LOG`, else `RUST_LOG`, else a filter that shows GPUI's adapter line), starts the engine's runtime, opens the window on the entity and, on close, tells the engine to close the sessions and ends the app. view.rs shows the one line of state the task asked for: version, voice connections up, engine events handled, seconds up; each part moves by one of the loops. Seven tests, none needing a display (GPUI's test platform): an injected engine event (a voice state) reaches the entity and its status line, the entity notifies its observers, the tick runs once per advanced second, a job from another thread runs on the entity, and a real engine (HostedEngine on a tokio runtime) delivers a real event (a setting changed by a command) to the entity through the same task; the window-size switch parses and refuses nonsense. The real-engine test calls `allow_parking`, as GPUI's test scheduler calls a wake from a tokio thread a non-deterministic test otherwise. The tests use `gpui-pre` (renamed `gpui`) with its `test-support` as a dev-dependency, pinned `=0.3.10` beside gpui-kit's own pin: gpui-kit's `test-support` feature names the optional `gpui-fast` backend in weak features, which makes cargo lock gpui-fast and its tree and pins taffy to 0.15.0 for every build (reproduced in a scratch project: 793 packages without the feature, 820 with it). The lock gains only gpui-pre's own test-support crates (proptest and its few, futures-concurrency, postage); THIRD_PARTY_NOTICES.md does not move (dev-dependencies are out of it) and cargo deny passes. Run on Xvfb :97 (headless.sh) with the debug binary: the window opens in 0.1 s, shows "Voelin 0.0.1-alpha · 0 connections · 1 engine event · 2 s up" and, four seconds later, "... · 6 s up" (the one engine event is the real engine's own at start); Alt+F4 ends the app with exit code 0 in 132 ms. Checked on Rust 1.95.0: fmt and clippy -D warnings (all targets, --no-deps), `cargo test -p voelin-gpui` (3 runs, 7 tests each), cargo deny. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
8f234e0051 |
voelin-gpui: the GPUI front end's crate on gpui-kit 0.8.1, a window titled Voelin that opens and closes
The second front end of plan section 6 step 3: crates/voelin-gpui with the binary voelin-gpui, in the workspace's members and default-members next to voelin-ui (two binaries until parity; voelin-ui stays the app). gpui-kit is a workspace dependency pinned `=0.8.1` (the version the three spikes were rebuilt on in the commit before). The crate asks for gpui-kit and the app's name and id from voelin-platform (APP_NAME as the window's title, APP_ID as its app id); `run()` opens one window whose `on_window_should_close` ends the app, and returns the error when the window cannot be opened (no display). Checked on Xvfb :97 (headless.sh: openbox, a private bus, lavapipe through wgpu's Vulkan backend, state under .scratch): the debug binary opens a window named "Voelin" (xdotool search) in 0.3 s and ends with exit code 0 when openbox sends the close request (Alt+F4). Cargo.lock: 279 more package entries (208 new names; no existing version moved, other versions of 61 names were added beside theirs): GPUI's gpui-pre family, wgpu 30, gpui-component with its Markdown, HTML, chart and table support, cosmic-text, the Linux platform crates. The root workspace already carried Slint's and the codecs' dependencies, so this is 195 new packages on Linux, not the ~1,000 of the spikes' lock (which has the root's packages too). deny.toml and about.toml name the two licences no crate of the tree had: 0BSD (enum-iterator and enum-iterator-derive, under gpui-component) and CC0-1.0 (notify 8, the file watcher of gpui-component, and tiny-keccak, under the X input method client of gpui-pre-linux); no other licence, no advisory, no ban and no source is new (`cargo deny --locked --workspace check`: advisories, bans, licenses and sources ok). THIRD_PARTY_NOTICES.md is regenerated (scripts/notices.sh, cargo-about 0.9.2, no warning; `--check` clean). There is no new clarification: cargo-about finds every text. Docs: CHANGELOG, docs/ui.md (the structure tree names the crate and the intro the second front end), docs/building.md (the dependency list: Vulkan or OpenGL at run time, what GPUI loads by name, a window manager on X11; no new development package), README (the crate list and the run command) and CLAUDE.md, which had no crate sentence (it only says "own crates"): it now says there are two front ends on one engine and what they share. Checked on Rust 1.95.0: cargo fmt and cargo clippy -D warnings --no-deps over the own crates (all targets); cargo deny; scripts/notices.sh --check. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |