fix(discover): hide stale singles + replace album set on re-derive

- Client filters the row's album thumbnails to full albums only (hides
  singles/EPs left over from pre-albums-only sweeps).
- Worker: re-deriving an artist deletes its pending album suggestions that are
  no longer picks (stale singles / now-owned), keeping wanted/dismissed rows,
  so the suggestion set self-cleans instead of accumulating.

worker 246, web 189 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan
2026-07-15 00:10:10 +02:00
parent 48d5f287b2
commit 288d55269d
4 changed files with 52 additions and 5 deletions
+13 -4
View File
@@ -36,6 +36,12 @@ function similarTo(seeds: string[]): string | null {
return `Similar to ${shown}${extra > 0 ? ` +${extra} more` : ""}`;
}
/** Full-length albums only — hide singles/EPs and secondary-type releases (live/comp) that
* pre-date the albums-only derivation and still linger in the DB. */
function isFullAlbum(a: Album): boolean {
return (a.primaryType ?? "Album") === "Album" && (a.secondaryTypes?.length ?? 0) === 0;
}
/** Human badge for why an album is surfaced. */
function badgeFor(reason: string | null): string | null {
if (reason === "newest") return "Newest";
@@ -214,7 +220,9 @@ export function DiscoverClient() {
<p className="muted-note">No suggestions yet run Discover, or follow a few artists to seed it.</p>
) : (
<ul className="list">
{rows.map((row) => (
{rows.map((row) => {
const albums = row.albums.filter(isFullAlbum);
return (
<li key={row.artistMbid} className="list-row disco-row">
<div className="main">
<div className="rtitle">
@@ -230,9 +238,9 @@ export function DiscoverClient() {
{similarTo(row.seeds) ? <div className="rmeta why">{similarTo(row.seeds)}</div> : null}
</div>
{row.albums.length > 0 ? (
{albums.length > 0 ? (
<div className="disco-albums">
{row.albums.map((a) => (
{albums.map((a) => (
<div key={a.id} className="disco-album">
<button
className="disco-thumb"
@@ -264,7 +272,8 @@ export function DiscoverClient() {
) : null}
</div>
</li>
))}
);
})}
</ul>
)}