Skip to content

refactor(core): split app.rs into a src/core/app/ module folder - #446

Merged
LargeModGames merged 4 commits into
mainfrom
refactor/core-app-module
Aug 12, 2026
Merged

LargeModGames merged 4 commits into
mainfrom
refactor/core-app-module

Conversation

@LargeModGames

@LargeModGames LargeModGames commented Aug 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

src/core/app.rs had grown to 10,920 lines. This splits it into a src/core/app/ folder of 33 files grouped by concern, with no behavior change:

  • The App struct stays flat — all ~237 fields declared once in mod.rs; each module contributes its own impl App block for its ~210 methods.
  • mod.rs blanket re-exports every module, so crate::core::app::<Name> paths are unchanged — no file outside the folder is touched.
  • Child modules open with use super::*; and declare no imports of their own; all external imports stay in mod.rs.
  • Pure code movement, verified byte-identically: the only deltas are 8 private items widened to pub(super) where a sibling module now calls them, 7 test modules gated by the cfg all their tests share, and the module scaffolding. Tests are colocated per module; the six shared fixtures moved to test_support.rs.

Also refreshes the agent guidance docs (CLAUDE.md / AGENTS.md / copilot-instructions) for the new layout, and corrects the CI section: the matrix has five legs, not three — the undocumented mcp-only and ai-dj-only legs build dj-core without streaming, a combination nothing else covers.

Testing

All five CI legs run locally (Windows):

  • cargo fmt --all
  • cargo clippy -- -D warnings — clean; cargo test — 847 passed
  • cargo clippy --no-default-features --features telemetry -- -D warnings — clean; cargo test (slim) — 568 passed
  • cargo clippy --locked --no-default-features --features telemetry,mcp-server -- -D warnings — clean; tests — 684 passed
  • cargo clippy --locked --no-default-features --features telemetry,ai-dj -- -D warnings — clean; tests — 827 passed
  • all-sources clippy (minus Linux-only audio-viz) — clean; 14-feature cargo test — 1261 passed, 1 failed

The one failure is infra::local::tests::uri_round_trip, pre-existing and Windows-only (Url::to_file_path() rejects the hardcoded /home/user/... path); it passes on CI's ubuntu-latest. Test totals are identical before and after the split (84 #[test] in the moved code; 1277 in the full suite).

Additional notes

  • The diff reads as ~11k added / ~11k deleted because one file became 33; the net +403 lines are import blocks and impl App { } / mod tests { } wrappers, not duplicated code.
  • Follow-up (not this PR): load_settings_for_category (736 lines) and apply_settings_changes (715 lines) moved verbatim and dominate their files; breaking them into per-category helpers needs its own review.
  • Pre-existing, untouched: --all-features cannot build on Windows (alsa-sys needs pkg-config), and audio-viz off-Linux hits a SpectrumData double-definition in src/infra/audio/mod.rs.

Summary by CodeRabbit

  • New Features

    • Added Discover recommendations, friends management, playlist folders, library navigation, and plugin command support.
    • Added adaptive album artwork themes, lyrics scrolling, announcements, and expanded settings controls.
    • Improved native playback, shuffle/repeat, queue management, seeking, volume controls, and playback recovery.
    • Added playlist filtering, pagination, saved-item navigation, radio-station persistence, and URL copying.
    • Added improved keyboard shortcut handling, including macOS fallback support.
  • Documentation

    • Expanded build, contribution, architecture, feature, and testing guidance.

Move the 10,920-line app.rs into 33 files grouped by concern. The App
struct stays flat in mod.rs and each module contributes its own
impl App block. mod.rs blanket re-exports every module, so
crate::core::app::<Name> paths are unchanged outside the folder and no
caller in tui/ or infra/ needed touching.

Behaviour is unchanged: this is pure code movement plus eight private
items widened to pub(super) where a sibling module calls them, and the
per-module import blocks. Tests are colocated with the code they cover,
with the six shared fixtures in test_support.rs.

Also refresh CLAUDE.md for the new layout and correct its CI section:
the matrix has five legs, not three. The two undocumented ones
(mcp-only, ai-dj-only) build dj-core without streaming, which no other
leg covers. Mirror the whole file into AGENTS.md, which had drifted.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f44e77fa-2e08-462e-8506-3428cab02554

