Skip to content

DEF-002 — Expired Deezer Preview Links in /rankings

Summary

Older Deezer preview URLs in /rankings fail to play, particularly for legacy accounts with aged ranking data. Freshly ranked songs work as expected, but older entries lose functionality over time.

Environment

  • App: Melodex live
  • Commit: 9c876c9
  • Browser: Firefox 142.0.1 (Desktop)
  • Device: Windows 11 laptop
  • Network: Spectrum (approx 450 up / 11 down)
  • Date/Time: 09-14-2025

Triage

  • Severity: Major
  • Priority: High

Preconditions

  • Legacy account with ranking data created months ago
  • Main QA account with recent rankings also available

Steps to Reproduce

  1. Login with the Legacy QA account.
  2. Navigate to /rankings.
  3. Scroll to older ranked entries.
  4. Attempt to play audio preview.

Expected Result

Audio preview should load and play reliably for both new and old ranked entries.

Actual Result

  • Many older songs fail to play (expired Deezer preview links).
  • Inconsistent enrichment: sometimes new previews only appear after re-ranking additional songs.
  • Console logs indicate attempt to refresh older songs, but results indicate failure.
  • Refreshing multiple times produces new broken songs, sometimes none.

Impact

  • Returning users may find much of their rankings unplayable.
  • Undermines trust in the ranking history feature.
  • May lead to frustration and drop-off for long-term users.

Attachments

Suspected Areas

  • Deezer preview URLs expiring after a TTL.
  • Backend not refreshing metadata on /rankings load for older songs.

Diagnostics

  • Compared legacy vs. main QA account behavior.
  • Verified new rankings generate valid working preview links.
  • Observed enrichment failing to refresh on legacy account.

Proposed Fix

  • Implement backend enrichment step on /rankings load to refresh expired Deezer preview links.
  • Investigate Deezer API TTL policy and refresh cadence.

Owner: Michael DeReus
Status: Resolved
Opened: 09-14-2025
Closed: 09-18-2025

Linked Items

  • Risk: R-05 (Deezer preview URL expiry breaks audio)
  • Test(s): EXP-01 (in baseline)

Fix Reference


Root Cause

Deezer preview links are signed URLs with expiration timestamps. Older entries in MongoDB had stale URLs with no refresh mechanism, causing them to break over time. The frontend enrichment logic retried excessively but lacked throttling or persistence.

Changes

  • Smart Deezer search logic:
  • Try track:"song" artist:"artist" first.
  • Fall back to track:"song" artist:artist if needed.
  • Uses un-cleaned artist names for rehydration to ensure exact match consistency with Deezer.

  • Rehydration guardrails:

  • Prevent repeated requests with per-song throttling (recentlyDone).
  • Prevent duplicate in-flight requests using rehydratingRef.
  • Auto-disable rehydration if endpoint is missing (avoids wasted retries).

  • Frontend logic:

  • Show what’s in MongoDB immediately.
  • Background enrichment fixes only run if previews or covers are missing.
  • Rehydration only triggered if preview links are expired + cooldown passed.
  • Audio <onError> gracefully retries and updates UI inline.

  • Backend updates:

  • Stronger merging logic for updated Deezer IDs (prevents duplicate docs).
  • Consistent TTL parsing and preview expiry validation.
  • Better logging for diagnostics and triage.

Verification Steps

  1. Re-run steps with legacy account on /rankings.
  2. Confirm all previews (old + new) play without issue.
  3. Capture HAR/screenshot/logs as fresh evidence.

Verified in: 2d82c1a on 09-18-2025
Verification Status: Pass