Skip to content

[Deploy] develop → main 배포 반영 - #343

Merged
Seojegyeong merged 6 commits into
mainfrom
develop
Jul 29, 2026
Merged

Seojegyeong merged 6 commits into
mainfrom
develop

Conversation

@Seojegyeong

@Seojegyeong Seojegyeong commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

🚨 관련 이슈

N/A

✨ 변경사항

  • 🐞 BugFix Something isn't working
  • 💻 CrossBrowsing Browser compatibility
  • 🌏 Deploy Deploy
  • 🎨 Design Markup & styling
  • 📃 Docs Documentation writing and editing (README.md, etc.)
  • ✨ Feature Feature
  • 🔨 Refactor Code refactoring
  • ⚙️ Setting Development environment setup
  • ✅ Test Test related (storybook, jest, etc.)

✏️ 작업 내용

  • 플랫폼 연동(Google/Naver/Meta) 메뉴·라우트를 ADMIN 권한 전용으로 제한, RoleGuard에서 선택 워크스페이스 초기화 전 fallback 역할 판정 로직 제거
  • 배포 환경 로그인 불가 버그 수정 — 원인: .env.productionVITE_API_BASE_URL=/ 값이 Vite 빌드 시 CI 주입 값보다 우선 적용되어, API 요청이 SPA fallback(index.html)으로 응답받으며 인증이 조용히 실패
    • .env.production 삭제, ci.yaml에서 환경변수 직접 주입
    • logout 시 isTokenInitialized 초기화 누락 수정
    • useTokenRefresh optional chaining 및 axios 재발급 실패 시 명시적 throw로 에러 처리 보완
  • CI 빌드 시 환경변수 주입 누락으로 발생한 Lighthouse NO_FCP 오류 수정

😅 미완성 작업

N/A

📢 논의 사항 및 참고 사항

N/A

💬 리뷰어 가이드 (P-Rules)
P1: 필수 반영 (Critical) - 버그 가능성, 컨벤션 위반. 해결 전 머지 불가.
P2: 적극 권장 (Recommended) - 더 나은 대안 제시. 가급적 반영 권장.
P3: 제안 (Suggestion) - 아이디어 공유. 반영 여부는 드라이버 자율.
P4: 단순 확인/칭찬 (Nit) - 사소한 오타, 칭찬 등 피드백.

Summary by CodeRabbit

  • 새로운 기능

    • 푸터 메뉴가 사용자 역할에 따라 표시되도록 개선했습니다.
    • 통합 관리 메뉴는 관리자만 이용할 수 있습니다.
    • 통합 관리 페이지 접근 시 관리자 권한을 확인합니다.
  • 버그 수정

    • 워크스페이스와 역할 정보가 더욱 정확하게 동기화됩니다.
    • 권한이 없는 페이지 접근을 대시보드로 안전하게 안내합니다.
    • 토큰 재발급 실패 및 로그아웃 처리의 안정성을 개선했습니다.

