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:
@@ -209,9 +209,9 @@ func TestTickOnce_MapsLBResponseToLocalLibrary(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// LB's scores are counts, not 0 to 1 (16 to 1445 on the operator's library).
|
||||
// An edge is stored over the seed's best score in the whole answer, in the
|
||||
// library or not, so the scorer reads it as 0 to 1 (#6177).
|
||||
// LB's scores are counts, not 0 to 1. An edge is stored over the seed's best
|
||||
// score in the whole answer, in the library or not, so the scorer reads it as
|
||||
// 0 to 1.
|
||||
func TestTickOnce_EdgeIsRelativeToTheSeedsBest(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
mbidA := "11111111-1111-1111-1111-111111111111"
|
||||
@@ -241,8 +241,8 @@ func TestTickOnce_EdgeIsRelativeToTheSeedsBest(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The 20-per-seed cap is gone with the cache (#5296): LB's answer is at most
|
||||
// 50, and every recording of it that is in the library becomes an edge.
|
||||
// LB's answer is at most 50, and every recording of it that is in the library
|
||||
// becomes an edge: no per-seed cap.
|
||||
func TestTickOnce_KeepsEveryInLibraryMatch(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
mbidSeed := "11111111-1111-1111-1111-111111111111"
|
||||
@@ -311,7 +311,7 @@ func TestTickOnce_RefreshesStaleRow(t *testing.T) {
|
||||
_ = f.pool.QueryRow(context.Background(),
|
||||
`SELECT score, fetched_at FROM track_similarity WHERE track_a_id = $1 AND track_b_id = $2 AND source = 'listenbrainz'`,
|
||||
trackA.ID, other.ID).Scan(&score, &fetchedAt)
|
||||
// The seed's only answer is its best, so the refreshed edge is 1.0 (#6177).
|
||||
// The seed's only answer is its best, so the refreshed edge is 1.0.
|
||||
if score != 1.0 {
|
||||
t.Errorf("score = %v, want 1.0 (refreshed, relative to the seed's best)", score)
|
||||
}
|
||||
@@ -452,7 +452,7 @@ func TestUpsertArtistSimilar_PersistsUnmatchedToTable(t *testing.T) {
|
||||
w := newTestWorker(f, "")
|
||||
|
||||
similars := []listenbrainz.SimilarArtist{
|
||||
// LB's scores are counts; rows are stored over the seed's best (#6177).
|
||||
// LB's scores are counts; rows are stored over the seed's best.
|
||||
{MBID: inLibMBID, Name: "InLib Artist", Score: 1000},
|
||||
{MBID: "out-mbid-1", Name: "Outsider One", Score: 850},
|
||||
{MBID: "out-mbid-2", Name: "Outsider Two", Score: 800},
|
||||
@@ -543,9 +543,9 @@ func recordingLB(answer func(mbid string) string) (*httptest.Server, func() []st
|
||||
}
|
||||
}
|
||||
|
||||
// The starvation #3879 measured: a seed whose answer matched nothing in the
|
||||
// library wrote nothing, stayed due, and was asked again every tick ahead of
|
||||
// everything behind it. Recording the fetch moves the queue on.
|
||||
// A seed whose answer matches nothing in the library writes no edges, and
|
||||
// must still leave the head of the queue: recording the fetch moves it on,
|
||||
// so it is not asked again every tick ahead of everything behind it.
|
||||
func TestTickOnce_UnmatchedAnswerDoesNotHoldTheQueue(t *testing.T) {
|
||||
f := newFixture(t)
|
||||
mbids := []string{
|
||||
@@ -583,7 +583,7 @@ func TestTickOnce_UnmatchedAnswerDoesNotHoldTheQueue(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// The point of the cache (#5296): a recording LB named while it was not in the
|
||||
// The point of the cache: a recording LB named while it was not in the
|
||||
// library becomes an edge once it arrives, on the next tick's resolve, without
|
||||
// asking LB again. One edge per recording when the library holds two copies,
|
||||
// and none to a copy that is missing.
|
||||
|
||||
Reference in New Issue
Block a user