release / go (push) Successful in 1m39s
release / web (push) Successful in 1m15s
release / govulncheck (push) Successful in 21s
release / integration (push) Successful in 4m3s
release / android (push) Successful in 4m46s
release / Build signed APK (push) Successful in 5m5s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 26s
release / Verify release artifacts (tag releases only) (push) Skipped
Test names, assertion messages and comments no longer cite internal task or rule numbers; each says the reason itself. The dev compose starts Minstrel after the database without a healthcheck to gate on, since Minstrel waits for its database at startup on its own. The published-names test is removed; that check is a local grep before publishing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.7 KiB
Go
62 lines
2.7 KiB
Go
package recommendation
|
|
|
|
import "testing"
|
|
|
|
// Songs-like's pool must lean on arms that MEASURE distance from the seed.
|
|
// The default gave ~29% of candidates a sim_score of literally 0
|
|
// (taste_overlap and random_fill are both `0.0::float8` in
|
|
// recommendation.sql), which is what let "Songs like X" wander.
|
|
func TestSongsLikeLimits_FavourTheArmsThatMeasureTheSeed(t *testing.T) {
|
|
d := DefaultCandidateSourceLimits()
|
|
s := SongsLikeCandidateSourceLimits()
|
|
|
|
if s.LBSimilar <= d.LBSimilar {
|
|
t.Errorf("LBSimilar %d is not above the default %d — the only arm that "+
|
|
"measures track-level distance from the seed should be favoured here",
|
|
s.LBSimilar, d.LBSimilar)
|
|
}
|
|
// The two seed-INDEPENDENT arms, which is the whole complaint.
|
|
zeroSimDefault := d.TasteOverlap + d.RandomFill
|
|
zeroSimSongsLike := s.TasteOverlap + s.RandomFill
|
|
if zeroSimSongsLike >= zeroSimDefault {
|
|
t.Errorf("seed-independent arms total %d, not reduced from the default %d; "+
|
|
"these carry sim_score 0 by construction", zeroSimSongsLike, zeroSimDefault)
|
|
}
|
|
}
|
|
|
|
// RULE 131: a system playlist degrades, it never vanishes.
|
|
//
|
|
// Zeroing the seed-independent arms was the first instinct and is exactly the
|
|
// vanish-or-nothing shape that rule forbids: a seed whose artist has thin
|
|
// ListenBrainz coverage would yield a short mix or none at all. They are the
|
|
// tier-3 FLOOR — reduced hard, never removed — and the songs_like weights are
|
|
// what keep them at the bottom of the ranking rather than out of the pool.
|
|
//
|
|
// "A few tracks further from the seed than we would like" beats "no playlist".
|
|
func TestSongsLikeLimits_KeepATierThreeFloor(t *testing.T) {
|
|
s := SongsLikeCandidateSourceLimits()
|
|
if s.RandomFill <= 0 {
|
|
t.Error("RandomFill is zero: a seed with thin similarity coverage now produces " +
|
|
"a short or empty mix instead of stepping down to looser picks")
|
|
}
|
|
if s.TasteOverlap <= 0 {
|
|
t.Error("TasteOverlap is zero: the graded floor is gone, leaving only random " +
|
|
"fill between a sparse seed and an empty playlist")
|
|
}
|
|
}
|
|
|
|
// The pool should stay roughly the size it was — this change is about
|
|
// COMPOSITION, not about starving the surface. A much smaller pool would also
|
|
// shrink what the per-artist cap has to work with.
|
|
func TestSongsLikeLimits_KeepThePoolRoughlyTheSameSize(t *testing.T) {
|
|
total := func(l CandidateSourceLimits) int {
|
|
return l.LBSimilar + l.SimilarArtist + l.TagOverlap + l.LikesOverlap +
|
|
l.RandomFill + l.TasteOverlap + l.UserCoplay
|
|
}
|
|
d, s := total(DefaultCandidateSourceLimits()), total(SongsLikeCandidateSourceLimits())
|
|
if s < d/2 {
|
|
t.Errorf("songs_like pool is %d against the default %d — less than half; "+
|
|
"this was meant to re-weight the pool, not starve it", s, d)
|
|
}
|
|
}
|