docs: server comments say what the code does, not how it came to be (#6277)
Comment blocks in cmd/minstrel and 30 smaller internal packages, rewritten
to rule 32's standard with each citation read in context: task, milestone
and rule ids go, and so do the stories they were attached to ("used to",
"Before #N", measurements from one install, quotes, pointers to Fabled
Librarian's records and to docs/superpowers files that are not in the
repo). Where a story wrapped a real constraint, the constraint stays as a
present-tense fact.
Comments that had gone stale are corrected:
- taste.Config: the tuned values are overlaid by internal/recsettings;
it is no longer "a later follow-up".
- StorageConfig: the data dir holds art, caches and the stream secret,
not only playlist covers.
- the Subsonic album list and getUser comments describe what they do
today rather than a milestone that would change it.
Checked: the non-comment token stream of every changed file matches
HEAD, and gofmt -l is empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
// Package reacquisition wants an album back when its files go missing,
|
||||
// without anyone pressing anything (milestone #290; a want since M502
|
||||
// #5520).
|
||||
// without anyone pressing anything.
|
||||
//
|
||||
// The unit of work is the ALBUM, not the track. Music is acquired as
|
||||
// releases; there is no meaningful "fetch me one track", and a recording
|
||||
// MBID is something plenty of files lack. Grouping also does most of the
|
||||
// safety work: the loss that produced #2523 — three reorganised albums, ~40
|
||||
// missing files — becomes three wants rather than forty.
|
||||
// safety work: a reorganised album's forty missing files become one want,
|
||||
// not forty.
|
||||
package reacquisition
|
||||
|
||||
import (
|
||||
@@ -21,7 +20,7 @@ import (
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
|
||||
)
|
||||
|
||||
// Settings is the operator-tunable policy, mirroring the columns and CHECK
|
||||
// Settings is the admin-tunable policy, mirroring the columns and CHECK
|
||||
// ranges in migration 0056.
|
||||
type Settings struct {
|
||||
Enabled bool
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
)
|
||||
|
||||
// Sweeper periodically wants back albums whose files have been missing past
|
||||
// the grace window (milestone #290, M502 #5520). Searching for them is the
|
||||
// search schedule's (#5521), which retries per want.
|
||||
// the grace window. Searching for them is the search schedule's, which
|
||||
// retries per want.
|
||||
//
|
||||
// Deliberately a periodic worker rather than a hook inside the scanner's
|
||||
// reconcile pass: reconcile runs inside a scan and re-runs often, and a
|
||||
@@ -28,7 +28,7 @@ type Sweeper struct {
|
||||
logger *slog.Logger
|
||||
tick time.Duration
|
||||
// releaseGroup names the MusicBrainz release group of a release id, for an
|
||||
// album whose tags never carried one (#5241). Wants are kept by release
|
||||
// album whose tags never carried one. Wants are kept by release
|
||||
// group. A field so tests can stand in for MusicBrainz.
|
||||
releaseGroup func(ctx context.Context, releaseMBID string) (string, error)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func (s *Sweeper) SweepOnce(ctx context.Context) error {
|
||||
q := dbq.New(s.pool)
|
||||
var res PassResult
|
||||
// Counted, not acted on: an album MusicBrainz cannot name is not a
|
||||
// failure to retry, it is a permanent gap the operator should see.
|
||||
// failure to retry, it is a permanent gap an admin should see.
|
||||
if n, cerr := q.CountAlbumsMissingWithoutMbid(ctx); cerr == nil {
|
||||
res.Unnameable = n
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ func heldWant(t *testing.T, pool *pgxpool.Pool, group string, album pgtype.UUID,
|
||||
}
|
||||
}
|
||||
|
||||
// Only an album on the wanted list is fetched back (#5567): one taken off
|
||||
// it, or dropped into the library by hand, is not. An album on the list is
|
||||
// wanted by its release group, never its release id (#5241): a tag-supplied
|
||||
// Only an album on the wanted list is fetched back: one taken off it, or
|
||||
// dropped into the library by hand, is not. An album on the list is wanted
|
||||
// by its release group, never its release id: a tag-supplied
|
||||
// group is used as is; otherwise MusicBrainz names it and the answer is
|
||||
// cached onto the album; an album MusicBrainz cannot name is skipped and
|
||||
// tried again next pass.
|
||||
@@ -103,8 +103,7 @@ func TestSweep_WantsBackOnlyAlbumsOnTheList_Integration(t *testing.T) {
|
||||
resolved := lostAlbum(t, pool, "Resolved", "release-resolved", "")
|
||||
unknown := lostAlbum(t, pool, "Unknown", "release-unknown", "")
|
||||
_ = lostAlbum(t, pool, "Off The List", "release-off", "group-off")
|
||||
// Matched to a group with no release id: 238 such albums on the operator's
|
||||
// library were never wanted back (#6167).
|
||||
// Matched to a group with no release id: still wanted back.
|
||||
groupOnly := lostAlbum(t, pool, "Group Only", "", "group-only")
|
||||
heldWant(t, pool, "group-tagged", tagged, "3 days")
|
||||
heldWant(t, pool, "group-only", groupOnly, "3 days")
|
||||
@@ -165,7 +164,7 @@ func TestSweep_WantsBackOnlyAlbumsOnTheList_Integration(t *testing.T) {
|
||||
}
|
||||
|
||||
// A want held after the files went missing means the library has a full copy
|
||||
// despite the missing rows (#5245): the album is not wanted again. One held
|
||||
// despite the missing rows: the album is not wanted again. One held
|
||||
// before they went missing is reopened.
|
||||
func TestSweep_HeldWantsAreReopenedOnlyForANewLoss_Integration(t *testing.T) {
|
||||
pool := newSweepPool(t)
|
||||
|
||||
Reference in New Issue
Block a user