fix(likes): unliking any copy of a song retires the listening context captured on another (#8078)
release / go (push) Successful in 1m49s
release / web (push) Successful in 1m16s
release / govulncheck (push) Successful in 25s
release / integration (push) Failing after 4m12s
release / android (push) Successful in 4m47s
release / Build signed APK (push) Successful in 5m24s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / go (push) Successful in 1m49s
release / web (push) Successful in 1m16s
release / govulncheck (push) Successful in 25s
release / integration (push) Failing after 4m12s
release / android (push) Successful in 4m47s
release / Build signed APK (push) Successful in 5m24s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
A like is on the song: LikeTrack and UnlikeTrack change every copy sharing its song_key. The contextual like (the session captured while it played) is written on the copy that was playing, but an unlike soft-deleted only the copy it named. Unliking from the Liked list, which shows one copy per song, or from another album holding the song, left the context active, and the engine kept boosting candidates matching it. The soft-delete now covers every copy of the song, and the engine's reader counts only contexts whose song is still liked, as a backstop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -196,15 +196,22 @@ func trackTitles(cs []Candidate) []string {
|
||||
return out
|
||||
}
|
||||
|
||||
// helperInsertContextualLike inserts a contextual_like row with the given
|
||||
// session_vector marshaled to JSON. Bypasses playevents.CaptureContextualLikeIfPlaying
|
||||
// because we want full control over the stored vector for these unit tests.
|
||||
// helperInsertContextualLike likes the track and inserts a contextual_like
|
||||
// row with the given session_vector marshaled to JSON, as a like while
|
||||
// playing does. Bypasses playevents.CaptureContextualLikeIfPlaying because we
|
||||
// want full control over the stored vector for these unit tests. (Only a
|
||||
// still-liked song's context counts, so the like has to be there too.)
|
||||
func helperInsertContextualLike(t *testing.T, f fixture, trackID pgtype.UUID, vec SessionVector) {
|
||||
t.Helper()
|
||||
raw, err := json.Marshal(vec)
|
||||
if err != nil {
|
||||
t.Fatalf("marshal: %v", err)
|
||||
}
|
||||
if _, err := f.pool.Exec(context.Background(),
|
||||
`INSERT INTO general_likes (user_id, track_id) VALUES ($1, $2) ON CONFLICT DO NOTHING`,
|
||||
f.user, trackID); err != nil {
|
||||
t.Fatalf("like: %v", err)
|
||||
}
|
||||
if _, err := f.pool.Exec(context.Background(),
|
||||
`INSERT INTO contextual_likes (user_id, track_id, session_vector) VALUES ($1, $2, $3)`,
|
||||
f.user, trackID, raw); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user