Skip to content

Chore(HK-175): console 메시지 및 불필요 에러 메시지 삭제#77

Open
juiuj wants to merge 1 commit intomainfrom
chore/HK-175-fe-remove-console-log
Open

Chore(HK-175): console 메시지 및 불필요 에러 메시지 삭제#77
juiuj wants to merge 1 commit intomainfrom
chore/HK-175-fe-remove-console-log

Conversation

@juiuj
Copy link
Copy Markdown
Member

@juiuj juiuj commented Dec 30, 2025

Motivation

Problem Solving

  • console.log메시지 삭제
  • 불필요 에러 메시지 삭제

To Reviewer

  • 에러 메시지 체크가 필요한 부분은 제외하고 삭제했습니다

Summary by CodeRabbit

릴리스 노트

  • Chores
    • 애플리케이션 내 불필요한 디버그 로깅을 제거했습니다. 모든 기능과 사용자 경험은 변경되지 않았으며, 코드 유지보수성을 개선했습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@juiuj juiuj requested review from Jsplix and soooheeee December 30, 2025 13:39
@juiuj juiuj self-assigned this Dec 30, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Walkthrough

이 변경사항은 전체 프로젝트의 8개 파일에서 디버그 목적의 console.log 및 console.error 문을 제거하는 작업입니다. 토큰 제거, API 응답 로깅, WebSocket 연결, 폼 제출, 복호화 작업, GitHub 인증, 약관 조회 등 다양한 기능 영역에서 로그 문을 제거했습니다. 모든 파일에서 핵심 비즈니스 로직, 에러 처리, 제어 흐름은 변경되지 않았으며, 공개 인터페이스나 함수 서명도 수정되지 않았습니다.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes


추가 피드백

긍정적인 측면

이 변경사항은 프로덕션 환경 최적화를 위한 좋은 실천입니다. 개발 단계에서 사용된 디버그 로그를 제거함으로써 다음과 같은 개선을 이룹니다:

  • 브라우저 콘솔 깔끔함: 사용자 관점에서 불필요한 로그 노이즈를 제거
  • 성능 미세 최적화: console 호출 오버헤드 제거

개선 제안사항

1. 구조화된 로깅 시스템 도입 검토

현재 방식은 로그를 단순히 제거하는 것이지만, 장기적으로는 환경 기반 로깅을 고려하는 것이 좋습니다:

// 권장 패턴
const isDev = process.env.NODE_ENV === 'development';

if (isDev) {
  console.log('디버그 정보:', data);
}

이렇게 하면 개발 환경에서는 디버그 정보를 유지하면서, 프로덕션에서는 자동으로 제거됩니다.

참고: Create React App - 환경 변수

2. 에러 로깅 전략 수립

여러 파일에서 console.error를 제거했는데, 특히 다음 영역의 에러는 추적이 필요할 수 있습니다:

  • API 호출 실패: 서버 통신 문제
  • 복호화 실패: 보안 관련 작업
  • WebSocket 연결: 실시간 통신 기반 기능

권장사항: 프로덕션 환경에서도 수집할 수 있는 에러 추적 서비스(예: Sentry, LogRocket)를 도입하여 사용자 환경에서의 에러를 모니터링하는 것을 검토하세요.

3. 코드 검토 자동화

이렇게 반복적인 변경을 방지하기 위해 ESLint 규칙을 활용하는 것을 권장합니다:

{
  "rules": {
    "no-console": ["warn", { "allow": ["warn", "error"] }]
  }
}

이렇게 설정하면 개발 중 실수로 추가된 console.log를 자동으로 감지할 수 있습니다.

참고: ESLint no-console 규칙

결론

이 PR은 프로덕션 준비 과정의 일부로 보이며, 기술적으로 건전합니다. 향후 더 체계적인 로깅 및 에러 추적 전략을 수립하면 코드 품질과 운영 효율성을 더욱 향상시킬 수 있을 것입니다.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
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.
✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/dashboard/cards/keychain-card/index.tsx (2)

18-31: P2: 에러 발생 시 사용자 피드백이 필요합니다

복호화 실패 시 에러를 조용히 무시하고 있어, 사용자는 왜 키체인 내용이 표시되지 않는지 알 수 없습니다.

문제점:

  • 에러가 발생해도 사용자에게 아무런 안내가 없음
  • 빈 content로 modal이 표시되어 혼란 초래
  • 디버깅이 매우 어려워짐

해결방법:

