fix(taste): drop unused now param + tighten test (golangci-lint revive)
test-go / test (push) Successful in 28s
test-go / integration (push) Successful in 4m25s

golangci-lint v2 (CI-only; local is v1) flagged two unused-parameter issues:
- BuildTasteProfile's `now` was genuinely dead — decay/windowing are computed
  DB-side via now(), so no Go-side timestamp is threaded. Removed it (a
  phase-3 context model that needs a pinned reference time would re-add it);
  updated the scheduler call site.
- the degenerate-params engagement test ignored t; reworked it to assert the
  result stays in [-1,1], which also strengthens the test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 20:58:43 -04:00
parent 6e0d0e5723
commit 13b3fca949
4 changed files with 17 additions and 11 deletions
+4 -5
View File
@@ -155,7 +155,7 @@ func TestBuildTasteProfile_PositiveVsNegative(t *testing.T) {
seedPlay(t, pool, u.ID, skippedTrack.ID, now.Add(-time.Duration(i+1)*time.Hour), 0.02)
}
if err := BuildTasteProfile(context.Background(), pool, discardLogger(), u.ID, now, DefaultConfig()); err != nil {
if err := BuildTasteProfile(context.Background(), pool, discardLogger(), u.ID, DefaultConfig()); err != nil {
t.Fatalf("build: %v", err)
}
@@ -190,7 +190,7 @@ func TestBuildTasteProfile_AggregationProtectsArtist(t *testing.T) {
skipTrack := seedTrack(t, pool, fav.ID, "Indie")
seedPlay(t, pool, u.ID, skipTrack.ID, now.Add(-2*time.Hour), 0.02)
if err := BuildTasteProfile(context.Background(), pool, discardLogger(), u.ID, now, DefaultConfig()); err != nil {
if err := BuildTasteProfile(context.Background(), pool, discardLogger(), u.ID, DefaultConfig()); err != nil {
t.Fatalf("build: %v", err)
}
w, ok := artistWeight(t, pool, u.ID, fav.ID)
@@ -203,7 +203,6 @@ func TestBuildTasteProfile_AggregationProtectsArtist(t *testing.T) {
// plays still earns a positive weight from the like bonus.
func TestBuildTasteProfile_ArtistLikeBonus(t *testing.T) {
pool := newPool(t)
now := time.Now().UTC()
u := seedUser(t, pool, "tp3")
liked := seedArtist(t, pool, "LikedOnly")
if _, err := pool.Exec(context.Background(),
@@ -212,7 +211,7 @@ func TestBuildTasteProfile_ArtistLikeBonus(t *testing.T) {
t.Fatalf("seed artist like: %v", err)
}
if err := BuildTasteProfile(context.Background(), pool, discardLogger(), u.ID, now, DefaultConfig()); err != nil {
if err := BuildTasteProfile(context.Background(), pool, discardLogger(), u.ID, DefaultConfig()); err != nil {
t.Fatalf("build: %v", err)
}
w, ok := artistWeight(t, pool, u.ID, liked.ID)
@@ -240,7 +239,7 @@ func TestBuildTasteProfile_AtomicReplace(t *testing.T) {
return n
}
for i := 0; i < 2; i++ {
if err := BuildTasteProfile(ctx, pool, discardLogger(), u.ID, now, DefaultConfig()); err != nil {
if err := BuildTasteProfile(ctx, pool, discardLogger(), u.ID, DefaultConfig()); err != nil {
t.Fatalf("build %d: %v", i, err)
}
}