test(playlists, recommendation): system-mix builds stop drawing covers no test reads; merge repeated cases (#8297)
release / go (push) Successful in 1m44s
release / web (push) Successful in 1m16s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 2m45s
release / android (push) Successful in 4m29s
release / Build signed APK (push) Successful in 4m40s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 14s
release / Verify release artifacts (tag releases only) (push) Skipped
release / go (push) Successful in 1m44s
release / web (push) Successful in 1m16s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 2m45s
release / android (push) Successful in 4m29s
release / Build signed APK (push) Successful in 4m40s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Publish the release image to GHCR (dispatch only) (push) Skipped
release / Build + push container image (push) Successful in 14s
release / Verify release artifacts (tag releases only) (push) Skipped
Timings from one run of the integration lane with -v (39c5b1ed, reverted
here) put the system-mix builds at 1.4-3.8s each, most of the playlists
package's 35s. A build draws a JPEG collage per mix; under -race that is
most of its time, and no build test looked at a cover. The build tests now
pass no data folder, which skips drawing, except SufficientActivity, which
keeps drawing and now checks every mix got a cover: nothing tested that the
build wires covers before.
Merged:
- playlists service: 22 tests become 5 scenario tests (access, bad input,
partial update, track-list edits, cover-file cleanup), one database
reset each.
- ARebuildKeepsEachMixsID into DailyNonceDeterminism (both built twice in
one day); the two You might like builds into one.
- capCandidatesByAlbumAndArtist, Score, Similarity, ContextualMatchScore
and the session-vector seed rule: one table each.
- LoadCandidates' six contextual-like database tests: the max and seed
rules are ContextualMatchScore's unit table; the database test keeps what
only it can see, a like reaching its track and a withdrawn like ignored.
Dropped: Score determinism with a fixed RNG (a pure function), Score's
cold-start case (the same input as the base case), and recencyDecay(nil)
and skipRatio's two cases, which Score's table covers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,58 +26,33 @@ func uuid(s string) pgtype.UUID {
|
||||
return u
|
||||
}
|
||||
|
||||
func TestBuildSessionVector_Empty_IsSeed(t *testing.T) {
|
||||
v := BuildSessionVector(nil)
|
||||
if !v.Seed {
|
||||
t.Errorf("Seed = false, want true for empty input")
|
||||
}
|
||||
if len(v.Artists) != 0 || len(v.Tags) != 0 || len(v.RecentTrackIDs) != 0 {
|
||||
t.Errorf("non-empty collections: %+v", v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildSessionVector_OneTrack_IsSeed(t *testing.T) {
|
||||
// A session is a seed (too short to describe) until it holds three tracks.
|
||||
// Artists are deduplicated and genres counted, and each track's id is kept.
|
||||
func TestBuildSessionVector_SeedUntilThreeTracks(t *testing.T) {
|
||||
a1 := uuid("11111111-1111-1111-1111-111111111111")
|
||||
tr := track(a1, "rock")
|
||||
tr.ID = uuid("22222222-2222-2222-2222-222222222222")
|
||||
v := BuildSessionVector([]dbq.Track{tr})
|
||||
if !v.Seed {
|
||||
t.Errorf("1 track: Seed=false, want true (< 3)")
|
||||
}
|
||||
if len(v.Artists) != 1 {
|
||||
t.Errorf("Artists: %+v", v.Artists)
|
||||
}
|
||||
if v.Tags["rock"] != 1 {
|
||||
t.Errorf("Tags: %+v", v.Tags)
|
||||
}
|
||||
if len(v.RecentTrackIDs) != 1 {
|
||||
t.Errorf("RecentTrackIDs: %+v", v.RecentTrackIDs)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildSessionVector_TwoTracks_IsSeed(t *testing.T) {
|
||||
a1 := uuid("11111111-1111-1111-1111-111111111111")
|
||||
v := BuildSessionVector([]dbq.Track{track(a1, "rock"), track(a1, "jazz")})
|
||||
if !v.Seed {
|
||||
t.Errorf("2 tracks: Seed=false, want true (< 3)")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildSessionVector_ThreeTracks_NotSeed(t *testing.T) {
|
||||
a1 := uuid("11111111-1111-1111-1111-111111111111")
|
||||
v := BuildSessionVector([]dbq.Track{
|
||||
track(a1, "rock"), track(a1, "rock"), track(a1, "rock"),
|
||||
})
|
||||
if v.Seed {
|
||||
t.Errorf("3 tracks: Seed=true, want false")
|
||||
}
|
||||
// All same artist → 1 entry.
|
||||
if len(v.Artists) != 1 {
|
||||
t.Errorf("Artists len = %d, want 1 (dedup)", len(v.Artists))
|
||||
}
|
||||
// All same genre → count 3.
|
||||
if v.Tags["rock"] != 3 {
|
||||
t.Errorf("Tags['rock'] = %d, want 3", v.Tags["rock"])
|
||||
rock := track(a1, "rock")
|
||||
rock.ID = uuid("22222222-2222-2222-2222-222222222222")
|
||||
for _, tc := range []struct {
|
||||
tracks []dbq.Track
|
||||
seed bool
|
||||
rockTags int
|
||||
}{
|
||||
{nil, true, 0},
|
||||
{[]dbq.Track{rock}, true, 1},
|
||||
{[]dbq.Track{rock, track(a1, "jazz")}, true, 1},
|
||||
{[]dbq.Track{rock, rock, rock}, false, 3},
|
||||
} {
|
||||
v := BuildSessionVector(tc.tracks)
|
||||
n := len(tc.tracks)
|
||||
if v.Seed != tc.seed {
|
||||
t.Errorf("%d tracks: Seed = %v, want %v", n, v.Seed, tc.seed)
|
||||
}
|
||||
if n > 0 && len(v.Artists) != 1 {
|
||||
t.Errorf("%d tracks by one artist: Artists = %v, want one", n, v.Artists)
|
||||
}
|
||||
if v.Tags["rock"] != tc.rockTags || len(v.RecentTrackIDs) != n {
|
||||
t.Errorf("%d tracks: rock = %d, recent ids = %d; want %d and %d", n, v.Tags["rock"], len(v.RecentTrackIDs), tc.rockTags, n)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user