Skip to content

feat(genres): allow custom track genres#14419

Closed
dylanjeffers wants to merge 1 commit into
mainfrom
feat/custom-genres
Closed

feat(genres): allow custom track genres#14419
dylanjeffers wants to merge 1 commit into
mainfrom
feat/custom-genres

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • Discovery indexer no longer rejects tracks whose genre isn't in the hardcoded allowlist; just caps at 100 chars. The allowlist is retained as a canonical reference for read-side trending/metrics scoping.
  • SDK upload schemas for tracks, albums, and playlists changed from z.enum(Genre) to z.string().min(1).max(100). SDK regenerated from updated swagger (generated Genre enum dropped). Manual Genre enum is now the canonical export from @audius/sdk with PascalCase keys, plus a new GenreString = Genre | string helper type.
  • Web SelectGenreField rewritten from <SelectField> to <TextField> + native <datalist> — users can pick a known genre via autocomplete or type a custom one. maxLength=100 gives the built-in harmony character counter.

Pairs with AudiusProject/api#TBD — the Go API must ship first (or together) so it stops rejecting custom-genre POSTs before this indexer relaxation lands; otherwise tracks pass the Go validator and then hit IndexingValidationError.

What we deliberately did NOT change

  • index_trending.py and get_genre_metrics.py still scope to genre_allowlist. Custom-genre tracks silently won't appear in trending or genre-metrics endpoints — intentional MVP cut; product decision for follow-up.
  • packages/mobile has its own genre picker that wasn't touched — follow-up PR needed.
  • No write-side normalization. "Hip-Hop" / "Hip Hop" / "hip hop" become three distinct genres. Lowercase/canonicalize is a future-PR decision.

Breaking change (browser dist only)

packages/sdk/src/sdk/types/Genre.ts keys changed from SCREAMING_SNAKE to PascalCase to match the previously-generated enum that downstream consumers (common, web, mobile) all imported. Any external integration referencing window.audiusSdk.Genre.HIP_HOP_RAP etc. via the browser dist needs to update to Genre.HipHopRap.

Test plan

  • tsc --noEmit in packages/sdk — clean
  • vitest run in packages/sdk — 17 files, 196 passed, 2 skipped (incl. TracksApi / AlbumsApi / PlaylistsApi suites)
  • SDK regenerated via node ./src/sdk/api/generator/gen.js --spec <local-edited-swagger> against the swagger with my Go-side schema change
  • Run the upload form in packages/web, type a custom genre like "Phonk", confirm it submits and the track is created
  • Existing known-genre flows (pick "Electronic" from the datalist) still work
  • Verify >100-char input is rejected client-side (zod) and server-side (Go validator + Python indexer)
  • Confirm no regression in trending / browse-by-genre pages for canonical genres
  • Mobile picker behavior unaffected on this branch (mobile uses its own field)

🤖 Generated with Claude Code

- discovery indexer: drop genre allowlist enforcement at write time; cap
  genre at 100 chars; allowlist retained as canonical reference for
  read-side trending/metrics aggregations
- sdk: relax track + album + playlist upload schemas to z.string().min(1).max(100);
  regenerate from updated swagger (generated Genre enum dropped); manual
  Genre enum re-exported from index with PascalCase keys to preserve
  @audius/sdk consumer compatibility; new GenreString = Genre | string
  helper type
- web: SelectGenreField rewritten to TextField + native <datalist> so
  users can pick a known genre via autocomplete or type a custom one

Read-side genre filters (trending, get_genre_metrics) still scope to the
canonical set — tracks tagged with custom genres won't appear in those
endpoints. Mobile genre picker is untouched and will be addressed in a
follow-up PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

⚠️ No Changeset found

Latest commit: 808197f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14419.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@dylanjeffers
Copy link
Copy Markdown
Contributor Author

Superseded by fresh-branch PR from main: #14424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant