Skip to content

Merge : 자동완성 개선. 크롤링 API 수정#164

Merged
GulSam00 merged 21 commits intomainfrom
develop
Mar 15, 2026
Merged

Merge : 자동완성 개선. 크롤링 API 수정#164
GulSam00 merged 21 commits intomainfrom
develop

Conversation

@GulSam00
Copy link
Owner

📌 PR 제목

[Type] : 작업 내용 요약

📌 변경 사항

💬 추가 참고 사항

GulSam00 and others added 21 commits March 8, 2026 15:17
- updateDataLog 및 log/ 폴더 관련 코드 전체 제거 (DB가 성공/실패 상태 관리)
- saveCrawlYoutubeFailedKYSongs 제거 (crawlYoutube가 DB 방식으로 전환되어 미사용)
- replaceSupabaseFailed에서 loadValidKYSongs → loadCrawlYoutubeFailedKYSongs 버그 수정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix : yml 액션 파일 환경 변수 받게 수정
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix : crawlYoutubeVerify 우분투 환경 Puppeteer 샌드박스 옵션 추가
fix : 레이아웃 간격 조정
@vercel
Copy link
Contributor

vercel bot commented Mar 15, 2026

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

Project Deployment Actions Updated (UTC)
singcode Ready Ready Preview, Comment Mar 15, 2026 9:35am

@GulSam00 GulSam00 merged commit 35c4aba into main Mar 15, 2026
1 check passed
@qodo-code-review
Copy link

Review Summary by Qodo

Refactor KY validation to AI-based matching and remove file-based logging

✨ Enhancement 🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Replace KY song validation with AI-based matching using GPT-4o-mini
• Refactor crawling checkpoint system from file-based to database-backed
• Remove unused query package and file-based logging infrastructure
• Improve autocomplete label matching to require exact match before substitution
• Update artist alias and Korean-Japanese mapping data
Diagram
flowchart LR
  A["KY Crawling<br/>crawlYoutube.ts"] -->|YouTube Search| B["Extract Number"]
  B -->|Validate| C["isValidKYExistNumber"]
  C -->|AI Match| D["validateSongMatch<br/>GPT-4o-mini"]
  D -->|Valid| E["postVerifyKySongsDB<br/>verify_ky_songs table"]
  D -->|Invalid| F["postInvalidKYSongsDB<br/>invalid_ky_songs table"]
  E -->|Checkpoint| G["getVerifyKySongsDB<br/>Resume Support"]
  H["Old System<br/>File-based Logs"] -.->|Removed| I["New System<br/>DB Checkpoints"]
Loading

Grey Divider

File Changes

1. apps/web/src/hooks/useSearchSong.ts 🐞 Bug fix +4/-2

Add exact label matching for autocomplete substitution

apps/web/src/hooks/useSearchSong.ts


2. apps/web/src/constants/artistAlias.ts ⚙️ Configuration changes +6/-7

Update artist aliases with new entries and removals

apps/web/src/constants/artistAlias.ts


3. apps/web/src/constants/krToJpnArtist.ts ⚙️ Configuration changes +4/-0

Add new artist mappings and Korean-Japanese translations

apps/web/src/constants/krToJpnArtist.ts


View more (37)
4. packages/crawling/src/crawling/isValidKYExistNumber.ts ✨ Enhancement +14/-25

Replace string parsing with AI-based song validation

packages/crawling/src/crawling/isValidKYExistNumber.ts


5. packages/crawling/src/crawling/crawlYoutubeVerify.ts ✨ Enhancement +50/-0

New file for database-backed KY verification with checkpoints

packages/crawling/src/crawling/crawlYoutubeVerify.ts


6. packages/crawling/src/utils/validateSongMatch.ts ✨ Enhancement +46/-0

New AI utility for song matching using OpenAI GPT-4o-mini

packages/crawling/src/utils/validateSongMatch.ts


7. packages/crawling/src/supabase/getDB.ts ✨ Enhancement +10/-0

Add getVerifyKySongsDB function for checkpoint tracking

packages/crawling/src/supabase/getDB.ts


8. packages/crawling/src/supabase/postDB.ts ✨ Enhancement +17/-1

Add postVerifyKySongsDB function for verified songs

packages/crawling/src/supabase/postDB.ts


9. packages/crawling/src/crawling/crawlYoutubeTemp.ts Miscellaneous +0/-109

Remove temporary crawling script file

packages/crawling/src/crawling/crawlYoutubeTemp.ts


10. packages/crawling/src/crawling/crawlYoutubeUbuntu.ts Miscellaneous +0/-127

Remove Ubuntu-specific crawling script file

packages/crawling/src/crawling/crawlYoutubeUbuntu.ts


11. packages/crawling/src/crawling/crawlYoutubeValid.ts Miscellaneous +0/-54

Remove legacy validation script replaced by crawlYoutubeVerify

packages/crawling/src/crawling/crawlYoutubeValid.ts


12. packages/crawling/src/crawling/replaceSupabaseFailed.ts Miscellaneous +10/-11

Comment out file-based logging and checkpoint logic

packages/crawling/src/crawling/replaceSupabaseFailed.ts


13. packages/crawling/src/crawling/crawlRecentTJ.ts Miscellaneous +1/-3

Remove updateDataLog calls for file-based logging

packages/crawling/src/crawling/crawlRecentTJ.ts


14. packages/crawling/src/findKYByOpen.ts Miscellaneous +0/-3

Remove file-based logging infrastructure

packages/crawling/src/findKYByOpen.ts


15. packages/crawling/src/postAllOpenSongs.ts Miscellaneous +4/-14

Remove file-based logging from song posting

packages/crawling/src/postAllOpenSongs.ts


16. packages/crawling/src/postByRelease.ts Miscellaneous +2/-6

Remove file-based logging from release posting

packages/crawling/src/postByRelease.ts


17. packages/crawling/src/postTransDictionary.ts Miscellaneous +10/-14

Comment out file-based logging for translations

packages/crawling/src/postTransDictionary.ts


18. packages/crawling/src/updateJpnSongs.ts Miscellaneous +0/-9

Remove file-based logging from Japanese song updates

packages/crawling/src/updateJpnSongs.ts


19. packages/crawling/src/utils/logData.ts Miscellaneous +0/-50

Remove updateDataLog function, keep dictionary logging

packages/crawling/src/utils/logData.ts


20. packages/crawling/CLAUDE.md 📝 Documentation +113/-0

Add comprehensive documentation for crawling package

packages/crawling/CLAUDE.md


21. packages/crawling/package.json ⚙️ Configuration changes +2/-3

Update scripts to use new verify command and remove Ubuntu variant

packages/crawling/package.json


22. packages/query/src/index.ts Miscellaneous +0/-3

Remove entire query package exports

packages/query/src/index.ts


23. packages/query/src/open-api/index.ts Miscellaneous +0/-7

Remove query package open-api exports

packages/query/src/open-api/index.ts


24. packages/query/src/open-api/useSinger.ts Miscellaneous +0/-29

Remove query package hook file

packages/query/src/open-api/useSinger.ts


25. packages/query/src/open-api/useSong.ts Miscellaneous +0/-29

Remove query package hook file

packages/query/src/open-api/useSong.ts


26. packages/query/src/open-api/useComposer.ts Miscellaneous +0/-29

Remove query package hook file

packages/query/src/open-api/useComposer.ts


27. packages/query/src/open-api/useLyricist.ts Miscellaneous +0/-29

Remove query package hook file

packages/query/src/open-api/useLyricist.ts


28. packages/query/src/open-api/useNo.ts Miscellaneous +0/-29

Remove query package hook file

packages/query/src/open-api/useNo.ts


29. packages/query/src/open-api/useRelease.ts Miscellaneous +0/-29

Remove query package hook file

packages/query/src/open-api/useRelease.ts


30. packages/query/src/open-api/usePopular.ts Miscellaneous +0/-27

Remove query package hook file

packages/query/src/open-api/usePopular.ts


31. packages/query/src/types.ts Miscellaneous +0/-8

Remove query package type definitions

packages/query/src/types.ts


32. packages/query/package.json Miscellaneous +0/-27

Remove entire query package configuration

packages/query/package.json


33. packages/query/tsconfig.json Miscellaneous +0/-19

Remove query package TypeScript configuration

packages/query/tsconfig.json


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

Remove @repo/query dependency

apps/web/package.json


35. apps/web/src/app/info/like/page.tsx 🐞 Bug fix +1/-1

Adjust ScrollArea height calculation

apps/web/src/app/info/like/page.tsx


36. apps/web/src/app/popular/PopularRankingList.tsx 🐞 Bug fix +1/-1

Adjust ScrollArea height calculation

apps/web/src/app/popular/PopularRankingList.tsx


37. .github/workflows/update_ky_youtube.yml ⚙️ Configuration changes +1/-0

Add OPENAI_API_KEY environment variable

.github/workflows/update_ky_youtube.yml


38. .github/workflows/verify_ky_youtube.yml ✨ Enhancement +41/-0

New workflow for KY verification with AI validation

.github/workflows/verify_ky_youtube.yml


39. CLAUDE.md 📝 Documentation +20/-0

Add Git workflow documentation for branch cleanup

CLAUDE.md


40. pnpm-lock.yaml Additional files +0/-19

...

pnpm-lock.yaml


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Mar 15, 2026

Code Review by Qodo

🐞 Bugs (5) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. ky-update premature exit 🐞 Bug ⛯ Reliability
Description
packages/crawling의 ky-update가 &로 ky-youtube를 백그라운드 실행하고 wait하지 않아, ky-verify 종료 시점에 전체 스크립트가 끝나면서
ky-youtube가 중간에 종료되거나 결과가 불완전해질 수 있습니다.
Code

packages/crawling/package.json[13]

+    "ky-update": "pnpm run ky-youtube & pnpm run ky-verify",
Evidence
&는 첫 커맨드를 백그라운드로 보내고, 이후 커맨드(ky-verify)만 포그라운드로 실행합니다. wait/동시 실행 도구 없이 종료하면 ky-youtube의 완료/실패가
ky-update의 종료 코드 및 완료 시점에 반영되지 않습니다.

packages/crawling/package.json[9-19]

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

### Issue description
`ky-update` 스크립트가 `&amp;`로 백그라운드 실행을 만들고 `wait` 없이 종료되어, 한 작업이 끝나기 전에 스크립트가 종료되거나 실패가 전파되지 않습니다.

### Issue Context
현재 `ky-update`는 ky-youtube(백그라운드) + ky-verify(포그라운드) 형태입니다.

### Fix Focus Areas
- packages/crawling/package.json[9-19]

### Suggested implementation
- 옵션 A: `pnpm run ky-youtube &amp; pnpm run ky-verify; wait`
- 옵션 B(권장): `concurrently -k -s first &quot;pnpm run ky-youtube&quot; &quot;pnpm run ky-verify&quot;` 추가 및 exit code 전파

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


2. Puppeteer leak/hang risk 🐞 Bug ⛯ Reliability
Description
crawlYoutubeVerify가 Puppeteer를 top-level에서 실행하고 try/finally 없이 browser.close()를 await하지 않아, 중간 예외
발생 시 브라우저 프로세스가 남거나 스크립트가 종료/행(hang)될 수 있습니다.
Code

packages/crawling/src/crawling/crawlYoutubeVerify.ts[R13-50]

+const browser = await puppeteer.launch({
+  headless: true,
+  args: ['--no-sandbox', '--disable-setuid-sandbox'],
+});
+const page = await browser.newPage();
+
+const data = await getSongsKyNotNullDB();
+const verifiedIds = await getVerifyKySongsDB();
+
+console.log('getSongsKyNotNullDB : ', data.length);
+console.log('이미 검증된 곡 수 : ', verifiedIds.size);
+let index = 0;
+
+for (const song of data) {
+  if (verifiedIds.has(song.id!)) {
+    continue;
+  }
+
+  console.log(song.title, ' - ', song.artist + ' : ', song.num_ky);
+  let isValid = true;
+  try {
+    isValid = await isValidKYExistNumber(page, song.num_ky, song.title, song.artist);
+  } catch (error) {
+    index++;
+    continue;
+  }
+
+  if (isValid) {
+    await postVerifyKySongsDB(song);
+  } else {
+    await updateSongsKyDB({ ...song, num_ky: null });
+  }
+
+  index++;
+  console.log('crawlYoutubeVerify : ', index);
+}
+
+browser.close();
Evidence
동일 레포의 crawlYoutube.ts는 try/finally에서 await browser.close()로 정리하지만, verify 스크립트는 정리 보장이 없고 close도
await하지 않습니다. 이는 CI/장시간 실행에서 리소스 누수 또는 종료 지연의 직접 원인이 됩니다.

packages/crawling/src/crawling/crawlYoutubeVerify.ts[13-50]
packages/crawling/src/crawling/crawlYoutube.ts[149-155]

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

### Issue description
`crawlYoutubeVerify.ts`가 Puppeteer lifecycle을 보장하지 않고 `browser.close()`도 await하지 않아, 예외/중단 시 브라우저 프로세스가 남아 스크립트가 hang되거나 리소스가 누수될 수 있습니다.

### Issue Context
현재 verify 스크립트는 top-level await로 실행되며, 종료 정리 로직이 보장되지 않습니다.

### Fix Focus Areas
- packages/crawling/src/crawling/crawlYoutubeVerify.ts[13-50]

### Suggested implementation
- `const main = async () =&gt; { ... } ; main();`
- `try { ... } catch { ... } finally { await browser.close(); }`
- `browser.close()`는 반드시 `await` 처리

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


3. Verify insert errors hidden 🐞 Bug ⛯ Reliability
Description
postVerifyKySongsDB가 Supabase insert error가 발생해도 true를 반환해 호출자가 실패를 감지할 수 없고, 검증 마킹 누락이 발생해도 다음 실행에서
반복 처리될 수 있습니다.
Code

packages/crawling/src/supabase/postDB.ts[R75-88]

+export async function postVerifyKySongsDB(song: Song) {
+  const supabase = getClient();
+
+  try {
+    const { id, title, artist } = song;
+    const { error } = await supabase.from('verify_ky_songs').insert({ id, title, artist }).select();
+    if (error) {
+      console.error('postVerifyKySongsDB error : ', error);
+    }
+    return true;
+  } catch (error) {
+    console.error('catch - postVerifyKySongsDB error : ', error);
+    return error;
+  }
Evidence
Supabase가 error를 반환해도 함수가 true를 반환하므로, 상위에서 실패 여부에 기반한 제어(재시도/중단/기록)를 할 수 없습니다. 또한 catch에서는 error
객체를 그대로 반환해 반환 타입도 일관되지 않습니다.

packages/crawling/src/supabase/postDB.ts[75-89]

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

### Issue description
DB insert가 실패해도 `postVerifyKySongsDB`가 성공(true)으로 처리되어 실패 감지/대응이 불가능합니다. 또한 catch에서 error 객체를 반환해 반환 타입이 불일치합니다.

### Issue Context
verify 파이프라인의 체크포인트 테이블(verify_ky_songs)에 대한 기록이 실패해도 상위 로직은 알 수 없습니다.

### Fix Focus Areas
- packages/crawling/src/supabase/postDB.ts[75-89]

### Suggested implementation
- 함수 시그니처를 `Promise&lt;boolean&gt;`로 명확화
- `if (error) { console.error(...); return false; }`
- 또는 `if (error) throw error;`로 변경 후 호출부에서 try/catch 처리
- `.select()` 결과를 사용하지 않으면 제거

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



Remediation recommended

4. Verify errors silently skipped 🐞 Bug ✧ Quality
Description
crawlYoutubeVerify가 isValidKYExistNumber 예외를 잡고 로그/기록 없이 continue하여, 검증 실패 원인이 노출되지 않고 동일 곡이 다음
실행에서도 반복 처리될 수 있습니다.
Code

packages/crawling/src/crawling/crawlYoutubeVerify.ts[R33-38]

+  try {
+    isValid = await isValidKYExistNumber(page, song.num_ky, song.title, song.artist);
+  } catch (error) {
+    index++;
+    continue;
+  }
Evidence
verify 스크립트는 예외를 무시하지만, 동일한 검증 로직을 쓰는 crawlYoutube.ts는 예외를 console.error로 기록합니다. 따라서 현재 변경은 실패 원인
추적을 어렵게 만들고 재시도로 인한 불필요한 반복 작업을 유발합니다.

packages/crawling/src/crawling/crawlYoutubeVerify.ts[33-38]
packages/crawling/src/crawling/crawlYoutube.ts[125-133]

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

### Issue description
검증 단계 예외가 로깅/기록 없이 무시되어 운영 중 실패 원인을 알 수 없고, 동일 항목이 반복 처리될 수 있습니다.

### Issue Context
`crawlYoutubeVerify.ts`는 예외 발생 시 index만 증가시키고 continue합니다.

### Fix Focus Areas
- packages/crawling/src/crawling/crawlYoutubeVerify.ts[33-38]

### Suggested implementation
- `console.error(&#x27;❌ verify error&#x27;, {id: song.id, title: song.title, artist: song.artist, num_ky: song.num_ky}, error)` 추가
- (선택) 실패한 id를 별도 Set/테이블/파일에 기록해 다음 실행에서 스킵하거나 재시도 정책을 명확화

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


5. Unguarded JSON.parse 🐞 Bug ⛯ Reliability
Description
validateSongMatch가 모델 응답을 JSON.parse로 직접 파싱하며 예외 처리가 없어, 응답 형식이 깨지면 검증 단계가 throw되어 상위 크롤링/검증 루프가
스킵/중단될 수 있습니다.
Code

packages/crawling/src/utils/validateSongMatch.ts[R23-45]

+  const response = await client.chat.completions.create({
+    model: 'gpt-4o-mini',
+    messages: [
+      {
+        role: 'system',
+        content:
+          'Decide if two (title, artist) pairs refer to the same song. Allow spelling variants (spaces, en/kr, case). Return JSON: {"isValid":boolean}',
+      },
+      {
+        role: 'user',
+        content: `"${inputTitle}"(${inputArtist}) vs "${foundTitle}"(${foundArtist})`,
+      },
+    ],
+    response_format: { type: 'json_object' },
+    temperature: 0,
+    max_tokens: 20,
+  });
+
+  const content = response.choices[0].message.content;
+  if (!content) return false;
+
+  const result: { isValid: boolean } = JSON.parse(content);
+  return result.isValid;
Evidence
response_format: json_object와 content null 체크가 있어도, 파싱 실패 시 예외가 그대로 전파됩니다. verify 스크립트는 현재 그 예외를
로깅 없이 삼키므로(별도 finding), 원인 파악이 더 어려워집니다.

packages/crawling/src/utils/validateSongMatch.ts[23-45]

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

### Issue description
`validateSongMatch`가 JSON.parse 예외를 처리하지 않아, 응답이 예상 형식이 아니면 throw됩니다.

### Issue Context
상위 호출부(crawlYoutube/crawlYoutubeVerify)는 이 예외를 처리하긴 하지만, verify 쪽은 현재 로깅 없이 건너뛰어 디버깅이 어렵습니다.

### Fix Focus Areas
- packages/crawling/src/utils/validateSongMatch.ts[23-45]

### Suggested implementation
- `try { const result = JSON.parse(content); return !!result?.isValid; } catch (e) { console.error(...); return false; }`
- (선택) `typeof result.isValid === &#x27;boolean&#x27;` 체크

ⓘ 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

"ky-valid": "tsx src/crawling/crawlYoutubeValid.ts",
"ky-update": "pnpm run ky-youtube & pnpm run ky-valid",
"ky-verify": "tsx src/crawling/crawlYoutubeVerify.ts",
"ky-update": "pnpm run ky-youtube & pnpm run ky-verify",

Choose a reason for hiding this comment

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

Action required

1. Ky-update premature exit 🐞 Bug ⛯ Reliability

packages/crawling의 ky-update가 &로 ky-youtube를 백그라운드 실행하고 wait하지 않아, ky-verify 종료 시점에 전체 스크립트가 끝나면서
ky-youtube가 중간에 종료되거나 결과가 불완전해질 수 있습니다.
Agent Prompt
### Issue description
`ky-update` 스크립트가 `&`로 백그라운드 실행을 만들고 `wait` 없이 종료되어, 한 작업이 끝나기 전에 스크립트가 종료되거나 실패가 전파되지 않습니다.

### Issue Context
현재 `ky-update`는 ky-youtube(백그라운드) + ky-verify(포그라운드) 형태입니다.

### Fix Focus Areas
- packages/crawling/package.json[9-19]

### Suggested implementation
- 옵션 A: `pnpm run ky-youtube & pnpm run ky-verify; wait`
- 옵션 B(권장): `concurrently -k -s first "pnpm run ky-youtube" "pnpm run ky-verify"` 추가 및 exit code 전파

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

Comment on lines +13 to +50
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
const page = await browser.newPage();

const data = await getSongsKyNotNullDB();
const verifiedIds = await getVerifyKySongsDB();

console.log('getSongsKyNotNullDB : ', data.length);
console.log('이미 검증된 곡 수 : ', verifiedIds.size);
let index = 0;

for (const song of data) {
if (verifiedIds.has(song.id!)) {
continue;
}

console.log(song.title, ' - ', song.artist + ' : ', song.num_ky);
let isValid = true;
try {
isValid = await isValidKYExistNumber(page, song.num_ky, song.title, song.artist);
} catch (error) {
index++;
continue;
}

if (isValid) {
await postVerifyKySongsDB(song);
} else {
await updateSongsKyDB({ ...song, num_ky: null });
}

index++;
console.log('crawlYoutubeVerify : ', index);
}

browser.close();

Choose a reason for hiding this comment

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

Action required

2. Puppeteer leak/hang risk 🐞 Bug ⛯ Reliability

crawlYoutubeVerify가 Puppeteer를 top-level에서 실행하고 try/finally 없이 browser.close()를 await하지 않아, 중간 예외
발생 시 브라우저 프로세스가 남거나 스크립트가 종료/행(hang)될 수 있습니다.
Agent Prompt
### Issue description
`crawlYoutubeVerify.ts`가 Puppeteer lifecycle을 보장하지 않고 `browser.close()`도 await하지 않아, 예외/중단 시 브라우저 프로세스가 남아 스크립트가 hang되거나 리소스가 누수될 수 있습니다.

### Issue Context
현재 verify 스크립트는 top-level await로 실행되며, 종료 정리 로직이 보장되지 않습니다.

### Fix Focus Areas
- packages/crawling/src/crawling/crawlYoutubeVerify.ts[13-50]

### Suggested implementation
- `const main = async () => { ... } ; main();`
- `try { ... } catch { ... } finally { await browser.close(); }`
- `browser.close()`는 반드시 `await` 처리

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

Comment on lines +75 to +88
export async function postVerifyKySongsDB(song: Song) {
const supabase = getClient();

try {
const { id, title, artist } = song;
const { error } = await supabase.from('verify_ky_songs').insert({ id, title, artist }).select();
if (error) {
console.error('postVerifyKySongsDB error : ', error);
}
return true;
} catch (error) {
console.error('catch - postVerifyKySongsDB error : ', error);
return error;
}

Choose a reason for hiding this comment

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

Action required

3. Verify insert errors hidden 🐞 Bug ⛯ Reliability

postVerifyKySongsDB가 Supabase insert error가 발생해도 true를 반환해 호출자가 실패를 감지할 수 없고, 검증 마킹 누락이 발생해도 다음 실행에서
반복 처리될 수 있습니다.
Agent Prompt
### Issue description
DB insert가 실패해도 `postVerifyKySongsDB`가 성공(true)으로 처리되어 실패 감지/대응이 불가능합니다. 또한 catch에서 error 객체를 반환해 반환 타입이 불일치합니다.

### Issue Context
verify 파이프라인의 체크포인트 테이블(verify_ky_songs)에 대한 기록이 실패해도 상위 로직은 알 수 없습니다.

### Fix Focus Areas
- packages/crawling/src/supabase/postDB.ts[75-89]

### Suggested implementation
- 함수 시그니처를 `Promise<boolean>`로 명확화
- `if (error) { console.error(...); return false; }`
- 또는 `if (error) throw error;`로 변경 후 호출부에서 try/catch 처리
- `.select()` 결과를 사용하지 않으면 제거

ⓘ 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.

1 participant