Skip to content

feat(discord): allow album artist in status name - #1373

Merged
nolight132 merged 6 commits into
sonorahq:mainfrom
BeatsByTrobi:feat/discord-album-artist-variable
Nov 13, 2026
Merged

nolight132 merged 6 commits into
sonorahq:mainfrom
BeatsByTrobi:feat/discord-album-artist-variable

Conversation

@BeatsByTrobi

@BeatsByTrobi BeatsByTrobi commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1372.

Summary

The Discord status name dropdown (Settings, Discord, Status name) now has an Album artist option next to Artist. It names the status after whoever the playing track's album is credited to, and it changes with the track. Tracks now carry an album artist, filled in by the providers whose responses already name one. When it is missing, the status says "Music", the same as the other track options do.

Scope

In:

  • an album_artist field on music::Track, empty when the provider doesn't name one
  • filling it in from data each provider already fetches (no new requests)
  • the Album artist option in the Status name dropdown, the live status and the settings preview
  • keeping it in the saved queue, so a restored queue still has it after a restart

Out:

  • template-style status names that mix several values. The dropdown is a fixed list of options, and I only added the one the issue asks for.
  • listening history. The plays table has fixed columns and storage has no migrations, so a track replayed from History has no album artist (see open questions).

Which providers can fill it in:

Provider Album artist
Local files yes, from the album artist tag. Empty if the file has no such tag.
Subsonic / Navidrome OpenSubsonic servers only (displayAlbumArtist / albumArtists). Empty on a plain Subsonic server.
Spotify yes, from the album in the track metadata, and from the album page
Tidal no, a track's embedded album has no artists
Deezer no, a track names only its own artists
YouTube Music no
Apple Music no, a song lists only its own artist

Overlap

I searched open PRs for "discord", "rpc", "album artist" and "1372". The only Discord PR is #1349 (Navidrome artwork on the status). It edits state/src/discord/mod.rs and views/src/screens/settings/discord.rs, but it changes artwork, not the status name. Whichever lands second may need a small rebase in shown(). The "album artist" matches (#1358, #1280, #1134, #1249, #1275, #986, #1241, #1310, #1322, #1250) are unrelated provider or UI work. Nothing covers this issue.

What I did

  1. Read Allow album artist in Discord RPC status name #1372, searched open PRs (above), and read CONTRIBUTING.md, AGENTS.md and CLAUDE.md.
  2. Read the Discord code (state/src/discord/mod.rs) and the setting (state/src/settings.rs, DiscordName). Also read the dropdown (views/src/screens/settings/discord.rs) and its preview (views/src/screens/settings/preview/{mod,discord}.rs), plus the Fluent keys settings-discord-name-*.
  3. Read music/src/models.rs and found that Track had no album artist. Then read each provider's track builder: local/wire.rs, subsonic/wire.rs (with opensubsonic 0.7's Child), spotify/collection.rs, spotify/pathfinder/album.rs, tidal/wire.rs, deezer/wire.rs, youtube/wire.rs and apple/wire.rs. Also read where tracks are stored: state/src/queue.rs and state/src/history.rs, against the storage schema.
  4. Ran the baseline cargo test --workspace --locked: 444 passed, 0 failed, 17 ignored. My first try overlapped with my first edit, so I reverted the edit and ran the baseline again on a clean tree.
  5. Added the field, filled it in per provider, added the option, the Fluent key, the preview case, the queue field, tests and the changelog entry.

Files changed:

  • crates/music/src/models.rs: Track::album_artist
  • crates/music/src/{local/wire.rs,subsonic/wire.rs,spotify/collection.rs,spotify/pathfinder/album.rs}: fill it in
  • crates/music/src/{tidal,deezer,youtube,apple}/wire.rs: set it to empty, with a comment saying why
  • crates/music/src/local/client.rs: test helper
  • crates/music/src/local/{wire,index}.rs: Tagged::restored copies the stored album artist tag onto tracks the index saved before this change
  • crates/state/src/settings.rs: DiscordName::AlbumArtist (album-artist)
  • crates/state/src/discord/mod.rs: status name moved into listening(), plus tests
  • crates/state/src/queue.rs: Stub::album_artist
  • crates/state/src/search.rs, crates/views/src/screens/search.rs: Hit::Song(Box<Track>). The bigger Track tripped clippy's large_enum_variant.
  • crates/views/src/screens/settings/preview/{mod,discord}.rs
  • assets/i18n/en-US/main.ftl: settings-discord-name-album-artist = Album artist
  • CHANGELOG.md

