제목 정리 4단계: 서버 DB 곡 제목 정리 검토 — title_reviews(015), songs/title-review.ts(만들기·적용·건너뛰기·목록), cli clean-titles(--review: 모두 검토 목록 / 기본: 새 곡은 바로 반영, 일본어·확인 필요만 검토), 관리자 → 수집에 '제목 정리·정답 만들기', 관리자 → ✏️ 제목 정리(묶음별 목록, 제목·가수 고쳐서 적용, 건너뛰기, 묶음 전체 적용, 처리한 것). 적용하면 제목·가수와 새 정답·원래 이름(별칭), match_key는 그대로, 그사이 바뀐 곡은 적용 안 함. 영어 발음 다듬기(운영 사본 표본에서): 자음 뒤 l(플렉스·블루), s+w(스위트), ts(렛츠), ow+모음(플라워), 철자 o의 ɑ는 ㅗ(존·아이콘), 약모음은 철자대로(프로미스·사이렌), 단어 끝 -sle/-zle(캐슬), 대문자 한 글자는 글자 이름(알 오 디), 아포스트로피는 's/'t 등만. 단위·API 테스트, e2e admin(제목 정리), docs 13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-11-04 16:33:19 +09:00
parent 7385ae4b72
commit da500f489b
12 changed files with 694 additions and 21 deletions

View File

@@ -10,6 +10,7 @@ import { join } from 'node:path';
import { loadConfig } from '../apps/server/src/config';
import { startServer } from '../apps/server/src/server';
import { Catalog } from '../apps/server/src/collector/catalog';
import { buildTitleReviews } from '../apps/server/src/songs/title-review';
import type { CookieStatus } from '../apps/server/src/collector/cookie-keeper';
const PORT = Number(process.env.E2E_PORT ?? 4623);
@@ -326,6 +327,34 @@ try {
db.query("UPDATE collect_jobs SET status = 'done', finished_at = ? WHERE kind = 'match-youtube' AND status = 'running'").run(Date.now());
});
await step('제목 정리: 묶음별 목록 → 제목 고쳐서 적용, 건너뛰기, 한 묶음 전체 적용 → DB 제목·정답 반영', async () => {
const c = new Catalog(db);
const add = (t: string, a: string) => c.upsert({ title: t, artists: [{ name: a }], source: 'e2e', ref: `tr-${t}` })[0]!;
const ids = [add('사랑을 했다(LOVE SCENARIO)', '아이콘'), add('Finesse (Feat. Cardi B)', 'Bruno Mars'), add('Seven (feat. Latto) - Clean Ver.', '정국'), add('Pretender', '오피셜히게단디즘')];
await buildTitleReviews(db, { review: true, ids, wiki: async () => new Map() });
await p.goto(ORIGIN + '/admin/titles');
await p.getByRole('tab', { name: /제목·가수 정리 \(3\)/ }).waitFor();
await p.getByRole('tab', { name: /정답\(한글 발음 등\)만 추가 \(1\)/ }).waitFor();
await p.screenshot({ path: join(SHOTS, 'title-reviews.png'), fullPage: true });
// edit one before applying, skip another
await p.getByLabel('사랑을 했다(LOVE SCENARIO) 바뀔 제목').fill('사랑을 했다!');
await p.locator('tr', { hasText: '사랑을 했다(LOVE SCENARIO)' }).getByRole('button', { name: '적용' }).click();
await p.getByText('1곡에 적용했어요').waitFor();
await p.locator('tr', { hasText: 'Finesse (Feat. Cardi B)' }).getByRole('button', { name: '건너뛰기' }).click();
await p.getByText('1곡을 건너뛰었어요').waitFor();
// the 정답만 group, all at once
await p.getByRole('tab', { name: /정답\(한글 발음 등\)만 추가/ }).click();
await p.getByRole('button', { name: /전체 적용 \(1곡\)/ }).click();
await p.getByRole('button', { name: '모두 적용' }).click();
await p.getByText('이 묶음에는 검토할 곡이 없어요.').waitFor();
const title = (id: number) => db.query<{ title: string }, [number]>('SELECT title FROM songs WHERE id = ?').get(id)!.title;
const aliases = (id: number) => db.query<{ alias: string }, [number]>("SELECT alias FROM song_aliases WHERE song_id = ? AND part = 'title' ORDER BY alias").all(id).map((r) => r.alias);
expect(title(ids[0]!) === '사랑을 했다!' && aliases(ids[0]!).includes('LOVE SCENARIO') && aliases(ids[0]!).includes('사랑을 했다(LOVE SCENARIO)'), `적용: ${title(ids[0]!)} ${aliases(ids[0]!)}`);
expect(title(ids[1]!) === 'Finesse (Feat. Cardi B)', `건너뛴 곡이 바뀜: ${title(ids[1]!)}`);
expect(title(ids[2]!) === 'Seven (feat. Latto) - Clean Ver.', '다른 묶음 곡이 바뀜');
expect(aliases(ids[3]!).includes('프리텐더'), `발음 정답: ${aliases(ids[3]!)}`);
});
await p.goto(ORIGIN + '/admin/songs');
await p.locator('.data-table tbody tr').first().waitFor();
await p.screenshot({ path: join(SHOTS, 'stage8-songs.png'), fullPage: true });