docs: wanted, dbtest, recommendation and playlists comments say what the code does (#6277)
The same rewrite as d191a282, for four packages whose comments carried the
most history: tuning stories, quotes from the operator, single-install
measurements in library_scale.go, and 'used to' accounts of bugs. The
constraint each story protected stays as a present-tense reason (why tier 3
is reduced not removed, why the randomised arms take an order seed, why the
seed artist is eligible in Songs-like). Comments naming system_cron.go and
config.RecommendationConfig, neither of which holds what they claimed, now
name the scheduler and internal/recsettings.
Checked: non-comment tokens identical to HEAD; gofmt clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
const (
|
||||
discoverTotalSlots = 100
|
||||
// Bucket allocation, pushed toward *targeted* novelty (Scribe #1488):
|
||||
// Bucket allocation, pushed toward *targeted* novelty:
|
||||
// the taste-matched-unheard arm gets the plurality, dormant stays a
|
||||
// familiar anchor, and the crude random arm is trimmed to a
|
||||
// serendipity sliver. On a single-user server cross_user is empty and
|
||||
@@ -28,8 +28,8 @@ const (
|
||||
// discoverTrack is the common shape used by the bucket allocator. The
|
||||
// three sqlc-generated row types collapse into this internal struct so
|
||||
// downstream functions don't need to be generic over them. PickKind is
|
||||
// the originating bucket (taste_unheard/dormant/cross_user/random,
|
||||
// #1270/#1488), stamped in the row adapters so it survives the
|
||||
// the originating bucket (taste_unheard/dormant/cross_user/random),
|
||||
// stamped in the row adapters so it survives the
|
||||
// interleave — bucket identity is what makes the slot allocation
|
||||
// measurable in the metrics.
|
||||
type discoverTrack struct {
|
||||
@@ -95,8 +95,8 @@ type discoverPools struct {
|
||||
}
|
||||
|
||||
func loadDiscoverPools(ctx context.Context, q *dbq.Queries, logger *slog.Logger, userID pgtype.UUID, dateStr string) discoverPools {
|
||||
// The caps go into the query too (#5356): applied only here, after its
|
||||
// LIMIT, they left a heavily tagged artist or two owning the whole bucket.
|
||||
// The caps go into the query too: applied only here, after its LIMIT, they
|
||||
// would leave a heavily tagged artist or two owning the whole bucket.
|
||||
tasteRows, err := q.ListTasteUnheardTracksForDiscover(ctx, dbq.ListTasteUnheardTracksForDiscoverParams{
|
||||
UserID: userID, DateSeed: dateStr,
|
||||
MaxPerAlbum: discoverMaxTracksPerAlbum, MaxPerArtist: discoverMaxTracksPerArtist,
|
||||
@@ -229,12 +229,10 @@ type bucketRequest struct {
|
||||
// peer's supply ran out mid-distribution and the residual needs
|
||||
// to roll to other peers in a later pass.
|
||||
//
|
||||
// Bug history (May 2026): an earlier version recomputed
|
||||
// `deficit = b.want - final[i]` every pass without subtracting
|
||||
// previously-redistributed amounts, so a bucket with permanently
|
||||
// 0 final and want=30 kept handing out 30 to peers each pass. The
|
||||
// `redistributed` array below tracks per-source absorbed deficit so
|
||||
// subsequent passes only move the residual.
|
||||
// The `redistributed` array tracks how much of each source's deficit has
|
||||
// been absorbed, so later passes move only the residual: recomputing
|
||||
// `b.want - final[i]` each pass would hand out a permanently empty bucket's
|
||||
// whole want again on every pass.
|
||||
func redistributeSlots(buckets []bucketRequest) []int {
|
||||
n := len(buckets)
|
||||
final := make([]int, n)
|
||||
|
||||
Reference in New Issue
Block a user