Skip to content

feat(etl): index stems, remixes, route_id, and migration playlist routes#237

Open
raymondjacobson wants to merge 2 commits intomainfrom
claude/charming-rhodes-d6c7fe
Open

feat(etl): index stems, remixes, route_id, and migration playlist routes#237
raymondjacobson wants to merge 2 commits intomainfrom
claude/charming-rhodes-d6c7fe

Conversation

@raymondjacobson
Copy link
Copy Markdown
Contributor

Summary

Adds discovery-provider parity for the four entity-manager side-effects that were declared as constants in handler.go but not implemented (Stem, Remix, TrackRoute, PlaylistRoute). These aren't separate transaction types in discovery — they're side effects of Track/Playlist CRUD, and that's how they're wired here.

  • stems table — populated on track create from metadata.stem_of.parent_track_id; cleaned up on track delete (rows where this track is the child).
  • remixes table — refreshed on track create and update from metadata.remix_of.tracks[].parent_track_id (delete-all-then-insert).
  • tracks.route_id — set on create and rebuilt on title change using helpers.create_track_route_id semantics (<handle>/<sanitized-title>). Falls back to a synthetic user-<id> handle for guest uploaders, matching apps#13818.
  • playlist_routes migration row — on create, also insert the legacy <title>-<id> slug as is_current=false so old ID-suffixed URLs keep resolving (mirrors discovery's update_playlist_routes_table is_create=True).

Migration 0016_stems_remixes adds the stems and remixes tables (matching production's discovery-provider schema, including remixes_child_idx). New shared helpers live in track_relations.go.

Test plan

  • Pure unit tests for slug/route_id/parent-id helpers (no DB)
  • DB-backed integration tests covering each side effect:
    • TestTrackCreate_PopulatesStemsTable
    • TestTrackCreate_PopulatesRemixesTable
    • TestTrackCreate_SetsRouteID
    • TestTrackCreate_GuestUserSyntheticHandle
    • TestTrackUpdate_RefreshesRemixes
    • TestTrackUpdate_RebuildsRouteIDOnTitleChange
    • TestTrackDelete_RemovesStemsForChild
    • TestPlaylistCreate_AddsMigrationRoute
  • go build ./... and go vet ./... clean
  • Verify against production parity tool (pkg/etl/parity) once an indexed range with stems/remixes is available

🤖 Generated with Claude Code

raymondjacobson and others added 2 commits May 7, 2026 10:31
Each merge to main pushes a new :edge tag, triggering the auto-upgrader
on snapshot-serving nodes. When those nodes restart and catch up, the
snapshot creator skips every 100k-block interval that fires during
CatchingUp=true, leaving no fresh snapshots for up to ~16 hours.

Re-enable once PR #226 (catch-up snapshot fix) is merged and deployed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add discovery-provider parity for the four entity-manager side-effects that
were previously declared but unimplemented:

- stems table: populated on track create from metadata.stem_of.parent_track_id;
  cleaned up on track delete (rows where this track is the child).
- remixes table: refreshed on track create and update from
  metadata.remix_of.tracks[].parent_track_id (delete-all-then-insert).
- tracks.route_id column: now set on create and rebuilt on title change,
  using helpers.create_track_route_id semantics (handle/sanitized-title).
  Falls back to a synthetic 'user-<id>' handle for guest uploaders, matching
  apps#13818.
- playlist_routes migration row: on create, also insert the legacy
  '<title>-<id>' slug as is_current=false so old ID-suffixed URLs keep
  resolving (mirrors discovery's update_playlist_routes_table is_create=True).

Migration 0016 adds the stems and remixes tables (matching the production
discovery-provider schema, including the remixes_child_idx). New shared
helpers live in track_relations.go. Pure-unit tests cover the helpers; eight
DB-backed tests cover the table-maintenance side effects on create / update /
delete.

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