Decisions

How it reaches the status. Each provider sets Track::album_artist when it builds the track, from the response it already gets. Playback keeps that Track, the saved queue keeps a copy, and Discord::shown reads it again on every playback change. So the status follows the track as it changes. The name now comes from one pure function, listening(name, track, provider), which is what the tests call.

When it is missing. An empty album artist stays empty. It is never filled in from the track artists, so it can't disagree with what the provider reports. Discord needs a name, so an empty value falls back to "Music", as Title, Artist and Artist - Title already do. The details line, artist line, cover and timestamps of the status are unchanged. The settings preview falls back the same way.

No lookups of its own. Sonora doesn't fetch an album, or guess from the album name, to find an album artist. A provider that doesn't name one leaves it empty.

Dropdown accessibility. The new entry is one more MenuItem in the existing Picker, so it gets Role::MenuItem like every item there. Its id comes from DiscordName::id (album-artist), and its name comes from Fluent, resolved in render. Nothing new was added to the UI, so a11y_tree.rs doesn't change.

Testing

New tests:

  • state::discord::tests::the_album_artist_names_the_status: Album artist gives the album artist, not the track artists
  • state::discord::tests::a_missing_album_artist_says_music_rather_than_the_track_artists: a blank album artist gives "Music", not the track artist
  • state::discord::tests::the_track_artists_still_name_the_status: Artist and Artist - Title are unchanged
  • music::subsonic::wire::tests::an_opensubsonic_song_names_its_album_artist: from displayAlbumArtist, from albumArtists, and from albumArtists when displayAlbumArtist is blank
  • music::subsonic::wire::tests::a_plain_subsonic_song_leaves_the_album_artist_empty
  • music::local::wire::tests::a_row_stored_before_the_track_named_its_album_artist_names_it_once_restored: a local file indexed before this change gets its album artist from the stored tag, without a rescan

Results (Windows, MSVC):

  • cargo test --workspace --locked: 450 passed, 0 failed, 17 ignored (baseline 444 / 0 / 17)
  • cargo fmt --check: clean
  • cargo check --workspace: clean
  • cargo clippy --workspace --all-targets: clean, after boxing Hit::Song

Not verified

  • A live Discord status update. I didn't run the app with Discord open, so I haven't seen the Album artist option change the status, or seen it update on a track change. Nor have I seen the "Music" fallback on Tidal, Deezer, YouTube Music or Apple Music.
  • A screen reader pass on the dropdown, to hear the new "Album artist" entry announced in the Status name picker.
  • Spotify against a real account. I assumed the album inside the TRACK_V4 extended metadata lists its artists, as the protobuf allows. If it doesn't, Spotify tracks loaded that way would show "Music". Tracks from the album page use the album header's artists either way.
  • No screenshots. The only visible change is one more entry in an existing dropdown.

Open questions for maintainers

  1. Listening history doesn't store the album artist, so a track replayed from History, or picked by the settings preview, shows "Music". Is adding a column to plays worth it? storage has no migrations yet, so it would need the first one.
  2. Is "Music" the right fallback for a missing album artist? The alternative is Discord's default name (Sonora).
  3. Would you want an "Album artist - Title" option as well, to match "Artist - Title"?
  4. Tidal, Deezer and Apple Music could only supply it with an extra album request per track. Is that worth doing, or is staying empty better?
  5. Hit::Song is now boxed to keep clippy clean as Track grows. Fine, or would you rather box elsewhere?
  6. Downgrades: once Album artist is saved, an older Sonora can't read the preferences file and runs that session on defaults, including the privacy and offline settings. CodeRabbit raised this. Every new DiscordName value has the same effect, and nothing in this PR can change how an older release loads settings. Do you want a separate change that makes the settings loader tolerate unknown values option by option, so future releases downgrade safely?

@sonora-buddy sonora-buddy Bot added spotify the Spotify backend, its library, search and sign-in youtube the YouTube Music backend, its library, search and sign-in subsonic a Subsonic or Navidrome server local the local music folder, scanning, tags, artwork, local playlists player the player bar, the queue, transport, fullscreen, media keys search the search field and what it returns settings the settings screen, stored preferences, the updater labels Nov 13, 2026
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

