Skip to content

feat(etl): decode hashid track_ids in playlist_contents (parity 5A)#249

Open
raymondjacobson wants to merge 1 commit intoetl/parity-4b-mv-refreshfrom
etl/parity-5a-hashid-track-ids
Open

feat(etl): decode hashid track_ids in playlist_contents (parity 5A)#249
raymondjacobson wants to merge 1 commit intoetl/parity-4b-mv-refreshfrom
etl/parity-5a-hashid-track-ids

Conversation

@raymondjacobson
Copy link
Copy Markdown
Contributor

Summary

Stack 5A. Picks up apps#14033: when `playlist_contents` includes a string track_id (e.g. `"1aV5byE"` rather than int 28622946), decode it via the Hashids algorithm before treating it as a track_id. Without this, a single playlist with a hashid-encoded entry halts indexing of the whole block.

`extractPlaylistTrackIDs` now flows through `pickPlaylistTrackID` which:

  • accepts `int` / `float64` / `int64` directly,
  • decodes `string` entries via `decodeTrackIDFromString`,
  • falls back to `strconv.ParseInt` for plain numeric strings.

The Hashids decoder uses `Hashids(min_length=5, salt="azowernasdfoia")` matching apps' `helpers.decode_string_id`. Logic is inlined locally rather than imported from `go-openaudio/pkg/hashes` because `pkg/etl` is a separate Go module — adds `github.com/speps/go-hashids/v2` to `pkg/etl/go.mod` (already used by the sibling `pkg/hashes`).

Verified against Python:

```python

Hashids(min_length=5, salt='azowernasdfoia').decode('1aV5byE')
(1031900541,)
```

Stack context

Stacked on #248 (4B — MV refresh).

Test plan

  • `TestExtractPlaylistTrackIDs/hashid-encoded_track_ids_decode` — hashid string decoded.
  • `TestExtractPlaylistTrackIDs/numeric_string_track_id_falls_back_to_atoi` — `"2007777"` → `2007777`.
  • All previous `extractPlaylistTrackIDs` cases still pass.
  • `go build ./...` clean.

🤖 Generated with Claude Code

…ty 5A)

Stack 5A. Picks up apps#14033: when playlist_contents includes a string
track_id (e.g. "1aV5byE" rather than int 28622946), decode it via the
Hashids algorithm before treating it as a track_id.

extractPlaylistTrackIDs now flows through pickPlaylistTrackID which
handles int / float64 / int64 directly and decodes string entries via
decodeTrackIDFromString. The decoder uses Hashids(min_length=5,
salt="azowernasdfoia") matching apps' helpers.decode_string_id, with a
strconv.ParseInt fallback for plain numeric strings.

Hashids logic is inlined locally rather than imported from
go-openaudio/pkg/hashes because pkg/etl is a separate Go module. Adds
github.com/speps/go-hashids/v2 to pkg/etl/go.mod (already used by the
sibling pkg/hashes).

Tests added for hashid decoding and numeric-string fallback. Verified
against Python:
  Hashids(min_length=5, salt='azowernasdfoia').decode('1aV5byE') == (1031900541,)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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