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:
+17
-19
@@ -1,10 +1,9 @@
|
||||
// Package wanted is what Minstrel is looking for (M502 #5520): followed
|
||||
// artists, each on a release-type profile, and wanted release groups. A want
|
||||
// comes from an approved request, a followed artist's new release, or an
|
||||
// album whose files went missing; it is held once the library has a full
|
||||
// copy. The library's own albums were put on the list as held once (#5567),
|
||||
// so the list is the record of what the library keeps. Searching for open
|
||||
// wants is #5521's.
|
||||
// Package wanted is what Minstrel is looking for: followed artists, each on
|
||||
// a release-type profile, and wanted release groups. A want comes from an
|
||||
// approved request, a followed artist's new release, or an album whose files
|
||||
// went missing; it is held once the library has a full copy. The library's
|
||||
// own albums are put on the list as held once, so the list is the record of
|
||||
// what the library keeps. Searching for open wants is the Searcher's.
|
||||
package wanted
|
||||
|
||||
import (
|
||||
@@ -47,11 +46,11 @@ type Service struct {
|
||||
logger *slog.Logger
|
||||
now func() time.Time
|
||||
// releaseGroup names the group of a MusicBrainz release id, to move a
|
||||
// want recorded under a release id (#5241) to its group. A field so tests
|
||||
// want recorded under a release id to its group. A field so tests
|
||||
// stand in for MusicBrainz.
|
||||
releaseGroup func(ctx context.Context, releaseMBID string) (string, error)
|
||||
// upgradesChecked is when held albums were last judged for an upgrade
|
||||
// (#5524); the worker alone touches it.
|
||||
// the worker alone touches it.
|
||||
upgradesChecked time.Time
|
||||
}
|
||||
|
||||
@@ -196,9 +195,9 @@ type PassResult struct {
|
||||
Baselined int // of those, first reads
|
||||
Wanted int // wants recorded from follows
|
||||
Held int // wants the library now answers
|
||||
Listed int // library albums put on the list as held (#5567)
|
||||
Listed int // library albums put on the list as held
|
||||
// Upgrades: held albums wanted for a better copy, when the hourly check
|
||||
// ran this pass (#5524).
|
||||
// ran this pass.
|
||||
Upgrades int
|
||||
}
|
||||
|
||||
@@ -211,7 +210,7 @@ func (s *Service) Pass(ctx context.Context) (PassResult, error) {
|
||||
if ctx.Err() != nil {
|
||||
return res, ctx.Err()
|
||||
}
|
||||
// The one-time listing of the library (#5567); a failure waits for the
|
||||
// The one-time listing of the library; a failure waits for the
|
||||
// next pass and does not hold back settling.
|
||||
if err := s.listLibrary(ctx, &res); err != nil && ctx.Err() == nil {
|
||||
s.logger.Warn("wanted: list the library", "err", err)
|
||||
@@ -321,9 +320,9 @@ func (s *Service) applyFollow(ctx context.Context, q *dbq.Queries, f dbq.Follow)
|
||||
return wanted, q.MarkFollowChecked(ctx, f.ArtistMbid)
|
||||
}
|
||||
|
||||
// dropRefusedVersion takes off the list a group the follow wanted before
|
||||
// Passes read the version its title names (#5573), while it is still only
|
||||
// wanted: one the operator holds, or wanted for another reason, stays.
|
||||
// dropRefusedVersion takes off the list a group a follow wants that Passes
|
||||
// now refuses for the version its title names, while it is still only
|
||||
// wanted: one the library holds, or wanted for another reason, stays.
|
||||
func (s *Service) dropRefusedVersion(ctx context.Context, q *dbq.Queries, group, title string) error {
|
||||
v, ok := release.VersionInTitle(title)
|
||||
if !ok {
|
||||
@@ -464,7 +463,7 @@ func Shortest(releases []dbq.MbRelease) int {
|
||||
}
|
||||
|
||||
// moveToGroup handles a want MusicBrainz has no release group under: one
|
||||
// recorded under a release id before #5241. It is moved to the release's
|
||||
// recorded under a release id. It is moved to the release's
|
||||
// group, with the requests that name it; when the group is already wanted,
|
||||
// this copy is dropped.
|
||||
func (s *Service) moveToGroup(ctx context.Context, w dbq.Want) (bool, error) {
|
||||
@@ -509,9 +508,8 @@ func (s *Service) moveToGroup(ctx context.Context, w dbq.Want) (bool, error) {
|
||||
// missing track is left without a track on disk in its place;
|
||||
// - otherwise an album of the group with at least as many tracks on disk as
|
||||
// the shortest official edition;
|
||||
// - and when the catalogue cannot say how long the group is, the test from
|
||||
// #5263: a track arrived since the want, or nothing missing before it is
|
||||
// still missing.
|
||||
// - and when the catalogue cannot say how long the group is: a track
|
||||
// arrived since the want, or nothing missing before it is still missing.
|
||||
//
|
||||
// Only albums with a track on disk count.
|
||||
func (s *Service) answeredBy(ctx context.Context, q *dbq.Queries, w dbq.Want, shortest int) (pgtype.UUID, bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user