곡 합치기: 멜론 id가 없는 곡으로 합칠 때 UNIQUE 오류로 실패하던 것 수정(복사본에서 빼고 남는 곡으로 옮김). fix-text 중복 합치기가 운영에서 이걸로 막혔음(트랜잭션이라 바뀐 것 없음)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-19 22:42:23 +09:00
parent 8e6fd229da
commit 86bd2d8166
3 changed files with 12 additions and 3 deletions

View File

@@ -40,6 +40,7 @@ test('fix-text repairs saved songs, chart rows and artists, retries 원곡 찾
);
const broken = add('Somebody&#x27;s Watching Me', 'Rockwell', 'none');
const matched = add('I&#x27;m On Fire', 'Bruce Springsteen', 'matched', 'ytmusic');
db.query('UPDATE songs SET melon_id = 2070041 WHERE id = ?').run(matched); // the copy came from a Melon chart
const admin = add('You &amp; Me', '제니', 'candidate', 'admin');
const original = add("I'm On Fire", 'Bruce Springsteen', 'matched', 'ytmusic');
const clean = add('Hype Boy', 'NewJeans', 'none');
@@ -53,6 +54,7 @@ test('fix-text repairs saved songs, chart rows and artists, retries 원곡 찾
expect(r.duplicates).toEqual([{ id: matched, title: "I'm On Fire", artist: 'Bruce Springsteen', sameAs: [original] }]);
// the copy went to the trash and its chart rows follow the song that stays
expect(db.query<{ deleted: number }, [number]>('SELECT deleted_at IS NOT NULL deleted FROM songs WHERE id = ?').get(matched)!.deleted).toBe(1);
expect(db.query<{ melon_id: number | null }, [number]>('SELECT melon_id FROM songs WHERE id = ?').get(original)!.melon_id).toBe(2070041);
const row = (id: number) => db.query<{ title: string; match_key: string }, [number]>('SELECT title, match_key FROM songs WHERE id = ?').get(id)!;
expect(row(broken)).toEqual({ title: "Somebody's Watching Me", match_key: songMatchKey("Somebody's Watching Me", 'Rockwell') });
expect(row(admin).title).toBe('You & Me');