This PR adds an Album artist option to the Discord status name setting. The option uses a new Track.album_artist field, which Local files, OpenSubsonic, and Spotify populate, and falls back to "Music" when the value is empty.

The change adds an album_artist field to tracks and populates it from provider data where available. Local track restoration and queue stubs preserve the field. Discord status-name options now include AlbumArtist, and status selection and the settings preview handle that option. Song search hits also change their track storage representation.

Assessment against linked issues

Objective Addressed Explanation
Add an album artist option to the Discord status-name dropdown while retaining the existing Artist option [#1372] ✅

Out-of-scope changes

Code Change Explanation
Change song hit storage to Box<Track> and use direct Track values in search-screen press targets (crates/state/src/search.rs:66,463,562; crates/views/src/screens/search.rs:69,910,1000) The linked objective concerns adding an album-artist status-name option. It does not specify changes to search-hit or press-target storage.
Merge Risk: Minimal · up to 0c76c

Discord's "Album artist" status name now also works for local tracks cached before this change, because their album artist is backfilled when the index is read. No merge-blocking risk remains.

Security architecture risk: Low · up to 16bf6

The metadata addition uses the existing, user-controlled Discord sharing path. A limited rollback risk remains: an older release rejects the new saved option and temporarily falls back to default preferences, including disabling the saved offline-mode restriction.

Retained concerns

  • Low · security · inferred: Reusing settings with the base release after saving Album artist causes the entire preferences object to fail deserialization. The fallback ignores unrelated saved controls, including offline mode, allowing account restoration to proceed without that restriction. This requires a local rollback or older-version launch; it is not a remotely demonstrated bypass.
Security review details

Security Blast Radius

  • inferred — The identified rollback concern affects preferences for the local application profile sharing that settings file. It can relax network restrictions for stored provider accounts; no cross-tenant privilege or server-side authorization expansion was established.

Security Findings and Attack Paths

  • inferred — The rollback sequence is: save AlbumArtist, launch the base release with the same settings, encounter an unknown enum value, and continue with default preferences. A saved offline_mode=true is then ineffective because the default is false, removing the guard that otherwise avoids reaching a stored provider account. The loader behavior predates this PR; the newly serialized enum value makes this condition reachable from valid new-version settings.

Trust Boundaries and Controls

  • observed — The new album-artist value is treated as display text, not as a credential, URL, account identifier, or authority decision in the inspected Discord path. fit_text trims it and limits UTF-16 length. These are output-format controls, not evidence of comprehensive sanitization.

Resilience and Maintainability Implications

  • observed — On a nonempty settings parse failure, the base loader preserves the original file by marking settings non-writable and records the error for reporting. Discord presence also defaults to off. These limit destructive recovery and immediate Discord disclosure, but do not preserve the saved offline restriction while default preferences are active.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

artists: artist,
artist_refs: track_artist_refs,
album: album_name,
album_artist: album_artist.clone().unwrap_or_default(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor · Functional Correctness · Quick win

Backfill track.album_artist for cached tracks restored from the index.

Rows written before this change deserialize with an empty track.album_artist, because Track uses a struct-level serde default. They are not reread, so the empty value persists until the file changes. Discord then shows "Music" for those tracks instead of the stored album credit.

Suggested fix

-                        let tagged = serde_json::from_str::<Tagged>(track).ok();
+                        let mut tagged = serde_json::from_str::<Tagged>(track).ok();
+                        if let Some(entry) = tagged.as_mut() {
+                            if entry.track.album_artist.is_empty() {
+                                entry.track.album_artist = entry.album_artist.clone().unwrap_or_default();
+                            }
+                        }

Comment thread crates/music/src/subsonic/wire.rs Resolved
@nolight132
nolight132 merged commit 3cc3ae8 into sonorahq:main Nov 13, 2026
6 checks passed
@BeatsByTrobi
BeatsByTrobi deleted the feat/discord-album-artist-variable branch November 13, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

local the local music folder, scanning, tags, artwork, local playlists player the player bar, the queue, transport, fullscreen, media keys search the search field and what it returns settings the settings screen, stored preferences, the updater spotify the Spotify backend, its library, search and sign-in subsonic a Subsonic or Navidrome server youtube the YouTube Music backend, its library, search and sign-in

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow album artist in Discord RPC status name

2 participants