Skip to content

fix: API 사용량 마커 정규식이 배열 포맷을 매칭하도록 수정 (#36)#40

Merged
soobing merged 2 commits intomainfrom
36-api-usage-not-accumulating
Apr 27, 2026
Merged

fix: API 사용량 마커 정규식이 배열 포맷을 매칭하도록 수정 (#36)#40
soobing merged 2 commits intomainfrom
36-api-usage-not-accumulating

Conversation

@soobing
Copy link
Copy Markdown
Contributor

@soobing soobing commented Apr 27, 2026

Summary

  • USAGE_DATA_RE 가 객체 패턴 ({.*?}) 만 캡처하던 탓에 실제 저장 포맷인 객체 배열에서 첫 객체만 잡혀, Array.isArray 분기에서 항상 빈 배열로 떨어져 누적이 사라졌습니다. 정규식을 (\[.*?\]) 로 수정하고 문서 주석을 실제 포맷에 맞춰 갱신했습니다.
  • tests/learningComment.test.js 에 누적 / 손상된 마커 폴백 / usage 미제공 케이스 회귀 테스트 4개 추가.
  • AGENTS.md 에 이번 버그의 증상·원인·수정·교훈을 ## 디버깅 기록 섹션으로 정리.

Closes #36

Test plan

🤖 Generated with Claude Code

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 27, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
github ada38f8 Commit Preview URL Apr 27 2026, 12:47 PM

USAGE_DATA_RE 가 `({.*?})` 로 객체 패턴만 캡처하던 탓에, 실제 저장
포맷인 객체 배열 `[{prompt,completion}, ...]` 에서 첫 객체만 잡혔고
Array.isArray 분기에서 항상 빈 배열로 떨어져 직전 누적 호출 기록이
사라졌다. 결과적으로 PR 갱신 시 `🔢 API 사용량` 표가 항상 최근 1행만
표시되었다 (#36).

- USAGE_DATA_RE 를 `(\[.*?\])` 로 변경하고 문서 주석을 실제 포맷에 맞춤
- tests/learningComment.test.js 추가: 누적 동작 / 손상된 마커 폴백 /
  usage 미제공 시 섹션 생략 회귀 테스트
- AGENTS.md 에 디버깅 기록 추가

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: sounmind <37020415+sounmind@users.noreply.github.com>
@soobing soobing force-pushed the 36-api-usage-not-accumulating branch from 9f48203 to 8d2f7a0 Compare April 27, 2026 12:40
@soobing soobing requested a review from sounmind April 27, 2026 12:41
@soobing soobing self-assigned this Apr 27, 2026
incident log 형태는 시간이 지나며 무관해지기 쉬워, 코멘트 숨김 마커
직렬화 포맷 변경 시의 일반화된 주의사항 한 항목만 `코드 수정 시
주의사항`에 남긴다. 구체적 사건 서사는 커밋 메시지/PR/코드 주석에 이미
보존돼 있다.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: sounmind <37020415+sounmind@users.noreply.github.com>
@soobing soobing merged commit a94df05 into main Apr 27, 2026
2 checks passed
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.

리트코드 스터디 학습 현황 코멘트에서 API 사용량이 업데이트되지 않음

2 participants