useEffect(() => {
  const fetchDecryptedValue = async () => {
    try {
      const response = await getKeychainDecrypt(id);
      setDecryptedContent(response.content);
    } catch (error) {
      alert('키체인 정보를 불러오는데 실패했습니다.');
      setIsModalOpen(false); // 모달 닫기
    }
  };

  if (isModalOpen) {
    fetchDecryptedValue();
  }
}, [isModalOpen, id]);

33-41: P2: handleOpen에도 에러 피드백이 필요합니다

마찬가지로 handleOpen에서도 에러가 조용히 무시됩니다.

해결방법:

const handleOpen = async () => {
  try {
    const response = await getKeychainDecrypt(id);
    setDecryptedContent(response.content);
    setIsModalOpen(true);
  } catch (err) {
    alert('키체인 정보를 불러올 수 없습니다. 다시 시도해주세요.');
  }
};

참고:

🧹 Nitpick comments (4)
src/api/socket/index.tsx (1)

10-13: P3: WebSocket 로그 제거의 일관성 검토가 필요합니다

onopen 핸들러에서만 console.log를 제거했지만, 동일 클래스 내 다른 핸들러들(Line 20의 console.error, Line 24의 console.log, Line 32의 console.warn)은 여전히 남아있습니다.

문제점:

  • 로그 제거 정책이 불일치하여 코드 일관성이 떨어집니다
  • WebSocket 연결 상태 추적이 부분적으로만 가능합니다

제안:

  1. 프로덕션에서 필요한 로그라면 커스텀 로거나 에러 트래킹 서비스(Sentry 등) 사용 고려
  2. 모두 제거할 것이라면 일관되게 처리
  3. 또는 onError 핸들러만 유지하고 나머지 제거
// Option 1: 에러만 남기고 나머지 제거
this.socket.onopen = () => {
  this.openHandler?.();
};

this.socket.onerror = (error) => {
  console.error('[WebSocket] Error:', error);
};

this.socket.onclose = () => {
  // 로그 제거
};

참고자료:

src/pages/sign-in/sign-in-github/index.tsx (1)

15-38: P3: useEffect 의존성 배열에 login 함수 추가를 권장합니다

현재 의존성 배열에 login 함수가 누락되어 있습니다.

문제점:

  • React Hook의 exhaustive-deps 규칙 위반
  • AuthContext가 재생성될 경우 stale closure 발생 가능성

해결방법:

useEffect(() => {
  const fetchGithubAuth = async () => {
    // ... 기존 코드
  };

  fetchGithubAuth();
}, [code, navigate, login]); // login 추가

또는 AuthContext가 안정적이라면 ESLint 주석으로 명시:

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [code, navigate]);

참고자료:

src/components/dashboard/button/saveButton/index.tsx (1)

37-55: P4: 에러 추적을 위한 로깅 전략 고려를 권장합니다

console.error 제거로 인해 에러 추적이 어려워질 수 있습니다. 사용자에게는 alert로 피드백을 주고 있지만, 개발/디버깅 시에는 상세 에러 정보가 필요합니다.

개선 제안:
환경변수를 활용한 조건부 로깅:

} catch (error) {
  if (process.env.NODE_ENV === 'development') {
    console.error('Keychain save error:', error);
  }
  alert(error instanceof Error ? error.message : '데이터 저장에 실패했습니다.');
}

또는 에러 모니터링 서비스 도입:

import * as Sentry from '@sentry/react';

} catch (error) {
  Sentry.captureException(error);
  alert(error instanceof Error ? error.message : '데이터 저장에 실패했습니다.');
}
src/components/dashboard/modals/keychain-read-modal/index.tsx (1)

28-53: P3: 에러 로깅의 일관성을 검토해주세요

Line 32에서는 console.error를 제거했지만, Line 48에서는 여전히 유지하고 있어 일관성이 떨어집니다.

현재 상황:

  • Line 32: id가 없으면 조용히 return (에러 로깅 없음)
  • Line 48: 복호화 실패 시 console.error 유지

제안:

  1. Line 32는 정상적인 early return이 아닌 예외 상황이므로, 개발 환경에서는 로깅하는 것이 좋습니다:
if (!id) {
  if (process.env.NODE_ENV === 'development') {
    console.warn('KeychainReadModal: id가 없어 복호화를 건너뜁니다.');
  }
  return;
}
  1. 또는 두 곳 모두 같은 정책 적용 (둘 다 제거 또는 둘 다 유지)

참고:
PR 목표에 "에러 메시지 체크가 필요한 부분은 삭제에서 제외"라고 명시되어 있으므로, Line 48의 console.error는 유지하는 것이 맞습니다.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c48beb3 and f9b4829.

📒 Files selected for processing (10)
  • src/api/context/auth-util/index.tsx
  • src/api/send-code/index.tsx
  • src/api/socket/index.tsx
  • src/components/dashboard/button/saveButton/index.tsx
  • src/components/dashboard/cards/keychain-card/index.tsx
  • src/components/dashboard/modals/keychain-read-modal/index.tsx
  • src/index.tsx
  • src/pages/sign-in/content/index.tsx
  • src/pages/sign-in/sign-in-github/index.tsx
  • src/pages/sign-up/content/terms/content/index.tsx
💤 Files with no reviewable changes (4)
  • src/pages/sign-up/content/terms/content/index.tsx
  • src/index.tsx
  • src/api/context/auth-util/index.tsx
  • src/pages/sign-in/content/index.tsx
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

src/**/*.{ts,tsx}: 1. 코드에서의 오타, 불필요한 로직, 중복 코드, 서비스/도메인 설계, 예외 처리를 확인해주세요. 2. 많은 양의 코드리뷰는 피로감을 줄 수 있으므로 꼭 필요한 부분에만 집중해주고, 나머지는 캡션으로 설명해주세요. 3. Pn룰을 사용합니다. 모든 코멘트에는 Pn:을 붙여주세요. 중요도에 따라 숫자를 반영해주세요. (P1: 꼭 반영해주세요 (Request changes) / P2: 적극적으로 고려해주세요 (Request changes) / P3: 웬만하면 반영해 주세요 (Comment) / P4: 반영해도 좋고 넘어가도 좋습니다 (Approve) / P5: 그냥 사소한 의견입니다 (Approve)) 4. 코드에 대한 리뷰를 남길 때는 해당 라인 범위에 코멘트를 작성해주세요. 5. 리뷰 포인트별로 문제점, 대안, 장단점을 논리적이고 명확하게 제시하고 경우에 따라 단순하지만 효율적인 예시 코드도 추가해주세요. 6. 타입, 컴포넌트, 클래스명은 PascalCase로 작성합니다. 7. 멤버, 함수명은 camelCase로 작성합니다. 8. React + TypeScript 코드의 경우, 불필요한 리렌더링, 훅 의존성 배열, 과도한 any 사용 여부도 함께 확인해주세요.

Files:

  • src/api/socket/index.tsx
  • src/components/dashboard/modals/keychain-read-modal/index.tsx
  • src/components/dashboard/cards/keychain-card/index.tsx
  • src/api/send-code/index.tsx
  • src/pages/sign-in/sign-in-github/index.tsx
  • src/components/dashboard/button/saveButton/index.tsx
src/components/**/*.{jsx,tsx}

📄 CodeRabbit inference engine (README.md)

Store reusable UI components (buttons, input fields, cards, etc.) in the components directory

Files:

  • src/components/dashboard/modals/keychain-read-modal/index.tsx
  • src/components/dashboard/cards/keychain-card/index.tsx
  • src/components/dashboard/button/saveButton/index.tsx
src/pages/**/*.{jsx,tsx}

📄 CodeRabbit inference engine (README.md)

Store routable page components (homepage, login page, profile page, etc.) in the pages directory as top-level components for each route

Files:

  • src/pages/sign-in/sign-in-github/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: AWS Amplify Console Web Preview
🔇 Additional comments (2)
src/pages/sign-in/sign-in-github/index.tsx (1)

12-13: P5: OAuth code 로그 제거는 적절한 조치입니다

민감한 OAuth code를 콘솔에 출력하는 것은 보안상 좋지 않으므로, 이를 제거한 것은 올바른 판단입니다.

Line 32의 console.error는 실제 에러 추적을 위해 유지하는 것이 합리적입니다.

src/api/send-code/index.tsx (1)

14-33: P5: console.log 제거가 적절합니다

불필요한 응답 로깅을 제거하고 사용자에게는 alert로 충분한 피드백을 제공하고 있습니다. 에러 핸들링도 적절하게 유지되고 있습니다.

Copy link
Copy Markdown
Contributor

@Jsplix Jsplix left a comment

Choose a reason for hiding this comment

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

확인했습니다! 👍

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.

2 participants