[Deploy] develop → main 배포 반영 - #343
Conversation
📝 WalkthroughWalkthrough워크스페이스 역할 동기화가 보강되고, integrations 메뉴와 라우트에 ADMIN 권한 검사가 적용되었습니다. 토큰 재발급 응답 및 로그아웃 시 인증 상태 초기화 처리도 변경되었습니다. ChangesRBAC 및 인증 흐름
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 이동
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (2)
.env.productionis excluded by none and included by none.github/workflows/ci.yamlis excluded by none and included by none
📒 Files selected for processing (8)
src/components/sidebar/Sidebar.tsxsrc/constants/sidebarNav.tssrc/hooks/auth/useTokenRefresh.tssrc/layout/main/MainLayout.tsxsrc/lib/axiosInstance.tssrc/routes/MainRoutes.tsxsrc/routes/RoleGuard.tsxsrc/store/useAuthStore.ts
🚨 관련 이슈
N/A
✨ 변경사항
✏️ 작업 내용
.env.production의VITE_API_BASE_URL=/값이 Vite 빌드 시 CI 주입 값보다 우선 적용되어, API 요청이 SPA fallback(index.html)으로 응답받으며 인증이 조용히 실패.env.production삭제,ci.yaml에서 환경변수 직접 주입isTokenInitialized초기화 누락 수정useTokenRefreshoptional chaining 및 axios 재발급 실패 시 명시적 throw로 에러 처리 보완😅 미완성 작업
N/A
📢 논의 사항 및 참고 사항
N/A
Summary by CodeRabbit
새로운 기능
버그 수정