Skip to content

fix(smart-playlists): dedupe identical inputs in cover compositor#154

Merged
InstaZDLL merged 1 commit into
mainfrom
fix/daily-mix-dedupe-identical-covers
May 25, 2026
Merged

fix(smart-playlists): dedupe identical inputs in cover compositor#154
InstaZDLL merged 1 commit into
mainfrom
fix/daily-mix-dedupe-identical-covers

Conversation

@InstaZDLL
Copy link
Copy Markdown
Owner

@InstaZDLL InstaZDLL commented May 25, 2026

Summary

Daily Mixes whose top 3 artists share a Deezer picture (or whose fallback album arts all point at the same release) were rendering a 3-strip contact sheet of the same thumbnail (see screenshot in conversation — Daily Mix 2 showing three identical car shots).

Mirrors the hash-level dedup that playlist_cover::top_track_artwork_paths already applies for user playlists, but centralises it inside build_composite_cover so every caller (Daily Mix today, future smart families, user-playlist upload re-encode) gets the behaviour for free.

When all 3 inputs collapse to one unique path, the layout auto-pick falls through to "1 → fill the canvas" and the cover renders as a single full-bleed tile — matches Spotify on mono-artist playlists.

Test plan

  • cargo test --manifest-path src-tauri/Cargo.toml --lib smart_playlists::cover → 8/8 passed
  • New regression test composite_collapses_identical_inputs_to_single_tile: composites [p, p, p] and [p], asserts identical output hash.
  • Manual smoke: click "Régénérer" on Home → "For you" carousel → Daily Mix 2 cover should render as a single picture instead of a 3-strip contact sheet for mono-artist clusters.

Summary by CodeRabbit

Notes de version

  • Améliorations
    • Optimisation des couvertures Daily Mix : les images identiques provenant de plusieurs artistes sont désormais fusionnées, éliminant les doublons visuels pour une composition plus cohérente.

Review Change Stack

Daily Mixes whose top 3 artists share a Deezer picture (or whose
fallback album arts all point at the same release) were rendering a
3-strip contact sheet of the same thumbnail. Mirror the hash-level
dedup `playlist_cover::top_track_artwork_paths` already applies for
user playlists by collapsing duplicate paths in `build_composite_cover`
itself, so the layout auto-pick falls through to "1 → fill the canvas"
when every input is the same image.

Paths here are hash-keyed (`metadata_artwork/<blake3>.jpg` + per-profile
`artwork/<hash>.<ext>`), so path equality is content equality. Covers
every current and future caller (Daily Mix, user playlist auto-cover,
upload re-encode) with one chokepoint.
@InstaZDLL InstaZDLL added scope: backend Rust/Tauri backend (src-tauri/) scope: docs Docs, README, assets type: fix Bug fix size: s 10-50 lines labels May 25, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cf2fccd2-4f04-48d4-80ce-0fa9add48d69

📥 Commits

Reviewing files that changed from the base of the PR and between 4bcbc5c and 0448747.

📒 Files selected for processing (2)
  • docs/features/smart-playlists.md
  • src-tauri/src/smart_playlists/cover.rs

📝 Walkthrough

Walkthrough

Cette PR ajoute la déduplication des chemins d'images identiques dans la construction de couvertures composites pour Daily Mix. Les images en doublons pointant vers le même fichier sont désormais filtrées avant mise en page, évitant les compositions répétitives. Un test valide le comportement et la documentation explique la règle appliquée.

Changes

Déduplication des couvertures composites

Layer / File(s) Summary
Implémentation de la déduplication par HashSet
src-tauri/src/smart_playlists/cover.rs
build_composite_cover introduit un HashSet pour filtrer les doublons des image_paths avant décodage et calcul du nombre de tuiles, produisant une composition équivalente aux chemins uniques.
Validation et documentation
src-tauri/src/smart_playlists/cover.rs, docs/features/smart-playlists.md
Test unitaire confirmant que trois chemins identiques génèrent le même hash qu'un chemin unique, et documentation décrivant l'alignement de cette déduplication avec le cache d'artwork.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

type: fix, size: s, scope: backend

Poem

🎨 Trois fois le même visage affichait sa redondance,
Un HashSet arrive et tranche avec élégance,
Un seul tile remplit le canvas tout entier,
Plus de répétition, juste de l'harmonie papier ! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Le titre suit les conventions Conventional Commits avec le scope kebab-case 'smart-playlists' et décrit précisément le changement principal : la déduplication des entrées identiques dans le compositeur de couvertures.
Description check ✅ Passed La description couvre les éléments clés : le problème (contact sheet de vignettes identiques), la solution (déduplication centralisée), le comportement résultant et un plan de test avec résultats. Les sections de test et de résumé sont bien remplies.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/daily-mix-dedupe-identical-covers

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

@InstaZDLL InstaZDLL self-assigned this May 25, 2026
@InstaZDLL InstaZDLL enabled auto-merge (squash) May 25, 2026 10:53
@InstaZDLL InstaZDLL disabled auto-merge May 25, 2026 10:53
@InstaZDLL InstaZDLL merged commit d8c80cc into main May 25, 2026
14 checks passed
@InstaZDLL InstaZDLL deleted the fix/daily-mix-dedupe-identical-covers branch May 25, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: backend Rust/Tauri backend (src-tauri/) scope: docs Docs, README, assets size: s 10-50 lines type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant