fix: clearing a wrong slot's MBID clears its source too, as tracks_mbid_source_pair requires (M498)
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m24s
release / go (push) Successful in 1m37s
release / android (push) Successful in 5m1s
release / integration (push) Successful in 5m4s
release / Build signed APK (releases and dev) (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m24s
release / go (push) Successful in 1m37s
release / android (push) Successful in 5m1s
release / integration (push) Successful in 5m4s
release / Build signed APK (releases and dev) (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ func (q *Queries) ClearStaleSuspectSourceTracks(ctx context.Context, pattern str
|
|||||||
|
|
||||||
const clearTrackMbids = `-- name: ClearTrackMbids :exec
|
const clearTrackMbids = `-- name: ClearTrackMbids :exec
|
||||||
UPDATE tracks
|
UPDATE tracks
|
||||||
SET mbid = NULL
|
SET mbid = NULL, mbid_source = NULL
|
||||||
WHERE id = ANY($1::uuid[])
|
WHERE id = ANY($1::uuid[])
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -66,6 +66,7 @@ UPDATE tracks
|
|||||||
// wrong-slot removal). The MBID came from that file, so it names the song kept
|
// wrong-slot removal). The MBID came from that file, so it names the song kept
|
||||||
// elsewhere on the album, and missing-pair folding would fold the emptied slot
|
// elsewhere on the album, and missing-pair folding would fold the emptied slot
|
||||||
// into it: twelve slots went that way on 2026-10-20 and were never wanted back.
|
// into it: twelve slots went that way on 2026-10-20 and were never wanted back.
|
||||||
|
// mbid_source goes with it (tracks_mbid_source_pair).
|
||||||
func (q *Queries) ClearTrackMbids(ctx context.Context, ids []pgtype.UUID) error {
|
func (q *Queries) ClearTrackMbids(ctx context.Context, ids []pgtype.UUID) error {
|
||||||
_, err := q.db.Exec(ctx, clearTrackMbids, ids)
|
_, err := q.db.Exec(ctx, clearTrackMbids, ids)
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -221,8 +221,9 @@ UPDATE tracks
|
|||||||
-- wrong-slot removal). The MBID came from that file, so it names the song kept
|
-- wrong-slot removal). The MBID came from that file, so it names the song kept
|
||||||
-- elsewhere on the album, and missing-pair folding would fold the emptied slot
|
-- elsewhere on the album, and missing-pair folding would fold the emptied slot
|
||||||
-- into it: twelve slots went that way on 2026-10-20 and were never wanted back.
|
-- into it: twelve slots went that way on 2026-10-20 and were never wanted back.
|
||||||
|
-- mbid_source goes with it (tracks_mbid_source_pair).
|
||||||
UPDATE tracks
|
UPDATE tracks
|
||||||
SET mbid = NULL
|
SET mbid = NULL, mbid_source = NULL
|
||||||
WHERE id = ANY(sqlc.arg(ids)::uuid[]);
|
WHERE id = ANY(sqlc.arg(ids)::uuid[]);
|
||||||
|
|
||||||
-- name: ClearTracksMissing :execrows
|
-- name: ClearTracksMissing :execrows
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ func TestResolveDuplicates_RemovesACopyFromAnotherSongsSlot_Integration(t *testi
|
|||||||
seedTrackList(t, f.pool, f.album, map[string]int{"Void": 220500, "Reach": 281000})
|
seedTrackList(t, f.pool, f.album, map[string]int{"Void": 220500, "Reach": 281000})
|
||||||
// The wrong file is Void's recording, so it carries Void's MBID.
|
// The wrong file is Void's recording, so it carries Void's MBID.
|
||||||
if _, err := f.pool.Exec(context.Background(),
|
if _, err := f.pool.Exec(context.Background(),
|
||||||
`UPDATE tracks SET mbid = 'rec-void' WHERE id = ANY($1)`, []pgtype.UUID{f.a.ID, f.b.ID}); err != nil {
|
`UPDATE tracks SET mbid = 'rec-void', mbid_source = 'tag' WHERE id = ANY($1)`, []pgtype.UUID{f.a.ID, f.b.ID}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
res, err := ResolveDuplicates(context.Background(), f.pool, nil, "", true)
|
res, err := ResolveDuplicates(context.Background(), f.pool, nil, "", true)
|
||||||
|
|||||||
Reference in New Issue
Block a user