Skip to content

feat(tracks): allow custom genres; cap at 100 chars#874

Closed
dylanjeffers wants to merge 2 commits into
mainfrom
feat/custom-genres
Closed

feat(tracks): allow custom genres; cap at 100 chars#874
dylanjeffers wants to merge 2 commits into
mainfrom
feat/custom-genres

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • api/v1_track.go: dropped the oneof='Electronic' 'Rock' ... validators on CreateTrackRequest.Genre (required) and UpdateTrackRequest.Genre (omitempty); replaced with min=1,max=100 and max=100 respectively.
  • api/swagger/swagger-v1.yaml: genre schema changed from string-enum to plain string with maxLength: 100. Canonical values moved into the description so generated docs/SDKs still surface them as autocomplete suggestions.

Pairs with AudiusProject/apps#14419 — the SDK regen, indexer relaxation, and web UI live there. Ship this first (or together) so the Python indexer relaxation isn't gated on a Go API that still rejects custom genres at the validate-tag layer.

Test plan

  • Existing test fixtures using genre: "Electronic" etc. still pass (no breakage from removing the enum constraint — those values are still valid strings).
  • POST /v1/tracks with genre: "Phonk" succeeds.
  • POST with genre: "" returns 400 (min=1).
  • POST with a 101-char genre returns 400 (max=100).
  • Generated swagger docs at /v1/swagger.yaml show the new schema with description containing the canonical values.

🤖 Generated with Claude Code

dylanjeffers and others added 2 commits May 29, 2026 10:00
- v1_track.go: drop `oneof=...` enum validators on CreateTrackRequest.Genre
  and UpdateTrackRequest.Genre; replace with min/max length constraints
- swagger/swagger-v1.yaml: genre schema changed from string-enum to plain
  string with maxLength=100; canonical values moved into description so
  generated docs/SDKs still surface known autocomplete options

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ent consumer

When the Go indexer takes over track entity-event consumption from the
Python discovery-provider, the genre validation must mirror the new
write-time rule: arbitrary user-supplied string, no enum, just a 100-char
length cap. Land the constant next to Entity_Track so future track-event
handler implementations pick it up by default.

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

Superseded by fresh-branch PR from main on genres/custom

dylanjeffers added a commit that referenced this pull request May 29, 2026
Fresh branch off main — supersedes #874.

## Summary
- `api/v1_track.go`: dropped the `oneof='Electronic' 'Rock' ...`
validators on `CreateTrackRequest.Genre` (required) and
`UpdateTrackRequest.Genre` (omitempty); replaced with `min=1,max=100`
and `max=100`.
- `api/swagger/swagger-v1.yaml`: `genre` schema changed from string-enum
to plain string with `maxLength: 100`. Canonical values moved into the
description so generated docs/SDKs still surface them as autocomplete
suggestions.
- `indexer/constants.go`: added `MaxTrackGenreLength = 100` next to
`Entity_Track`. Forward-looking — when the Go indexer takes over track
entity-event consumption from the Python `discovery-provider`, this is
the rule the new handler should enforce, mirroring discovery-provider's
`CHARACTER_LIMIT_GENRE`.

Pairs with
[AudiusProject/apps#14424](AudiusProject/apps#14424)
— the SDK regen, Python indexer relaxation, and web UI live there.
**Ship this first (or together)** so the Python indexer relaxation isn't
gated on a Go API that still rejects custom genres at the validate-tag
layer.

## Test plan
- [x] Existing test fixtures using `genre: "Electronic"` still pass
(those values are still valid strings).
- [x] `go build ./indexer` clean.
- [ ] POST `/v1/tracks` with `genre: "Phonk"` succeeds.
- [ ] POST with `genre: ""` returns 400 (`min=1`).
- [ ] POST with a 101-char genre returns 400 (`max=100`).
- [ ] Generated swagger docs at `/v1/swagger.yaml` show the new schema
with description containing canonical values.
- [ ] When the Go indexer's track-event consumer is implemented, it
references `indexer.MaxTrackGenreLength` rather than introducing its own
enum check.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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