Skip to content

feat : artistAlias 공용 패키지 분리 및 J-POP 번역 시 artist_ko 고정 적용 (#195)#196

Merged
GulSam00 merged 2 commits into
developfrom
feat/195-useArtistAliasInTranslation
Apr 17, 2026
Merged

feat : artistAlias 공용 패키지 분리 및 J-POP 번역 시 artist_ko 고정 적용 (#195)#196
GulSam00 merged 2 commits into
developfrom
feat/195-useArtistAliasInTranslation

Conversation

@GulSam00
Copy link
Copy Markdown
Owner

Summary

  • apps/web/src/constants/artistAlias.ts@repo/constants 공용 패키지로 분리해 web / crawling 양쪽에서 재사용 가능하도록 변경
  • packages/crawling/src/cron/translationJpn.ts 의 AI 번역 루프에서 artistAlias 매칭 시 artist_ko 를 alias 배열 0번째 값으로 덮어쓰기 (제목은 기존대로 AI 번역 유지)
  • 태깅 스크립트 1회 처리 상한을 5000 → 20000 으로 상향 (chore)

Resolves #195

Changes

@repo/constants 신규 패키지

  • packages/constants/{package.json, tsconfig.json, src/index.ts, src/artistAlias.ts} 추가
  • apps/web, packages/crawlingpackage.jsonworkspace:* 의존성 추가

apps/web

  • src/constants/artistAlias.ts 삭제
  • src/utils/getArtistAlias.ts 의 import 를 @repo/constants 로 교체

packages/crawling/src/cron/translationJpn.ts

  • artistAlias 로부터 artist 원어 → alias[0] 맵을 스크립트 시작 시점에 1회 생성
  • AI 번역 결과 수신 후, alias 매칭되면 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] 로그 출력 확인
  • alias 미등록 아티스트는 기존대로 [OK] 로 AI 번역 결과 사용 확인

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
singcode Ready Ready Preview, Comment Apr 17, 2026 3:01pm

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Extract artistAlias to shared package and apply fixed artist_ko in J-POP translation

✨ Enhancement

Grey Divider

Walkthroughs

Description
• 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
Diagram
flowchart 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"]
Loading

Grey Divider

File Changes

1. packages/constants/src/artistAlias.ts ✨ Enhancement +79/-0

Create shared artistAlias constant file

packages/constants/src/artistAlias.ts


2. packages/constants/src/index.ts ✨ Enhancement +1/-0

Export artistAlias from constants package

packages/constants/src/index.ts


3. packages/constants/package.json ⚙️ Configuration changes +18/-0

Add new constants package configuration

packages/constants/package.json


View more (8)
4. packages/constants/tsconfig.json ⚙️ Configuration changes +19/-0

Configure TypeScript for constants package

packages/constants/tsconfig.json


5. apps/web/src/constants/artistAlias.ts ✨ Enhancement +0/-79

Remove artistAlias from web app

apps/web/src/constants/artistAlias.ts


6. apps/web/src/utils/getArtistAlias.ts ✨ Enhancement +1/-2

Update import to use shared constants package

apps/web/src/utils/getArtistAlias.ts


7. apps/web/package.json Dependencies +1/-0

Add @repo/constants workspace dependency

apps/web/package.json


8. packages/crawling/src/cron/translationJpn.ts ✨ Enhancement +28/-9

Apply fixed artist_ko from alias mapping

packages/crawling/src/cron/translationJpn.ts


9. packages/crawling/src/cron/taggingSongs.ts ✨ Enhancement +1/-1

Increase processing limit to 20000 songs

packages/crawling/src/cron/taggingSongs.ts


10. packages/crawling/package.json Dependencies +1/-0

Add @repo/constants workspace dependency

packages/crawling/package.json


11. pnpm-lock.yaml Dependencies +18/-0

Update lock file with new package references

pnpm-lock.yaml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 17, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (2)

Grey Divider


Action required

1. Missing artistAlias loader utility 📎 Requirement gap ⚙ Maintainability
Description
@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.
Code

packages/constants/src/index.ts[1]

+export { artistAlias } from './artistAlias';
Evidence
PR Compliance ID 1 requires adding a reusable loader utility that maps each artist key to the first
alias entry (aliases[0]). The new constants package exports only artistAlias and the cron
rebuilds the map inline instead of using a shared loader.

Add artistAlias mapping loader utility (artist key → Korean representative name)
packages/constants/src/index.ts[1-1]
packages/crawling/src/cron/translationJpn.ts[21-24]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


2. artistAliasMap applied after translation 📎 Requirement gap ➹ Performance
Description
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.
Code

packages/crawling/src/cron/translationJpn.ts[R56-61]

+    // 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);
Evidence
PR Compliance IDs 2 and 3 require checking the alias map before invoking OpenAI so the artist is not
translated when an alias exists (and only the title is translated when needed). The code performs
translation first, then looks up artistAliasMap and overwrites artist_ko, meaning the artist
translation call was not skipped.

Check alias map before OpenAI translation in translationJpn cron
When artist alias exists, translate only the title (or keep title if no Japanese present)
packages/crawling/src/cron/translationJpn.ts[47-61]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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



Remediation recommended

3. Unreported translation cap 🐞 Bug ◔ Observability
Description
translationJpn.ts는 processedCount가 10000에 도달하면 조기 종료하지만, 최종 요약 로그에는 cap/실제 처리 종료 여부가 표시되지 않습니다.
getJpopSongsForTranslationDB()가 최대 50000곡을 가져올 수 있어 cap이 걸린 경우에도 ‘총 N곡 중’만 보고 전체 처리가 끝난 것으로 오해할 수
있습니다.
Code

packages/crawling/src/cron/translationJpn.ts[R88-93]

console.log(`
  총 ${songs.length}곡 중:
  - 스킵 (이미 번역됨): ${resultsLog.skipped}곡
-  - 성공: ${resultsLog.success}곡
+  - 성공 (AI 번역): ${resultsLog.success}곡
+  - 성공 (artist_ko alias 적용): ${resultsLog.usedAlias}곡
  - 실패: ${resultsLog.failed}곡
Evidence
루프에 처리 상한(10000) break 조건이 있고, 데이터 조회는 50000 limit로 되어 있어 cap이 실제로 발생할 수 있습니다. 하지만 요약 출력은 cap 적용
여부/실제 처리 수(processedCount)를 포함하지 않습니다.

packages/crawling/src/cron/translationJpn.ts[30-35]
packages/crawling/src/cron/translationJpn.ts[87-94]
packages/crawling/src/supabase/getDB.ts[102-114]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`translationJpn.ts` prints a summary using `songs.length` but the loop may stop early due to `processedCount` cap (10000). This makes it hard to tell from logs whether the job finished all fetched songs or stopped due to the cap.

## Issue Context
- `getJpopSongsForTranslationDB()` can return up to 50,000 rows.
- The loop breaks when `processedCount >= 10000`.
- The final summary doesn’t mention `processedCount` nor whether the cap was reached.

## Fix Focus Areas
- packages/crawling/src/cron/translationJpn.ts[30-35]
- packages/crawling/src/cron/translationJpn.ts[87-94]

## Suggested change
- Track `const capped = processedCount >= CAP && songs.length > processedCount` (or set a boolean when breaking).
- Print something like:
 - `- 처리 상한: ${CAP} (도달 여부: ${capped})`
 - `- 실제 처리 시도: ${processedCount}곡`
 - Optionally `- 총 조회: ${songs.length}곡` remains as-is.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@GulSam00 GulSam00 merged commit 732ad6f into develop Apr 17, 2026
2 checks passed
@GulSam00 GulSam00 deleted the feat/195-useArtistAliasInTranslation branch April 17, 2026 15:02
@@ -0,0 +1 @@
export { artistAlias } from './artistAlias';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

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

Comment on lines +56 to +61
// 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: J-POP 번역 시 artistAlias 고정 번역 데이터 활용

1 participant