Repository navigation
feat(gui): answer the first-launch questions in the page - #584
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 1 minute. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: LargeModGames/spotatui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (30)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: LargeModGames/spotatui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (30)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughGUI startup now opens the browser before boot and uses it to collect first-run answers. The socket protocol carries onboarding questions and replies. The frontend displays the transcript and prompt controls, while the bridge publishes onboarding state and later resynchronizes app state. ChangesBrowser onboarding
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant launch_gui
participant BrowserOnboarding
participant bridge_channel
participant BrowserPage
participant bootstrap_boot
launch_gui->>bridge_channel: Start listener with browser onboarding
launch_gui->>BrowserPage: Open access-code URL
launch_gui->>bootstrap_boot: Boot with browser onboarding
bootstrap_boot->>BrowserOnboarding: Request first-run answers
BrowserOnboarding->>bridge_channel: Publish onboarding view
bridge_channel->>BrowserPage: Send pending question
BrowserPage->>bridge_channel: Send sequenced reply
bridge_channel->>BrowserOnboarding: Deliver onboarding reply
BrowserOnboarding-->>bootstrap_boot: Return prompt answer
launch_gui->>bridge_channel: Publish app after successful boot
Merge Risk: ⚪ Minimal · up to No concrete merge-blocking issue was established for browser onboarding. Normal checks can proceed, though shutdown behavior on a serve error remains unverified. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to First-run setup now accepts answers from any browser connection admitted to the GUI session, including another page opened during setup. Those answers can determine saved source and credential settings. Access to the session is restricted, but the ownership of each setup decision is not tied to the page that began it. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
# Summary Two spotatui instances at once share one state directory and one Connect device id. Both write `mcp.json`, `last_session.yml` and the playlist sync, and the listening history counts every listen twice. A UI launch now takes an OS file lock first, so a second instance exits before it writes any shared state. CLI subcommands never take the lock. What changed: 1. New `src/runtime/instance.rs`. `acquire` locks `<state dir>/instance.lock` with std `File::try_lock` and writes the holder's pid to `instance.pid` for the refusal message. The locked `File` is the guard; the OS releases it at process exit. 2. `run_cli` takes the lock only when `instance::takes_lock` sees no subcommand, after the `--completions` and `update` early returns and before the legacy state migrations. The module is gated on `tui`. 3. `boot` lends the guard to `restart_after_update`, which drops it just before it runs the updated binary and waits on it, so the child can take the lock. 4. The refusal is a typed `AlreadyRunning` error, and `run_cli` skips the log-file notice for it. That notice (from #574) tells the user to rerun with `--debug` before reporting a bug, which is wrong for an expected refusal. 5. `clear_handshake` (`src/infra/mcp/control.rs`) deletes `mcp.json` only when the file's `pid` is this process. 6. `Cargo.toml` declares `rust-version = "1.90"`. `File::try_lock` needs 1.89; the 1.90 floor is `quantette` 0.5.1, which `cover-art` pulls in through `ratatui-image`. 7. Four tests (`test_attribute_total` 2224 to 2228), a CHANGELOG entry and the `instance.rs` row in `CLAUDE.md`, `AGENTS.md` and `.github/copilot-instructions.md`. Deliberate behaviour changes a user can see: 1. A second instance exits at once with "spotatui is already running (pid N)" and a hint to quit the running one first. 2. `--reconfigure-auth` and `--play-file` are UI launches and are refused too, so the in-app hints to run `spotatui --reconfigure-auth` now need the running instance quit first. 3. A second instance with a different `-c/--config` is refused as well: the state directory does not follow `--config`. 4. The state directory gets `instance.lock` and `instance.pid`. Both stay after exit and never block the next launch. 5. With `mcp-server`, an instance no longer deletes an `mcp.json` another process wrote. A stale file from a killed instance stays until an instance with MCP on replaces it; the relay already reports it as stale. 6. Building from source needs Rust 1.90 or newer. # Testing The suites ran on the top of the stack (`feat/gui-onboarding`), which contains this PR: - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -- -D warnings` on slim, headless, headless-streaming, mcp-only, ai-dj-only, default, the `gui` leg and the five-sources set with `audio-viz-cpal`: all `Finished`, no warnings. - `cargo test --locked`, `0 failed` on every leg: slim `1253 passed`, headless `851 passed`, mcp-only `1377 passed`, ai-dj-only `1530 passed` (the four dead-code warnings in `infra/dj` test helpers predate this stack), default `1630 passed`, `gui` leg `1369 passed`. On this PR's own head: `cargo clippy --locked -- -D warnings` on slim, headless and default: clean. `cargo test --no-default-features --features telemetry,tui gates`: `ok. 10 passed`. `bash tools/check_gates_ratchet.sh main`: `ok`. `cargo test ... instance`: `ok. 3 passed`. # Additional notes Part 1 of 7 of a stack (#578 to #584). Base: main. Rebased on #574 and #577. The only interaction is item 4: #574's `run_cli` prints the log-file notice after any failed run. Not run here: the lock tests on Linux and macOS (CI runs the Linux legs; the macOS job only builds). The 1.90 floor comes from my local registry, which lacks some Linux-only and macOS-only crates, so one of those can still need a newer Rust. Still to run: a live pass with two instances and `spotatui playback` beside one. Known trade-offs: - Only a held lock refuses. When the lock file cannot be opened or the filesystem cannot lock, the instance starts unlocked with a log warning. - `instance.pid` is written after the lock is taken, so a refusal during a racing launch can name the previous holder or omit the pid. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * UI launches now prevent a second application window from starting and display the running process ID when available. CLI subcommands remain usable while a window is open. * **Bug Fixes** * Handshake cleanup now leaves files untouched if they are malformed, unreadable, or belong to another process. * Update restarts release the single-instance lock before relaunching. * **Compatibility** * Source builds now require Rust 1.90 or later. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
14284e4 to
898af80
Compare
# Summary This splits the terminal launch into the steps every frontend needs and the steps only the terminal needs. `boot` stops reading clap matches, and the startup and exit work that `launch_ui` and `start_ui` ran around the terminal loop moves into two functions in `src/runtime/startup.rs`. A second frontend can then call them instead of copying about 95 order-sensitive lines of the exit path. What changed: 1. `bootstrap::boot` takes a plain-data `BootOptions` (config path, tick rate, subcommand name, `--reconfigure-auth`, `--play-file`, `--no-update`) instead of `&ArgMatches`. `cli::boot_options` builds it, so `bootstrap.rs` no longer imports clap. `run_auto_update` takes a `skip: bool`. 2. `prepare_frontend(boot)` is the old body of `launch_ui` up to the terminal loop: the OS media integrations, the deferred streaming startup, the session restore and the IoEvent pump task. It returns `FrontendHandles` and cannot fail. 3. `launch_ui` now builds the `Driver` and lends it to `runner::start_ui`, which runs only the terminal loop and returns a `TerminalSession`. The session holds the `Events` reader and the terminal until the exit path ends, as the old locals did. `TerminalSession::restore` undoes the terminal setup. 4. The exit path moves out of `start_ui` into `shutdown_frontend`, together with `park_native_playback_before_exit`. The terminal restore is a `restore_frontend` hook that runs at its old place: after `history_collector.shutdown()` and before the cloud sync. The session and then the `Driver` still drop before `clear_handshake`, and the log lines keep their order. 5. A new test, `boot_options_carry_the_launch_flags`, pins the argument mapping (the `-U` case only on builds with `self-update`). `test_attribute_total` goes from 2228 to 2229. No behaviour change. # Testing The suites ran on the top of the stack (`feat/gui-onboarding`), which contains this PR: - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -- -D warnings` on slim, headless, headless-streaming, mcp-only, ai-dj-only, default, the `gui` leg and the five-sources set with `audio-viz-cpal`: all `Finished`, no warnings. - `cargo test --locked`, `0 failed` on every leg: slim `1253 passed`, headless `851 passed`, mcp-only `1377 passed`, ai-dj-only `1530 passed` (the four dead-code warnings in `infra/dj` test helpers predate this stack), default `1630 passed`, `gui` leg `1369 passed`. On this PR's own head: `cargo clippy --locked -- -D warnings` on slim, headless and default: clean. `cargo test --no-default-features --features telemetry,tui gates`: `ok. 10 passed`. `bash tools/check_gates_ratchet.sh` against the PR below: `ok`. # Additional notes Part 2 of 7 of a stack (#578 to #584). Base: #578. Not verified here: the Linux-only MPRIS arm of `FrontendHandles` does not compile on Windows (the `default` CI leg builds it), and the `all-sources` test leg and the `macos` job run only in CI. Still to run: a live terminal launch and quit with native streaming playing, which covers the moved park, the teardown wait and the terminal restore. Known trade-off: on the error path, the `HistoryCollectorHandle` now drops at the end of `launch_ui` instead of when `start_ui` returns. The only work in between is dropping the `Driver`, `clear_handshake` and the state flush. Follow-up: `mod startup` stays gated on `tui` here. The browser frontend later in this stack widens the gate and calls `prepare_frontend` and `shutdown_frontend` with an empty restore hook. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Improvements** * App shutdown now coordinates session and state saving, terminal restoration, playback cleanup, and history synchronization. * Cleanup tasks use bounded wait times, helping the app finish shutting down even when a service or connection is slow. * Native playback teardown waits briefly for local command connections to disconnect. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Summary This gives `App` one revision counter per displayed domain, so a frontend that does not redraw every frame can tell what changed. Every build writes the counters. Only `test` and the off-by-default `gui` feature can read them; `src/gui/bridge.rs` (two PRs up) is the first reader. It also stops `current_playback_snapshot` from describing the paused Spotify track while another source starts. What changed: 1. `DisplayRevisions` (`src/core/app/display_revisions.rs`) is a private `App` field with a named counter per `DisplayDomain`: `Route`, `Status`, `Source`, `Theme`, `Playback`. Both matches are exhaustive. `App::display_revisions()` and `DisplayRevisions::get` are `cfg(any(test, feature = "gui"))`. 2. Route, Status, Source and Theme bump inside their existing funnels, and a no-op (a repeat push, a refused pop, an unchanged source or theme) bumps nothing: `push_navigation_stack`, `pop_navigation_stack`, `drop_error_routes`, `set_current_route_state`, `set_status_message`, `set_error_status_message`, `clear_status_message`, `handle_error`, `clear_api_error`, `set_active_source`, the adaptive-theme fade and `apply_settings_changes`. 3. `Action::SetTheme` goes through the new `App::set_theme_colors`, which bumps Theme only when a color changed. 4. `App::note_playback_change` compares the position-free playback view (the `PlaybackSnapshot` with `progress_ms` zeroed, `desired_volume()`, the device name, the liked flag) with the last one and bumps Playback on a difference. It runs at the producer boundaries: the tail of `Network::handle_network_event`, the pump's source-router branch, the player event loop (skipping `PositionChanged` and `Preloading`), `disconnect_streaming_player`, the end of `Driver::tick`, and `App::apply` (now a wrapper around the old match). 5. `current_playback_snapshot` returns `None` when `active_decoded_source()` holds but no source session exists yet, instead of falling through to the suspended Spotify context. Deliberate behaviour changes a user can see: 1. While Local Files, Subsonic, Internet Radio, YouTube or Qobuz fetches or probes its first track over a paused Spotify track, the OS media panels (MPRIS, Windows, macOS), Discord, the lyrics and cover-art panes and the spotatui.com now-playing card show nothing, and the window title falls back to the default. The same holds after such a start fails, for as long as the source keeps its claim on the output. `CHANGELOG.md` has the entry. # Testing The suites ran on the top of the stack (`feat/gui-onboarding`), which contains this PR: - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -- -D warnings` on slim, headless, headless-streaming, mcp-only, ai-dj-only, default, the `gui` leg and the five-sources set with `audio-viz-cpal`: all `Finished`, no warnings. - `cargo test --locked`, `0 failed` on every leg: slim `1253 passed`, headless `851 passed`, mcp-only `1377 passed`, ai-dj-only `1530 passed` (the four dead-code warnings in `infra/dj` test helpers predate this stack), default `1630 passed`, `gui` leg `1369 passed`. On this PR's own head: `cargo clippy --locked -- -D warnings` on slim, headless and default: clean. `cargo test --no-default-features --features telemetry,tui gates`: `ok. 10 passed`. `bash tools/check_gates_ratchet.sh` against the PR below: `ok`. # Additional notes Part 3 of 7 of a stack (#578 to #584). Base: #579. - 14 new tests (`test_attribute_total` 2229 to 2243) pin each funnel's bump and non-bump, a position-only change leaving Playback alone, a routed `FinishNativeQueue` moving Playback through `start_tokio`, and the `None` snapshot under a claim. - No test drives the OS panels, Discord, lyrics, cover art or the now-playing card through the new arm. They all read the snapshot the test pins. The MPRIS and macOS Now Playing arms compile only on their platforms. - Cost: `note_playback_change` builds and compares a `PlaybackSnapshot` at every boundary in every build, although only a `gui` build reads the result. - The next PR adds the Party, Devices, Search, Lyrics, Artist, Library and Queue domains and makes their fields private. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Media panels, Discord, the window title, lyrics and cover art, and the now-playing card no longer show a stale Spotify track while another source is loading or checking its first track. - Playback and display updates now stay in sync when tracks, routes, status messages, or themes change. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
spotatui-gui now opens the page before boot, and every first-launch question (the song-counter opt-in, the source picker, the Subsonic login, the Spotify app setup, the manual OAuth paste) is asked and answered there. A blocking Onboarding sends the transcript and the open question to the page and waits for its reply; a typed line comes back the way read_line returns it, the Subsonic password is a password field, and a question gives up a minute after the last page disconnects. When boot is done the same socket gets every channel. A boot error is written to the page before the process exits.
…rst check A boot error now waits up to a minute for a page before the process exits, so a browser that starts slowly still shows it. The tick loop's no-page clock starts at its first check, not before boot. A reply is queued only for the open question. The page disables its answer buttons while it reconnects, shows the first-launch transcript on the closed page only before boot, and names each source in the picker with the label and note the terminal picker uses (Source::note moves to core). The screen condition is a tested pure function, and the server tests cover a second page answering an open question and a single resync after boot.
CodeQL treats a value returned by a function named *secret* as sensitive and then taints whole config structs, so it reported three cleartext-logging alerts on log lines that print a token path and a playlist id. None of them logs the password. Onboarding::prompt_secret becomes prompt_masked, and the OnboardingAsk::Line field secret becomes masked (the page and the bindings follow).
898af80 to
b612ebe
Compare
# Summary This makes most of the display state on `App` private, so each write goes through a method that bumps the matching `DisplayRevisions` counter from the PR below. A frontend can then redraw a domain only when its revision moved. `DisplayDomain` gains `Party`, `Devices`, `Search`, `Lyrics`, `Artist`, `Library` and `Queue`. What changed: 1. `devices`, `search_results`, `party_status` and `party_session` are private. Writes go through `set_devices`, `set_search_results`, `set_party_status`, `set_party_session` and `party_session_mut`. `set_search_results` now owns the cursor clamp, and `clamp_search_cursors` is private. Readers outside `core/app` use getters. 2. `lyrics`, `lyrics_status` and `lyrics_synced` are private behind `App::set_lyrics`. The LRCLIB answer is applied by a pure `apply_lyrics_response`. 3. The artist, album and show pages stay public and bump the `Artist` revision where their producers finish (`App::bump_display` in `infra/network/metadata.rs`, and in `core/app/library.rs`). `DjState` gets a `revision` that its mutators bump: turn start and finish, transcript lines, the step, the vibe, library indexing and the two toggles. 4. The library pages, the playlist lists and folders, the saved-id sets, the user and the five per-source sidebar lists are private, with one getter and one `_mut` accessor per field. The accessor bumps the `Library` revision. The in-app pagers and sorts use it too. 5. `queue` stays public. `note_playback_change` becomes `note_display_changes`, which also compares the Spotify queue mirror, the native queue and the queue-slot track at the same boundaries and bumps `Queue` on a difference. It compares by reference and clones only on a change. 6. `show_source_search_tracks` bumps `Search` without the clamp, so a decoded-source search leaves the hidden result blocks' cursors for the next Spotify search, as before. 7. `tools/gates.count`: `pub_fields_on_app` 139 -> 117, `app_field_writes_in_tui_handlers` 186 -> 147. The setters bump only `DisplayRevisions`. The plugin data generations (`PluginDataKind`) bump where they did before, so plugins see no change. No behaviour change. # Testing The suites ran on the top of the stack (`feat/gui-onboarding`), which contains this PR: - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -- -D warnings` on slim, headless, headless-streaming, mcp-only, ai-dj-only, default, the `gui` leg and the five-sources set with `audio-viz-cpal`: all `Finished`, no warnings. - `cargo test --locked`, `0 failed` on every leg: slim `1253 passed`, headless `851 passed`, mcp-only `1377 passed`, ai-dj-only `1530 passed` (the four dead-code warnings in `infra/dj` test helpers predate this stack), default `1630 passed`, `gui` leg `1369 passed`. On this PR's own head: `cargo clippy --locked -- -D warnings` on slim, headless and default: clean. `cargo test --no-default-features --features telemetry,tui gates`: `ok. 10 passed`. `bash tools/check_gates_ratchet.sh` against the PR below: `ok`. # Additional notes Part 4 of 7 of a stack (#578 to #584). Base: #580. The Linux `all-sources` test leg and the macOS job run only in CI. Known trade-offs: - A `_mut` accessor bumps `Library` when it is called, whether or not the caller then writes. That can cause an extra redraw, never a missed one. - `DjState.revision` does not move for the setup picker or prompt edits. Those are presentation state. - Nothing outside tests reads the new revisions here. `App::display_revisions` is `cfg(any(test, feature = "gui"))`. Follow-ups: - The track table (`track_table`, `playlist_track_*`, `recently_played`) stays public with no revision. - `App::raise_spotify_key_tier` (from #577) changes the artist page's empty Top Tracks text without an `Artist` bump. Nothing sends the artist page to a frontend yet, so it can bump when something does. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Search results now consistently reset or clamp table cursors when replaced. * Updates to playlists, search results, lyrics, devices, artist information, queues, and party and DJ state are reflected more reliably in the display. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Summary `spotatui-gui` was a placeholder that exited. It now boots like the terminal UI (the same instance lock, `boot` and `prepare_frontend`), serves an embedded page and a WebSocket on `127.0.0.1`, and opens the browser at it. What changed: 1. `src/gui/server.rs`: a loopback server on `httparse` and `tokio_tungstenite::accept_hdr_async`. It checks `Host`, `Origin` and `Sec-Fetch-Site` against DNS rebinding and cross-site pages, sends `no-store`, `nosniff` and a strict CSP, and bounds each request and handshake at 5 s. 2. The browser opens at `/#code=<code>`. The code is single-use, lives 60 s and is traded for a session token in `hello`. On Linux the server also refuses loopback peers of other users (`/proc/net/tcp`). 3. `src/gui/protocol.rs` and `src/gui/bridge.rs`: `ClientMessage` in (`action` through `App::apply`, `quit`), `Message` out: `hello`, a resync, then each channel whose display revision moved (route, status, theme, playback, devices, queue) and a position `tick` about every 250 ms. 4. `src/runtime/gui.rs`: a tick loop without a terminal. It boots with `no_update: true` and quits on Ctrl-C, a `quit` from the page, or a minute with no page. 5. `build.rs` embeds `gui/dist`. Without it `/` answers 503 with a build hint. 6. `src/bin/spotatui-gui.rs` calls `run_gui`. A windowed release build on Windows with no console shows its startup error in a message box. 7. `src/infra/loopback.rs` shares the token helpers with the MCP control socket. 8. A `gui` leg in `ci.yml` (check, clippy, test), the third leg without `tui`. Deliberate behaviour changes a user can see: 1. Default and release builds: none. `gui` is off by default and no release enables it. 2. `spotatui-gui` runs instead of exiting, and refuses to start beside another spotatui UI. 3. On a fresh profile it stops and asks for one run of the terminal `spotatui` first. # Testing The suites ran on the top of the stack (`feat/gui-onboarding`), which contains this PR: - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -- -D warnings` on slim, headless, headless-streaming, mcp-only, ai-dj-only, default, the `gui` leg and the five-sources set with `audio-viz-cpal`: all `Finished`, no warnings. - `cargo test --locked`, `0 failed` on every leg: slim `1253 passed`, headless `851 passed`, mcp-only `1377 passed`, ai-dj-only `1530 passed` (the four dead-code warnings in `infra/dj` test helpers predate this stack), default `1630 passed`, `gui` leg `1369 passed`. On this PR's own head: `cargo clippy --locked -- -D warnings` on slim, headless, default and the `gui` leg (`--no-default-features --features telemetry,gui,streaming,discord-rpc,self-update,scripting,mcp-server,mpris`): clean. `cargo test --no-default-features --features telemetry,tui gates`: `ok. 10 passed`. `bash tools/check_gates_ratchet.sh` against the PR below: `ok`. # Additional notes Part 5 of 7 of a stack (#578 to #584). Base: #581. Rebased onto #574 and #577. Beyond mechanical merges, the last commit makes `run_gui` open its log through the same `start_logging` as `run_cli`: `SPOTATUI_LOG`, a bare `--debug` (the crash notice asks for it), and the startup header. Not verified here: the Linux peer check and the MPRIS build without `tui` run only in the `gui` CI leg, and no CI job builds `gui` on macOS. A live pass on Windows ran against the top of the stack before the rebase. This layer alone ships no page. Residual risk: the launch code sits in the browser's command line while it starts. macOS has no peer check, so another local user there could race it. A private redirect file would keep the code out of argv, but snap-confined browsers cannot read one. `Source`, `Party`, `Search`, `Lyrics`, `Artist` and `Library` have revisions but no message yet. The next PR adds the page, and the top PR moves the first-launch questions into it. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a browser-based frontend, available through the GUI app. It opens in your default browser and supports playback, queue, theme, device, and other app updates. * Added secure local access controls for browser connections. * Added a GUI feature configuration to the CI matrix. * **Improvements** * Help, version, and command-line usage errors now appear before a log file is created. * Shared startup and shutdown behavior now supports both the terminal and browser frontends. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
# Summary This adds the browser side of `spotatui-gui`: TypeScript types generated from the Rust wire types, and a React page in `gui/` that talks to the loopback server from the PR below. The page is a placeholder that exercises the bridge and the CI gates. It is not a design, and the designed screens will replace it. What changed: 1. `Action`, the types it carries and the GUI protocol types derive `ts_rs::TS` under `cfg_attr(all(test, feature = "gui"), ...)`. `ts-rs` is a dev-dependency pinned to `=12.0.1`, so no shipped binary changes. The protocol enum `Message` is now `ServerMessage`. 2. `typescript_bindings_are_written_to_the_frontend_source_tree` rewrites `gui/src/bindings/` with `u64` as `number`, and fails when two exported types share a name or any file contains `bigint`. The `gui` test row in `ci.yml` fails when the committed files drift. 3. `gui/` is Vite + React + TypeScript: a queue list and a now-playing bar (art, title, artists, a progress bar interpolated from the tick, Previous, Play/Pause, Next), coloured from the theme channel. 4. `gui/src/connection.ts` trades the launch code for the session token and keeps the token in `localStorage`. It reconnects 1 s after a drop that followed a hello. A close before hello shows "This page is no longer connected to spotatui." 5. The new `gui.yml` runs `npm ci`, `lint`, `format:check`, `typecheck`, vitest and the build on every PR, with no paths filter. 6. `Cargo.toml` excludes `/gui/` from the published crate. The pattern is anchored, so `src/gui` stays in. 7. The page's `Content-Security-Policy` allows `http:` images, since many Subsonic servers serve cover art over http. Deliberate behaviour changes a user can see: Only builds with the `gui` feature change. It is off by default and no release ships it. 1. With `gui/dist` built, `spotatui-gui` serves this page instead of the "built without its frontend" answer. 2. A closed tab reopened at the same address reconnects to the running spotatui. Each run issues its own token. # Testing The suites ran on the top of the stack (`feat/gui-onboarding`), which contains this PR: - `cargo fmt --all -- --check`: clean. - `cargo clippy --locked -- -D warnings` on slim, headless, headless-streaming, mcp-only, ai-dj-only, default, the `gui` leg and the five-sources set with `audio-viz-cpal`: all `Finished`, no warnings. - `cargo test --locked`, `0 failed` on every leg: slim `1253 passed`, headless `851 passed`, mcp-only `1377 passed`, ai-dj-only `1530 passed` (the four dead-code warnings in `infra/dj` test helpers predate this stack), default `1630 passed`, `gui` leg `1369 passed`. - Bindings drift after the `gui` leg test: `git status --porcelain gui/src/bindings` prints nothing. - In `gui/`: `npm ci` (`found 0 vulnerabilities`), `npm run lint`, `npm run format:check` (`All matched files use Prettier code style!`), `npm run typecheck`, `npm test` (`Tests 21 passed (21)`), `npm run build` (`✓ built`). On this PR's own head: `cargo clippy --locked -- -D warnings` on slim, headless, default and the `gui` leg: clean. `cargo test --no-default-features --features telemetry,tui gates`: `ok. 10 passed`. `bash tools/check_gates_ratchet.sh` against the PR below: `ok`. # Additional notes Part 6 of 7 of a stack (#578 to #584). Base: #582. Not verified here: no CI job embeds the built page into the binary (the `gui` leg builds without `gui/dist`), so serving it rests on a manual run on Windows. `npm ci` has only run on Windows, and `gui.yml` is the lockfile's first Linux install. No browser on macOS or Linux was tried. Trade-offs and follow-ups: - `ts-rs` compiles on every test leg, though only the `gui` leg uses it. A Dependabot bump of it fails the drift step until the bindings are regenerated, by design. - `typescript` is pinned `~6.0` because `typescript-eslint` accepts `<6.1.0`. - Dependabot has no npm entry for `gui/` yet. - The queue list skips Spotify queue episodes. --- <sub>💬 Questions or want to chat with other contributors? Join the [spotatui Discord](https://spotatui.com/discord).</sub> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a web-based GUI for viewing the playback queue and now-playing details, with playback controls and theme support. * Added automatic reconnection and connection status feedback. * **Quality Improvements** * Added automated checks for the GUI, including linting, formatting, type checks, tests, and builds. * Enabled checks to detect outdated frontend bindings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Until now
spotatui-guicould not run the first-launch setup: every question failed boot with a hint to run the terminalspotatuionce. This moves those questions into the page. The listener now starts before boot and serves only the questions until boot is done. Boot asks each question through a blockingOnboardingthat waits for the page's reply.What changed:
src/gui/onboarding.rsaddsBrowserOnboarding. It keeps anOnboardingView(the transcript and the open question) in awatchchannel.ask_pageblocks until a reply with the open question'sseqarrives, andanswerdrops any other reply. A typed line comes back the wayread_linereturns it.launch_guistarts the listener and opens the browser beforebootstrap::boot, and passesBrowserOnboardingto it.TerminalSetupRequiredand its test are removed. After boot the app is published through awatch(SharedApp), and each open socket resyncs once.ServerMessage::Onboardingsends the view on connect and on every change.ClientMessage::Onboardingcarries anOnboardingReply.run_sockethandles it itself, because the tick loop does not exist during boot. The TypeScript bindings are regenerated.Onboarding::prompt_maskeddefaults toprompt_line.configure_subsonicreads the password through it, andOnboardingAsk::Linecarriesmasked. (The name avoids CodeQL's sensitive-name heuristic, which reported the path log lines that the config later reaches.)Source::notemoves fromtui/first_run.rstocore::source, so the page and the terminal picker show the same text.Publisher::alone_sinceis now anOptionset at the tick loop's first check, so boot time no longer counts toward the minute without a page.Onboarding.tsx(a text or password field, yes/no buttons, source checkboxes) andshowsOnboarding. Answer buttons are disabled while the socket reconnects.Deliberate behaviour changes a user can see:
spotatui-guiasks the song-counter opt-in, the source picker, the Subsonic login, the Spotify app setup and the manual OAuth paste in the browser.Testing
The suites ran on the top of the stack (
feat/gui-onboarding), which contains this PR:cargo fmt --all -- --check: clean.cargo clippy --locked -- -D warningson slim, headless, headless-streaming, mcp-only, ai-dj-only, default, theguileg and the five-sources set withaudio-viz-cpal: allFinished, no warnings.cargo test --locked,0 failedon every leg: slim1253 passed, headless851 passed, mcp-only1377 passed, ai-dj-only1530 passed(the four dead-code warnings ininfra/djtest helpers predate this stack), default1630 passed,guileg1369 passed.guileg test:git status --porcelain gui/src/bindingsprints nothing.gui/:npm ci(found 0 vulnerabilities),npm run lint,npm run format:check(All matched files use Prettier code style!),npm run typecheck,npm test(Tests 21 passed (21)),npm run build(✓ built).On this PR's own head (the top):
cargo clippy --locked -- -D warningson slim, headless, default and theguileg: clean.cargo test --no-default-features --features telemetry,tui gates:ok. 10 passed.bash tools/check_gates_ratchet.shagainst the PR below:ok.Additional notes
Part 7 of 7 of a stack (#578 to #584). Base: #583.
The page and the question layout are still placeholders that exercise the bridge. Designed screens replace them later.
A live first run on an empty profile worked on Windows before the rebase onto #574 and #577. After it, #577's notice about a forgotten key tier also goes through
Onboarding::info, so it lands in the page transcript; that path is not seen live yet. Not run: a first run on Linux or macOS.Known trade-offs: a boot error that no page receives within a minute is only in the log, and the error line in the page does not name the log file. A question waits for as long as a page stays connected.
Follow-up:
spotatui-guistill boots withno_update: true, so it does not update itself.💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit