Skip to content

fix(stats): keep Spotify artist names with "&", "and" or a comma whole - #646

Merged
LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:fix/top-artists-keep-spotify-names
Sep 28, 2026
Merged

LargeModGames merged 1 commit into
LargeModGames:mainfrom
kapok-4o:fix/top-artists-keep-spotify-names

Conversation

@kapok-4o

@kapok-4o kapok-4o commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #601. aggregate_top_artists keeps each name in record.artists whole when item_uri starts with "spotify:" (tracks and episodes), trimmed and skipping empty names the way split_artists does. Every other record (local files, radio, item_uri: None) still goes through split_artists. record.source isn't used, and the tag parser in infra/local/mod.rs is untouched. Aggregation runs at read time, so existing history is fixed too.

Tests, from the issue: top_artists_keeps_a_spotify_band_name_with_an_ampersand_whole, top_artists_keeps_a_spotify_artist_name_with_a_comma_whole, top_artists_counts_each_credited_spotify_artist_separately, top_artists_still_splits_a_joined_local_file_artist_string and top_artists_splits_a_record_with_no_item_uri.

Testing

  • cargo fmt --all -- --check: clean
  • cargo clippy --no-default-features --features telemetry,tui -- -D warnings: clean
  • cargo test --no-default-features --features telemetry,tui: 1314 passed, 0 failed
  • cargo test --no-default-features --features telemetry,tui top_artists_: 5 passed
  • With the Spotify branch disabled, exactly the first two tests fail, as the issue predicts.

Additional notes

A local file tagged "Of Monsters and Men" is still split; that's the out-of-scope limit from the issue.

This is one of five small PRs I opened together (for #606, #598, #597, #596 and #601). Each changelog entry sits at a different spot in [Unreleased], and I test-merged all five in three orders without conflicts; together they pass the slim checks (1327 tests).

Written with AI coding assistants: Codex drafted fixes for these issues, and Claude Code rebuilt each one on current main against the issue text and re-tested it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Top Artists and related outputs now preserve Spotify artist names containing ampersands, “and,” or commas as single names. Joined artist strings from local files, radio, and Spotify-unlinked plays continue to be split.
  • Documentation
    • Updated the changelog to note the artist-name handling change.

aggregate_top_artists ran every name through split_artists, so a single
Spotify artist such as "Mumford & Sons" or "Tyler, The Creator" became
two fake artists with the full play count. Spotify records already hold
one credited artist per entry, so keep those whole when the item URI
starts with "spotify:" (episodes included), and keep splitting local
files, radio and records with no URI, whose artists arrive joined.

Fixes LargeModGames#601

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: LargeModGames/spotatui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 608cffa3-72a2-499c-a894-99f07a553a23

📥 Commits

Reviewing files that changed from the base of the PR and between ea356a0 and 6053266.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/infra/history.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Top artist aggregation now keeps nonblank artist strings whole for records with Spotify URIs. It continues to split joined artist strings for other records, including records without a URI. Tests cover both behaviors.

Changes

Top Artist Aggregation

Layer / File(s) Summary
Preserve Spotify artist names
src/infra/history.rs, CHANGELOG.md
aggregate_top_artists preserves each nonblank artist string for Spotify-linked records and retains splitting for other records. Tests cover names with ampersands or commas, separate credits, local-file strings, and records without URIs. The changelog describes the change.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 60532

The change appears ready to merge after normal checks.

Architecture Summary

Architecture risk: 🟡 Medium · up to 60532

The change affects 2 systems.

Changed systems: src, CHANGELOG.md

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 1 changed file maps to changed impact.
  • observed — CHANGELOG.md (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in CHANGELOG.md: Added a changelog item stating that Spotify-linked artist names remain whole in Top Artists, recaps, share cards and AI DJ taste briefs, while non-Spotify-linked and local/radio artist strings are still split.
  • observed — Modified behavior in src/infra/history.rs: aggregate_top_artists now detects Spotify records by the spotify: URI prefix and preserves each nonblank artist string whole; other records retain the existing joined-name splitting behavior.
  • observed — Modified behavior in src/infra/history.rs: Added a test helper and expectations for preserving Spotify artist names containing ampersands or commas, counting separately credited Spotify artists, and splitting joined artist strings for local-file and missing-URI records.

Reliability and maintainability

  • inferred — Risk-relevant change factors for src: blast_radius_2; direct_dependents_2
🚥 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 allowed conventional-commit prefix fix(stats):. It clearly describes the main change and uses a concise imperative subject.
Linked Issues check ✅ Passed PR #646 implements the coding requirements in issue #601. aggregate_top_artists keeps each artist string whole when item_uri starts with spotify:, which covers tracks and episodes. It trims and …
Out of Scope Changes check ✅ Passed The changes stay within issue #601. The changelog documents the corrected Top Artists behavior. The implementation and tests support the Spotify and non-Spotify aggregation requirements. No unrelated …
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
✨ Simplify code
  • Create a new PR

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.

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/infra/history.rs 97.9% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@LargeModGames
LargeModGames merged commit 352d077 into LargeModGames:main Sep 28, 2026
31 checks passed
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.

Stats Top Artists splits "Mumford & Sons" into two artists

2 participants