Skip to content

Conversation

@joelbdavies
Copy link

Overview

This PR fixes track info to return all credited artists when using the Connect GraphQL payload.

Changes

  • Parse trackUnion.otherArtists alongside firstArtist
  • Treat {id, name} artist fragments as valid without reintroducing unrelated names
  • Add regression tests for firstArtist, otherArtists, and id+name fragments

Rationale

  • Connect getTrack responses often wrap artists in container shapes (artists.items, firstArtist, otherArtists). We only handled flat arrays and artistName, so artists were missing entirely and
    secondary artists (remixers/collabs) were ignored. Some payloads also return minimal artist fragments (id, name) which were being filtered out.

Testing

  • go test ./internal/spotify
  • tested a range of different tracks, which previously returned no artists; now succeeds!
spogo track info spotify:track:06tI2UeECYQN6AM4mZkB5s --json
{
  "id": "06tI2UeECYQN6AM4mZkB5s",
  "uri": "spotify:track:06tI2UeECYQN6AM4mZkB5s",
  "name": "Alive - SG Lewis Remix",
  "type": "track",
  "url": "https://open.spotify.com/track/06tI2UeECYQN6AM4mZkB5s",
  "artists": [
    "Empire Of The Sun",
    "SG Lewis"
  ],
  "album": "Alive (SG Lewis Remix)"
}
  • Developed with assistance from OpenAI Codex.

Problem: Connect getTrack only surfaced the first artist; otherArtists (e.g., remixers) were ignored.
Solution: parse otherArtists in trackUnion and tighten artist name extraction to avoid unrelated names; add tests for firstArtist/otherArtists containers.
Problem: some Connect artist fragments only include id+name, so artistNameFromValue ignored them.
Solution: treat id as sufficient evidence of an artist map and add a regression test.
## Overview
This PR fixes track info to return all credited artists when using the Connect GraphQL payload.

## Changes
- Parse `trackUnion.otherArtists` alongside `firstArtist`
- Treat `{id, name}` artist fragments as valid without reintroducing unrelated names
- Add regression tests for `firstArtist`, `otherArtists`, and id+name fragments

## Rationale
- Connect `getTrack` responses often wrap artists in container shapes (`artists.items`, `firstArtist`, `otherArtists`). We only handled flat arrays and `artistName`, so artists were missing entirely and
  secondary artists (remixers/collabs) were ignored. Some payloads also return minimal artist fragments (`id`, `name`) which were being filtered out.

## Testing
- `go test ./internal/spotify`
- tested a range of different tracks, which previously returned no artists; now succeeds!
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.

1 participant