YermIm and others added 6 commits July 28, 2026 18:10
[Feature/#309] 플랫폼 연동 ADMIN 전용 접근 제어
- .env.production 삭제 — GitHub Secret 주입값이 무시되던 문제 해결
- useTokenRefresh: data?.accessToken optional chaining 추가
- useAuthStore: logout 시 isTokenInitialized 초기화
- axiosInstance: reissue 응답 accessToken null 체크 추가
[Bugfix/#341] 배포 환경 로그인 불가 수정 및 auth 방어 코드 보완
@Seojegyeong
Seojegyeong requested review from YermIm and jjjsun July 29, 2026 00:38
@Seojegyeong Seojegyeong self-assigned this Jul 29, 2026
@Seojegyeong Seojegyeong added 🐞 BugFix Something isn't working 🌏 Deploy 배포 관련 labels Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

워크스페이스 역할 동기화가 보강되고, integrations 메뉴와 라우트에 ADMIN 권한 검사가 적용되었습니다. 토큰 재발급 응답 및 로그아웃 시 인증 상태 초기화 처리도 변경되었습니다.

Changes

RBAC 및 인증 흐름

Layer / File(s) Summary
워크스페이스 역할 동기화
src/layout/main/MainLayout.tsx
선택된 조직의 워크스페이스 역할과 현재 myRole을 비교하고 불일치 시 스토어 값을 동기화합니다.
Integrations 라우트 권한 검사
src/routes/RoleGuard.tsx, src/routes/MainRoutes.tsx
워크스페이스 조회 결과와 선택된 조직을 기준으로 integrations 라우트의 ADMIN 접근을 제어합니다.
역할별 사이드바 메뉴
src/constants/sidebarNav.ts, src/components/sidebar/Sidebar.tsx
integrations 푸터 메뉴를 ADMIN 전용으로 지정하고 역할에 맞는 메뉴만 렌더링합니다.
토큰 재발급 및 로그아웃 상태 처리
src/hooks/auth/useTokenRefresh.ts, src/lib/axiosInstance.ts, src/store/useAuthStore.ts
토큰 응답 누락 시 재발급을 실패 처리하고 로그아웃 시 isTokenInitialized를 초기화합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant MainRoutes
  participant RoleGuard
  participant WorkspaceAPI
  participant AuthStore
  User->>MainRoutes: integrations 접근
  MainRoutes->>RoleGuard: ADMIN 권한 검사
  RoleGuard->>WorkspaceAPI: 워크스페이스 정보 조회
  RoleGuard->>AuthStore: selectedOrgId 확인
  RoleGuard-->>User: 페이지 표시 또는 /dashboard 이동
Loading

Possibly related PRs

Suggested labels: ✨ Feature

Suggested reviewers: jjjsun, yermim

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 배포 반영과 인증·권한 수정이 포함된 변경사항과 관련성이 높습니다.
Description check ✅ Passed 템플릿의 필수 섹션을 대부분 채웠고 변경사항, 작업 내용, 미완성, 논의 사항이 모두 포함됩니다.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

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

⚠️ Outside diff range comments (1)
src/hooks/auth/useTokenRefresh.ts (1)

22-29: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

액세스 토큰이 없는 응답을 재발급 실패로 처리해야 합니다.

data?.accessToken이 없을 때 setAccessToken만 건너뛰고 finally에서 setTokenInitialized()를 호출합니다. 이 경우 hasSession은 남아 있는데 토큰은 없는 상태가 되어, 인증 초기화가 성공한 것처럼 보일 수 있습니다. 토큰이 없으면 예외를 던져 logout() 경로로 보내거나 명시적으로 로그아웃 처리해 주세요.

수정 예시
-        if (data?.accessToken) {
-          setAccessToken(data.accessToken);
+        if (!data?.accessToken) {
+          throw new Error("토큰 재발급 실패");
         }
+        setAccessToken(data.accessToken);

As per path instructions, src/** 변경은 상태 관리와 API 실패 처리를 함께 검토해야 합니다.

🤖 Prompt for 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.

In `@src/hooks/auth/useTokenRefresh.ts` around lines 22 - 29, Update the token
refresh flow around the accessToken response check so a response without
data?.accessToken is treated as refresh failure: trigger the existing logout()
path, preferably by throwing from the missing-token branch so the catch handles
it. Preserve successful token storage and final initialization behavior for
responses containing a token.

Source: Path instructions

🤖 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 `@src/layout/main/MainLayout.tsx`:
- Around line 63-71: Update the selected-workspace synchronization block in
MainLayout so that when selectedOrgId is not found in workspaces, it falls back
to isCurrentWorkspace or workspaces[0], then updates both selectedOrgId and
myRole together. Preserve the existing role-only synchronization when the
current workspace remains valid, and avoid returning with a stale selection.

In `@src/routes/RoleGuard.tsx`:
- Around line 33-35: Update the pending-render guard in RoleGuard so routes with
a workspaceId depend only on workspaces loading and URL-based authorization, not
isSavedWorkspaceFetched. Apply the saved-workspace wait only when workspaceId is
absent and selectedOrgId is null, preserving the existing null-render behavior
for that initialization path.

In `@src/store/useAuthStore.ts`:
- Line 34: 로그아웃 후 재로그인 시 토큰 초기화 상태가 복구되지 않는 문제를 수정하세요. useAuthStore의 login 경로에서
토큰 초기화 완료 상태를 다시 설정하고, useTokenRefresh가 세션 변경에 따라 재실행되도록 initialized 상태의 생명주기를
logout/login 흐름과 일치시키세요.

---

Outside diff comments:
In `@src/hooks/auth/useTokenRefresh.ts`:
- Around line 22-29: Update the token refresh flow around the accessToken
response check so a response without data?.accessToken is treated as refresh
failure: trigger the existing logout() path, preferably by throwing from the
missing-token branch so the catch handles it. Preserve successful token storage
and final initialization behavior for responses containing a token.
🪄 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: 52b1c98a-17dd-4f80-812e-7258097455e1

📥 Commits

Reviewing files that changed from the base of the PR and between 2e27b56 and f9fee83.

⛔ Files ignored due to path filters (2)
  • .env.production is excluded by none and included by none
  • .github/workflows/ci.yaml is excluded by none and included by none
📒 Files selected for processing (8)
  • src/components/sidebar/Sidebar.tsx
  • src/constants/sidebarNav.ts
  • src/hooks/auth/useTokenRefresh.ts
  • src/layout/main/MainLayout.tsx
  • src/lib/axiosInstance.ts
  • src/routes/MainRoutes.tsx
  • src/routes/RoleGuard.tsx
  • src/store/useAuthStore.ts

Comment thread src/layout/main/MainLayout.tsx
Comment thread src/routes/RoleGuard.tsx
Comment thread src/store/useAuthStore.ts
@Seojegyeong
Seojegyeong merged commit a4daa24 into main Jul 29, 2026
3 checks passed
@Seojegyeong Seojegyeong changed the title [Deploy] develop → main 배포 반영- #340 [Deploy] develop → main 배포 반영 Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix Something isn't working 🌏 Deploy 배포 관련

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants