Repository navigation
refactor(runtime): extract native-streaming startup - #486
Conversation
Move the credential gate, the deferred librespot bring-up, and the saved-device decision out of the tui-gated startup.rs into runtime/streaming/, gated on streaming. The pure decision lives in mod.rs, the bring-up in launch.rs. Add a headless-streaming CI leg (telemetry,streaming; check + clippy) so the startup builds with no terminal frontend.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe PR moves native streaming startup into ChangesNative streaming startup
Estimated code review effort: 4 (Complex) | ~60 minutes Merge Risk: ⚪ Minimal · up to The PR reorganizes streaming startup behind its feature gate and adds headless build coverage; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant launch_ui
participant cache_streaming_credentials
participant deferred_streaming_startup
participant Spotify
participant librespot
participant App
launch_ui->>cache_streaming_credentials: Cache streaming credentials
cache_streaming_credentials->>Spotify: Probe account and refresh /me
launch_ui->>deferred_streaming_startup: Pass deferred startup context
deferred_streaming_startup->>Spotify: Validate account and fetch devices
deferred_streaming_startup->>librespot: Initialize streaming player
librespot->>App: Wire player and recovery events
deferred_streaming_startup->>App: Refresh playlists and replay playback
🚥 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
Move the native-streaming startup out of the
tui-gatedruntime/startup.rsinto a newruntime/streaming/module, gated onstreaming:streaming/mod.rsholds the pure saved-device decision (startup_device_decision) and its tests.streaming/launch.rsholds the credential gate (cache_streaming_credentials), the deferred librespot bring-up (deferred_streaming_startup), andDeferredStreamingContext.startup.rskeeps only the UI-launch half and calls the module.The code is moved, not changed. There are two differences beyond the move: the inline credential gate became a function with early returns, and the recovery supervisor spawn moved (see Additional notes). The
Bootdead-code attributes inbootstrap.rsnow match the new gates.Add a
headless-streamingCI leg (telemetry,streaming,check+clippy) so the streaming startup and the player-event wiring build with no terminal frontend in scope. This is the combination a second frontend or a daemon consumes, and nothing covered it before. The three doc copies describe the seven-leg matrix and the newruntime/streaming/unit.Testing
cargo fmt --all -- --check: cleancargo clippy --no-default-features --features telemetry,tui -- -D warnings: cleancargo test --no-default-features --features telemetry,tui: 867 passed, 0 failedcargo clippy --no-default-features --features telemetry,streaming -- -D warnings(the new leg): cleancargo clippy --no-default-features --features telemetry -- -D warnings: cleancargo test(default features): 1167 passed, 0 failedAdditional notes
launch.rscarryallow(dead_code)withouttui, so the new leg proves they compile with no terminal frontend, not that they are live there. The leg has notestjob.spotatui daemonsubcommand (Daemon mode: persistent headless Connect device for CLI playback #466), which needs the streaming startup withouttui.deferred_streaming_startupnow takesrecovery_rxand spawnsplayer::spawn_streaming_recovery_handleritself, so the recovery supervisor starts only when streaming is attempted. Before, it started whenever thestreamingfeature was on. Every recovery-request sender needs a live player, and theAppsender handles a dropped receiver, so nothing observable changes.startup.rsinstalls the sender on the same condition. This keeps the recovery chain live on the new leg.💬 Questions or want to chat with other contributors? Join the spotatui Discord.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation