refactor(common): 코드 리뷰 반영 및 테스트 페이지 정리#35
Conversation
- errorStatsUtils: buildDailySlots, formatIssueSummary 유틸 분리 - stats/route: buildDailySlots 유틸 사용으로 리팩토링 - ErrorDetailView: formatIssueSummary 유틸 사용으로 리팩토링 - sentry-test/page: 에러 전송 버튼만 남기고 api 조회 ui 제거 - views/sentry/page.tsx: 불필요 파일 삭제 Resolves: #30 See also: None
📝 WalkthroughWalkthrough이 PR은 Sentry 통계 처리를 재사용 가능한 유틸로 추출하고 통합한 리팩토링입니다. 코드 리뷰 코칭🎯 강점
🤔 리뷰 포인트1.
|
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | PR 제목은 코드 리뷰 반영 및 테스트 페이지 정리라는 실제 변경 내용을 요약하고 있으나, 구체적 변경의 핵심(유틸 분리, 슬롯 생성 로직 리팩토링, 테스트 페이지 통합)이 명확하지 않습니다. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
#30-feat-error-dashboard
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/sentry-test/page.tsx`:
- Around line 20-25: The onClick handler currently calls captureError(...) then
immediately shows alert, which can mislead because captureError is asynchronous;
change the onClick function to async, call captureError(new Error(...), { page:
"sentry-test" }), then await Sentry.flush(2000) (or an appropriate timeout)
before showing the success alert, or alternatively change the alert text to "전송
요청 완료" if you prefer not to await; update the onClick handler in
app/sentry-test/page.tsx accordingly (references: onClick handler, captureError,
Sentry.flush).
- Around line 44-47: The Sentry test button leaks a persistent user because you
call setSentryUser(...) globally and then immediately show a success alert;
instead isolate the test user to a single capture by using
Sentry.withScope(scope => { scope.setUser(...); captureError(...) }) or clear it
after capture with Sentry.setUser(null), and update the alert text to reflect
that the error was only "sent/requested" (e.g., "전송 요청 완료") or, if you need a
guaranteed delivery, await Sentry.flush(timeout) before notifying; modify the
handler around setSentryUser, captureError/captureMessage, and alert accordingly
(or add a one-shot helper in shared/lib/sentry.ts).
In `@src/entities/error/model/errorStatsUtils.ts`:
- Around line 16-39: The buildDailySlots function is matching timestamps using
server-local Date methods, causing bucket misalignment across time zones/DST;
update buildDailySlots to use a single canonical timezone (UTC) via dayjs with
the UTC plugin (and move logic into the shared date util), compute slot
boundaries and match allStats timestamps consistently in UTC, and also adjust
buildEmptyBreakdown to use the same shared date util so both generation and
matching use the same UTC bucket boundaries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2dcc8b4e-e564-4558-8004-0130b3c8bb46
📒 Files selected for processing (5)
app/api/sentry/issues/[id]/stats/route.tsapp/sentry-test/page.tsxsrc/entities/error/model/errorStatsUtils.tssrc/views/sentry/ErrorDetailView.tsxsrc/views/sentry/page.tsx
💤 Files with no reviewable changes (1)
- src/views/sentry/page.tsx
🛠️ 설명 (Description)
이전 PR 코드 리뷰에서 반영하지 못했던 유틸 분리 및 테스트 페이지 정리를 진행했습니다.
📝 변경 사항 요약 (Summary)
errorStatsUtils.ts:buildDailySlots,formatIssueSummary유틸 함수 분리stats/route.ts: 24슬롯 생성 로직을buildDailySlots유틸로 리팩토링ErrorDetailView.tsx: 시간/횟수 포맷팅을formatIssueSummary유틸로 리팩토링sentry-test/page.tsx: 에러 전송 테스트 버튼만 남기고 API 조회 UI 제거views/sentry/page.tsx: 불필요 파일 삭제💁 변경 사항 이유 (Why)
/dashboard/errors) 완성으로 sentry-test 페이지의 API 조회 기능 불필요✅ 테스트 계획 (Test Plan)
/dashboard/errors에러 목록 정상 렌더링 확인/dashboard/errors/{id}상세 페이지에서formatIssueSummary정상 표시 확인/sentry-test에러 전송 버튼 정상 동작 확인pnpm run type-check통과 확인🔗 관련 이슈 (Related Issues)
☑️ 체크리스트 (Checklist)
Summary by CodeRabbit
릴리스 노트
Refactor
New Features