📥 Commits

Reviewing files that changed from the base of the PR and between 579fc53 and 9e7a234.

📒 Files selected for processing (2)
  • src/core/app/playlist_pages.rs
  • src/core/app/scrollable_pages.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/app/playlist_pages.rs

📝 Walkthrough

Walkthrough

The PR modularizes App across feature-focused Rust modules. It adds playback recovery, queueing, navigation, settings, persistence, library workflows, feature integrations, tests, and synchronized repository development guidance.

Changes

Application modularization

Layer / File(s) Summary
Synchronized repository guidance
.github/copilot-instructions.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md
Documents synchronized instruction copies, build commands, the five-leg CI matrix, architecture rules, feature behavior, persistence, and testing conventions.
App state, navigation, and settings
src/core/app/mod.rs, src/core/app/construction.rs, src/core/app/models.rs, src/core/app/route.rs, src/core/app/settings_schema.rs, src/core/app/settings_apply.rs, src/core/app/album_theme.rs, src/core/app/keybindings.rs, src/core/app/status.rs
Adds the modular App state container, constructors, navigation stack, settings schema and application, adaptive album themes, keybinding fallback handling, announcements, and status errors.
Playback routing, recovery, and persistence
src/core/app/playback_routing.rs, src/core/app/queue.rs, src/core/app/native_backend.rs, src/core/app/native_recovery.rs, src/core/app/native_shuffle.rs, src/core/app/queue_suspend.rs, src/core/app/shuffle_repeat.rs, src/core/app/seek.rs, src/core/app/transport.rs, src/core/app/volume.rs, src/core/app/tick.rs, src/core/app/persistence.rs
Adds source ownership detection, native queue and shuffle state, recovery generations, suspension and resume handling, transport controls, seeking, volume routing, tick processing, runtime persistence, and radio-station persistence.
Library, playlists, and pagination
src/core/app/library.rs, src/core/app/playlist_folders.rs, src/core/app/playlist_pages.rs, src/core/app/playlists.rs, src/core/app/scrollable_pages.rs
Adds library navigation, playlist folders, community-playlist display, editable playlist flows, continuous pagination, filtering, sorting, cached-page handling, and route-aware table validation.
Feature integrations and supporting state
src/core/app/discover.rs, src/core/app/dj.rs, src/core/app/friends.rs, src/core/app/help.rs, src/core/app/lyrics.rs, src/core/app/plugins.rs, src/core/app/test_support.rs
Adds recommendation dispatch, DJ queue cleanup, friends dialog state, help pagination, lyrics scrolling, plugin data generations, and shared application fixtures.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the valid refactor prefix, names the core scope, and concisely describes the app.rs module split.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/core-app-module
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch refactor/core-app-module

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

🧹 Nitpick comments (6)
src/core/app/playlist_pages.rs (1)

158-172: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use replace_track_table_tracks for search results. The direct assignment leaves pending_track_table_selection set. A later table replacement can consume it and move the selection in the filtered table. Call the helper before restoring playlist_track_positions, then set selected_index = 0.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/app/playlist_pages.rs` around lines 158 - 172, The search-results
update in the playlist filtering flow should use replace_track_table_tracks
instead of directly assigning track_table.tracks, so
pending_track_table_selection is cleared. Invoke the helper with the collected
tracks, then restore playlist_track_positions and set track_table.selected_index
to 0.
src/core/app/mod.rs (1)

670-680: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Replace println! in dispatch with a log call.

dispatch runs while the TUI owns the terminal. A println! writes into the alternate screen and corrupts the frame until the next full redraw. The failure also has no visible surface for the user.

The dispatch_without_spinner sibling below already uses log::warn! for the same send failure, so this is also an inconsistency inside the same impl block.

♻️ Proposed change
     if let Some(io_tx) = &self.io_tx {
       if let Err(e) = io_tx.send(action) {
         self.is_loading = false;
-        println!("Error from dispatch {}", e);
-        // TODO: handle error
+        log::error!("dispatch failed (shutting down?): {e}");
       };
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/app/mod.rs` around lines 670 - 680, Replace the println! error
output in dispatch with the existing log::warn! pattern used by
dispatch_without_spinner, preserving the send-error handling and is_loading
reset while ensuring the failure is reported through logging rather than
terminal output.
src/core/app/library.rs (1)

