Skip to content

Min responses for users/tracks/playlists/dev apps - #5

Merged
stereosteve merged 7 commits into
mainfrom
rj-min-users
Apr 4, 2025
Merged

stereosteve merged 7 commits into
mainfrom
rj-min-users

Conversation

@raymondjacobson

Copy link
Copy Markdown
Member

This was the simplest way I could figure out doing the non-full users.

Mantra-

  1. always do full compute. we care about full more for our client and it will be fast
  2. have min user explicitly spell out fields it uses from full user. yeah maybe you could "remove" fields, but i think we'll accidentally add stuff we don't want to, and this is ~fine. gpt can get your boilerplate.

Comment thread api/v1_users.go Outdated
return err
}

// Check if a converter function is provided in the context

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont like this. doing something better

@raymondjacobson raymondjacobson changed the title Min users Min responses for users/tracks/playlists/dev apps Apr 4, 2025

@stereosteve stereosteve left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread api/dbv1/queries/get_tracks.sql Outdated
OR t.track_id = ANY(@ids::int[])
)
AND (
track_routes.is_current = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will make the LEFT JOIN track_routes act like a inner join as null is_current will be omitted.

To make act like LEFT JOIN you can move to join condition:

LEFT JOIN track_routes on t.track_id = track_routes.track_id and track_routes.is_current = true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit good 😌

Comment thread api/server.go
}
}

func Full(handler func(*fiber.Ctx, bool) error) fiber.Handler {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just look for /full/ in the request url... But I like this too.

@stereosteve
stereosteve merged commit 79a61df into main Apr 4, 2025
@stereosteve
stereosteve deleted the rj-min-users branch April 4, 2025 13:17
dylanjeffers added a commit that referenced this pull request Nov 12, 2026
…1071)

## Why

Michael approved idea #5 from the new-notification list (2026-11-11):
tell artists when they chart in their genre, e.g. "[track] is #4 in
Dubstep this week". It reaches many more artists than overall trending.
His rule: only genres with at least 10 tracks on the chart that week.

## What

- **`TrendingGenreNotificationsJob`** (indexer, every minute).
- **Chart** is the live week ranking in `track_trending_scores` (what
`/tracks/trending?genre=` serves), version `pnagD`, genre-carrying rows
only. Tracks that are deleted, unlisted or unavailable, or whose owner
is deactivated, are dropped before ranking.
- **Rules:** top 10 per genre, genre must have at least 10 tracks on the
chart. Tracks that already got an overall `trending` notification that
day are skipped so nobody gets two pushes for one track.
- **Timing:** one snapshot per week on Friday (the day trending winners
are picked), sent from 18:00 UTC for 24h. Stage sends any day, keyed by
the latest Friday.
- **Once per week:** scores recompute hourly, so the insert runs under
an advisory lock and stops if any row for that Friday exists. `group_id
= trending_genre:<YYYY-MM-DD>:<track_id>`, `specifier = track_id`.
- **Data:** `{track_id, genre, rank, week}`.
- New type rather than reusing `trending` with a genre: older app builds
render `trending` as "#4 on Trending", which would be wrong for a genre
rank. It also doesn't depend on the trending reward challenge, which is
being retired with $AUDIO rewards.
- `trending_genre` added to the notifications `types` filter and
swagger.

No migration.

## Rollout

Merging only writes rows. The push stays off until `push_trending_genre`
is set in Optimizely (pedalboard PR), and the tile is behind the
`trending_genre_notification` flag (apps PR). Clients without the apps
PR drop the row in the adapter.

## Tests

`go test ./jobs/ -run TrendingGenre` and `go test ./api/ -run
Notification` pass. Cases: ranks after dropping unlisted and deactivated
tracks, the 10-track minimum (9-track genre gets nothing, exactly 10
qualifies), skipping tracks already notified for overall trending,
ignoring month and genre-less rows, one snapshot per week even when
scores move, the next Friday, send window edges and stage.

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

Co-authored-by: Claude Opus 5.5 <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.

2 participants