feat : artistAlias 공용 패키지 분리 및 J-POP 번역 시 artist_ko 고정 적용 (#195)#196
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Review Summary by QodoExtract artistAlias to shared package and apply fixed artist_ko in J-POP translation
WalkthroughsDescription• Extract artistAlias to shared @repo/constants package for reusability • Apply fixed artist_ko from alias array when J-POP translation matches registered artists • Increase tagging script processing limit from 5000 to 20000 songs • Add alias usage tracking and logging with [ALIAS] prefix in translation results Diagramflowchart LR
A["artistAlias constant"] -->|"moved to"| B["@repo/constants package"]
B -->|"imported by"| C["apps/web"]
B -->|"imported by"| D["packages/crawling"]
D -->|"uses alias map"| E["translationJpn.ts"]
E -->|"applies fixed artist_ko"| F["J-POP song translations"]
File Changes1. packages/constants/src/artistAlias.ts
|
Code Review by Qodo
1. Missing artistAlias loader utility
|
| @@ -0,0 +1 @@ | |||
| export { artistAlias } from './artistAlias'; | |||
There was a problem hiding this comment.
1. Missing artistalias loader utility 📎 Requirement gap ⚙ Maintainability
@repo/constants only exports the raw artistAlias object, and no reusable loader exists to produce an artist 원어 → aliases[0] lookup map. This forces each consumer to re-implement mapping logic and risks inconsistent canonical-name selection.
Agent Prompt
## Issue description
A reusable loader utility for `artistAlias` (artist key → representative Korean name using `aliases[0]`) is required, but `@repo/constants` currently exports only the raw object and consumers rebuild the map themselves.
## Issue Context
The compliance requirement mandates a single, consistent rule for representative naming (`aliases[0]`) that can be reused across web/crawling.
## Fix Focus Areas
- packages/constants/src/index.ts[1-1]
- packages/crawling/src/cron/translationJpn.ts[21-24]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| // artistAlias 에 등록된 아티스트면 artist_ko 를 고정 값(alias 배열 0번째)으로 덮어쓰기 | ||
| // title_ko 는 AI 번역 결과를 그대로 사용 | ||
| const aliasArtistKo = artistAliasMap.get(song.artist); | ||
| const finalArtistKo = aliasArtistKo ?? result.artist_ko; | ||
|
|
||
| const success = await updateSongKoTranslationDB(song.id, result.title_ko, result.artist_ko); | ||
| if (success) { | ||
| resultsLog.success++; | ||
| console.log(`[OK] ${song.title} → ${result.title_ko} / ${song.artist} → ${result.artist_ko}`); | ||
| } else { | ||
| const success = await updateSongKoTranslationDB(song.id, result.title_ko, finalArtistKo); |
There was a problem hiding this comment.
2. artistaliasmap applied after translation 📎 Requirement gap ➹ Performance
translationJpn.ts calls translateJpnToKo(song.title, song.artist) before checking the alias map, so OpenAI is still used even when a fixed artist alias exists. This violates the requirement to resolve artist via alias first and avoid translating the artist when an alias is present.
Agent Prompt
## Issue description
The cron invokes `translateJpnToKo` before alias resolution, so alias hits still incur OpenAI calls and still translate the artist.
## Issue Context
When an alias exists, `artist_ko` must come from the alias representative value (`aliases[0]`) and OpenAI should not be called for artist translation; only the title should be translated (and title should be kept as-is when it contains no Japanese).
## Fix Focus Areas
- packages/crawling/src/cron/translationJpn.ts[21-75]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
apps/web/src/constants/artistAlias.ts를@repo/constants공용 패키지로 분리해 web / crawling 양쪽에서 재사용 가능하도록 변경packages/crawling/src/cron/translationJpn.ts의 AI 번역 루프에서artistAlias매칭 시artist_ko를 alias 배열 0번째 값으로 덮어쓰기 (제목은 기존대로 AI 번역 유지)Resolves #195
Changes
@repo/constants신규 패키지packages/constants/{package.json, tsconfig.json, src/index.ts, src/artistAlias.ts}추가apps/web,packages/crawling의package.json에workspace:*의존성 추가apps/websrc/constants/artistAlias.ts삭제src/utils/getArtistAlias.ts의 import 를@repo/constants로 교체packages/crawling/src/cron/translationJpn.tsartistAlias로부터artist 원어 → alias[0]맵을 스크립트 시작 시점에 1회 생성artist_ko를 alias 값으로 대체[ALIAS]/[OK]프리픽스 분기, 결과 요약에usedAlias집계 추가Test plan
pnpm --filter web lint통과 확인pnpm --filter @repo/crawling lint통과 확인npx tsc --noEmit양쪽 패키지에서 에러 없음 확인pnpm trans-jpn수동 실행으로 alias 매칭 곡에[ALIAS]로그 출력 확인[OK]로 AI 번역 결과 사용 확인