191-212: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Avoid cloning the whole artist page cache to read one page.

Line 203 clones self.library.saved_artists (every cached page of ArtistInfo) only to read the last item's id. This runs on each "next page" keypress. Take the id first, then dispatch, so no clone is needed.

♻️ Proposed refactor
       None => {
-        if let Some(saved_artists) = &self.library.saved_artists.clone().get_results(None) {
-          if let Some(last_artist) = saved_artists.items.last() {
-            if let Some(after) = last_artist.id.as_deref() {
-              self.dispatch(IoEvent::GetFollowedArtists(Some(after.to_string())));
-            }
-          }
-        }
+        let after = self
+          .library
+          .saved_artists
+          .get_results(None)
+          .and_then(|saved_artists| saved_artists.items.last())
+          .and_then(|last_artist| last_artist.id.clone());
+        if let Some(after) = after {
+          self.dispatch(IoEvent::GetFollowedArtists(Some(after)));
+        }
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/app/library.rs` around lines 191 - 212, Update
get_current_user_saved_artists_next so the fallback reads the last artist ID
from saved_artists without cloning the entire library.saved_artists cache.
Borrow the cached page, extract or copy the required ID before dispatching
IoEvent::GetFollowedArtists, and preserve the existing behavior when no page,
artist, or ID is available.
src/core/app/seek.rs (1)

75-88: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Extract the native seek throttle into a helper.

The same 14-line throttle-and-queue block appears three times: seek_forwards, seek_backwards, and seek_to. The file already establishes this pattern with queue_source_seek and queue_api_seek. A queue_native_seek helper removes the duplication and keeps the three transports consistent when the throttle changes.

♻️ Proposed refactor

Add the helper next to queue_source_seek:

  /// Queue a native librespot seek with throttling
  #[cfg(feature = "streaming")]
  fn queue_native_seek(&mut self, position_ms: u32) {
    // Always update UI immediately
    self.song_progress_ms = position_ms as u128;
    self.seek_ms = None;

    const SEEK_THROTTLE_MS: u128 = 50;
    let should_seek_now = self
      .last_native_seek
      .is_none_or(|t| t.elapsed().as_millis() >= SEEK_THROTTLE_MS);

    if should_seek_now {
      self.execute_native_seek(position_ms);
    } else {
      self.pending_native_seek = Some(position_ms);
    }
  }

Then replace each of the three blocks, for example in seek_forwards:

       #[cfg(feature = "streaming")]
       if self.is_native_streaming_active_for_playback() && self.streaming_player.is_some() {
-        // Always update UI immediately
-        self.song_progress_ms = new_progress as u128;
-        self.seek_ms = None;
-
-        // Throttle actual seeks to avoid overwhelming librespot (max ~20/sec)
-        const SEEK_THROTTLE_MS: u128 = 50;
-        let should_seek_now = self
-          .last_native_seek
-          .is_none_or(|t| t.elapsed().as_millis() >= SEEK_THROTTLE_MS);
-
-        if should_seek_now {
-          self.execute_native_seek(new_progress);
-        } else {
-          // Queue the seek - will be flushed by tick loop or next seek
-          self.pending_native_seek = Some(new_progress);
-        }
+        self.queue_native_seek(new_progress);
         return;
       }

Also applies to: 125-138, 179-192

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/app/seek.rs` around lines 75 - 88, Extract the duplicated native
seek throttling and queueing logic from seek_forwards, seek_backwards, and
seek_to into a #[cfg(feature = "streaming")] queue_native_seek method beside
queue_source_seek. Move the immediate UI updates, throttle check,
execute_native_seek call, and pending_native_seek assignment into that helper,
then have all three methods call it with the target position.
src/core/app/volume.rs (2)

95-147: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Delegate increase_volume and decrease_volume to set_volume_percent.

set_volume_percent, increase_volume, and decrease_volume each carry the same three routing branches: decoded source, native streaming with MPRIS notification, and API coalescing. That is roughly 40 duplicated lines per method, including the #[cfg(all(feature = "mpris", target_os = "linux"))] block. increase_volume and decrease_volume differ only in how they compute the target. Delegating keeps the three volume entry points behaviorally identical when the routing changes.

♻️ Proposed refactor
   pub fn increase_volume(&mut self) {
     let current_volume = self.desired_volume() as u8;
-    let next_volume = min(
-      current_volume + self.user_config.behavior.volume_increment,
-      100,
-    );
-
-    if next_volume != current_volume {
-      info!("increasing volume: {} -> {}", current_volume, next_volume);
-      // ... three routing branches ...
-    }
+    let next_volume = current_volume
+      .saturating_add(self.user_config.behavior.volume_increment)
+      .min(100);
+    info!("increasing volume: {} -> {}", current_volume, next_volume);
+    self.set_volume_percent(next_volume);
   }

set_volume_percent already returns early when the target equals desired_volume(), so the no-change guard is preserved. Drop the #[cfg_attr(not(feature = "scripting"), allow(dead_code))] on set_volume_percent once the keyboard paths call it.

Also applies to: 151-208

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/app/volume.rs` around lines 95 - 147, Refactor increase_volume and
decrease_volume to compute their target percentages and delegate to
set_volume_percent, removing their duplicated decoded-source,
native-streaming/MPRIS, and API-coalescing routing logic. Preserve
set_volume_percent’s existing no-change handling and update its dead-code
annotation since the keyboard paths now use it.

151-159: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Avoid the i8 round trip in decrease_volume.

self.desired_volume() as i8 truncates any value above 127 into a negative number. The arithmetic stays in range today only because settings_apply.rs clamps volume_increment to 0..100 (Line 33) and Spotify reports volume_percent in 0..100. Both invariants live outside this function. saturating_sub on u8 removes the dependency and drops the later as u8 cast at Line 159.

♻️ Proposed refactor
   pub fn decrease_volume(&mut self) {
-    let current_volume = self.desired_volume() as i8;
-    let next_volume = max(
-      current_volume - self.user_config.behavior.volume_increment as i8,
-      0,
-    );
+    let current_volume = self.desired_volume().min(100) as u8;
+    let next_volume_u8 = current_volume.saturating_sub(self.user_config.behavior.volume_increment);
 
-    if next_volume != current_volume {
-      let next_volume_u8 = next_volume as u8;
+    if next_volume_u8 != current_volume {
       info!(
         "decreasing volume: {} -> {}",
         current_volume, next_volume_u8
       );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/app/volume.rs` around lines 151 - 159, Update decrease_volume to
keep volume arithmetic in u8: replace the desired_volume as i8 conversion and
max-based subtraction with u8 saturating_sub using the configured volume
increment, and remove the unnecessary next_volume_u8 cast while preserving the
existing zero-floor behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/copilot-instructions.md:
- Line 83: Update the synchronized data-flow diagram fences to specify the text
language: change the opening fence at .github/copilot-instructions.md lines
83-83, AGENTS.md lines 85-85, and CLAUDE.md lines 85-85 to ```text.

In `@src/core/app/friends.rs`:
- Around line 52-63: Update App::clear_dialog_state() to centrally close the
friend dialog and reset its associated state, including
friend_add_dialog_visible and related fields. Change
clear_friend_add_dialog_state() into an initialization-only helper for fields
needed before opening, and have open_friend_add_dialog() use the central
clear_dialog_state() path so generic dialog, confirmation, and keybinding state
is also cleared.

In `@src/core/app/library.rs`:
- Around line 270-278: Replace every UI-selected direct index in the affected
match arms with bounds-checked `.get()` access: album and artist selections,
related-artist selections, and the show selection. Preserve each arm’s existing
behavior by continuing only when the selected item exists, then access its
fields and dispatch the same events; update the handlers around
`ActiveBlock::SearchResultBlock` and the other listed match arms consistently.

In `@src/core/app/persistence.rs`:
- Around line 309-321: Update flush_state_save so a failed save restores
state_save_due, allowing subsequent ticks and forced shutdown flushes to retry
the retained pending_state_save_patch. Lift the debounce duration currently
local to schedule_state_save into a shared module-level constant, and reuse that
constant when restoring the deadline and scheduling saves.
- Around line 244-256: Update the Added branch in add_radio_station so a missing
station lookup at before_len is not returned as successful without persistence:
roll back the in-memory radio_stations state consistently with the
save_runtime_state error path, or propagate an appropriate error instead of
returning Ok(RadioStationAddOutcome::Added).

In `@src/core/app/playlist_folders.rs`:
- Around line 82-92: Update get_playlist_display_count and
get_playlist_display_item_at to use the same raw-page fallback when
playlist_folder_items is empty: include the rendered “+ Add Playlist” row,
community pin, and every item in self.playlists, matching the renderer’s row
order and indexing. Preserve the existing folder-item behavior when
playlist_folder_items is populated.

In `@src/core/app/playlists.rs`:
- Around line 189-197: Prevent stale search-result indices from panicking in
both user_follow_playlist at src/core/app/playlists.rs#L189-L197 and
user_unfollow_playlist_search_result at src/core/app/playlists.rs#L236-L244 by
replacing direct playlists.items indexing with checked get access and returning
early when no item exists.

In `@src/core/app/queue.rs`:
- Around line 176-194: Update the doc comment for the native-streaming
EndOfTrack handler to state that it covers three cases instead of two, leaving
the three bullet descriptions and implementation unchanged.

In `@src/core/app/scrollable_pages.rs`:
- Around line 30-34: The offset-keyed page cache must remain sorted by page
offset, but ScrollableResultPages::add_pages currently appends unsafely. In
src/core/app/scrollable_pages.rs:30-34, restrict or remove add_pages for
offset-keyed caches so callers use upsert_page_by_offset; in
src/core/app/playlist_pages.rs:44-79, update the offset-keyed test setup to use
upsert_page_by_offset and add coverage proving out-of-order insertion preserves
page_index_for_offset lookups and contiguity traversal.

In `@src/core/app/seek.rs`:
- Around line 61-64: Update the forward-seek target calculation in the seek
logic around new_progress to use saturating_add when combining old_progress with
self.user_config.behavior.seek_milliseconds, then retain the existing min cap at
duration_ms. Match the saturating arithmetic used by the sibling seek paths.

In `@src/core/app/transport.rs`:
- Around line 211-219: Guard all deferred skip-thread commands against stale
playback intent and generation. In src/core/app/transport.rs lines 211-219
within previous_track, capture the native playback generation before spawning
and skip the delayed play when the generation changes or native playback intent
is paused; apply the equivalent generation guard to both delayed prev and play
commands in force_previous_track at lines 261-268 and to the delayed play in
next_track at lines 335-340.

---

Nitpick comments:
In `@src/core/app/library.rs`:
- Around line 191-212: Update get_current_user_saved_artists_next so the
fallback reads the last artist ID from saved_artists without cloning the entire
library.saved_artists cache. Borrow the cached page, extract or copy the
required ID before dispatching IoEvent::GetFollowedArtists, and preserve the
existing behavior when no page, artist, or ID is available.

In `@src/core/app/mod.rs`:
- Around line 670-680: Replace the println! error output in dispatch with the
existing log::warn! pattern used by dispatch_without_spinner, preserving the
send-error handling and is_loading reset while ensuring the failure is reported
through logging rather than terminal output.

In `@src/core/app/playlist_pages.rs`:
- Around line 158-172: The search-results update in the playlist filtering flow
should use replace_track_table_tracks instead of directly assigning
track_table.tracks, so pending_track_table_selection is cleared. Invoke the
helper with the collected tracks, then restore playlist_track_positions and set
track_table.selected_index to 0.

In `@src/core/app/seek.rs`:
- Around line 75-88: Extract the duplicated native seek throttling and queueing
logic from seek_forwards, seek_backwards, and seek_to into a #[cfg(feature =
"streaming")] queue_native_seek method beside queue_source_seek. Move the
immediate UI updates, throttle check, execute_native_seek call, and
pending_native_seek assignment into that helper, then have all three methods
call it with the target position.

In `@src/core/app/volume.rs`:
- Around line 95-147: Refactor increase_volume and decrease_volume to compute
their target percentages and delegate to set_volume_percent, removing their
duplicated decoded-source, native-streaming/MPRIS, and API-coalescing routing
logic. Preserve set_volume_percent’s existing no-change handling and update its
dead-code annotation since the keyboard paths now use it.
- Around line 151-159: Update decrease_volume to keep volume arithmetic in u8:
replace the desired_volume as i8 conversion and max-based subtraction with u8
saturating_sub using the configured volume increment, and remove the unnecessary
next_volume_u8 cast while preserving the existing zero-floor behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d93a575c-6263-4397-8cf0-3302d625bed0

📥 Commits

Reviewing files that changed from the base of the PR and between 0d7afa2 and c8231fd.

📒 Files selected for processing (38)
  • .github/copilot-instructions.md
  • AGENTS.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • src/core/app.rs
  • src/core/app/album_theme.rs
  • src/core/app/construction.rs
  • src/core/app/discover.rs
  • src/core/app/dj.rs
  • src/core/app/friends.rs
  • src/core/app/help.rs
  • src/core/app/keybindings.rs
  • src/core/app/library.rs
  • src/core/app/lyrics.rs
  • src/core/app/mod.rs
  • src/core/app/models.rs
  • src/core/app/native_backend.rs
  • src/core/app/native_recovery.rs
  • src/core/app/native_shuffle.rs
  • src/core/app/persistence.rs
  • src/core/app/playback_routing.rs
  • src/core/app/playlist_folders.rs
  • src/core/app/playlist_pages.rs
  • src/core/app/playlists.rs
  • src/core/app/plugins.rs
  • src/core/app/queue.rs
  • src/core/app/queue_suspend.rs
  • src/core/app/route.rs
  • src/core/app/scrollable_pages.rs
  • src/core/app/seek.rs
  • src/core/app/settings_apply.rs
  • src/core/app/settings_schema.rs
  • src/core/app/shuffle_repeat.rs
  • src/core/app/status.rs
  • src/core/app/test_support.rs
  • src/core/app/tick.rs
  • src/core/app/transport.rs
  • src/core/app/volume.rs

Comment thread .github/copilot-instructions.md Resolved
Comment thread src/core/app/friends.rs Resolved
Comment thread src/core/app/library.rs Resolved
Comment thread src/core/app/persistence.rs Resolved
Comment thread src/core/app/persistence.rs Resolved
Comment thread src/core/app/playlists.rs Resolved
Comment thread src/core/app/queue.rs Resolved
Comment thread src/core/app/scrollable_pages.rs Resolved
Comment thread src/core/app/seek.rs Resolved
Comment thread src/core/app/transport.rs Resolved
Pre-existing issues CodeRabbit flagged on the moved code, fixed where
the change is small and mechanical:

- library.rs, playlists.rs: replace unchecked search-result indexing
  with .get() in the seven arms that still panicked on a stale
  UI-selected index; adjacent arms already used the checked form.
- seek.rs: saturating_add on the forward-seek target, matching the
  three sibling seek paths.
- persistence.rs: a failed debounced save now restores the deadline so
  the retained patch is retried instead of dropped (including at
  shutdown); add_radio_station rolls back and errors instead of
  reporting Added without persisting; debounce constant lifted to
  module level.
- scrollable_pages.rs: document that add_pages is for index-ordered
  caches only and offset-keyed caches must use upsert_page_by_offset.
- queue.rs: doc comment said "Two cases" over three bullets.
- CLAUDE.md/AGENTS.md/copilot-instructions.md: language tag on the
  data-flow diagram fence (MD040).
Follow-up to the add_pages doc boundary from the previous commit: the
upsert tests set up their offset-keyed caches with add_pages, the one
method the boundary says those caches must not use. Setup state is
identical either way (empty-cache insert lands on index 0; the
mid-test index override stays), so this is test hygiene, not a
behavior change.

Also add a direct out-of-order test: three upserts arriving 4, 0, 2
keep the cache sorted and page_index_for_offset resolves every offset
to the right page, with a miss for an absent offset.
@LargeModGames
LargeModGames merged commit f48eefc into main Aug 12, 2026
21 checks passed
@LargeModGames
LargeModGames deleted the refactor/core-app-module branch August 12, 2026 21:21
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