Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 2
Please check the settings in the CodeRabbit UI or the
|
hodoon
reviewed
Oct 21, 2026
hodoon
left a comment
Collaborator
There was a problem hiding this comment.
리뷰했습니다. 인라인 코멘트 확인 부탁드립니다.
…ock_timeout 문장을 상수화
ysw789
force-pushed
the
fix/alt-297-qa-followup
branch
from
October 28, 2026 10:38
5230a96 to
bf154a3
Compare
ysw789
marked this pull request as ready for review
October 28, 2026 10:39
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
업장 등록 신청을 취소하는 요청과 관리자가 승인·반려하는 요청이 동시에 들어오면, 두 요청이 모두 PENDING을 읽고 각자 저장해서 "취소됐는데 업장이 만들어진" 상태가 남을 수 있었습니다. 또 이미 취소된 신청을 관리자가 승인하면 ACTIVATED로 되살아나 업장이 만들어졌고, 반려하면 REVOKED로 바뀌었습니다.
이제 취소·승인·반려 모두 신청 행을 잠근 뒤 최신 상태로 검사하므로 한 번에 하나씩 처리됩니다. 취소된 신청은 승인도 반려도 할 수 없고 409를 돌려줍니다. API 경로와 요청·응답 필드는 바뀌지 않았고, 새 ErrorCode와 DB 마이그레이션은 없습니다.
변경 내용
PATCH /app/workspace-requests/{workspaceRequestId}/cancel,PATCH /manager/workspace-requests/{workspaceRequestId}/cancel(CancelWorkspaceRequest)findByIdAndUserIdWithPessimisticLock). 전에는findByIdWithUser로 조회한 뒤 UseCase에서 소유자를 비교했습니다.등록 신청한 업장을 찾을 수 없습니다.입니다.취소할 수 없는 상태입니다.를 돌려줍니다.요청이 너무 많습니다. 잠시 후 다시 시도해주세요.를 돌려줍니다(신규).PATCH /admin/workspace-requests/{workspaceRequestId}/status(UpdateWorkspaceRequestStatus)findByIdWithPessimisticLock으로 잠가서 조회합니다. 잠금 대기 방식은 취소 API와 같습니다.WorkspaceRequest#approve,#reject에 CANCELLED 검사 추가).취소된 요청은 승인할 수 없습니다.취소된 요청은 반려할 수 없습니다.이미 승인된 요청입니다.이미 승인된 요청입니다.User행도 잠그고(UserQueryRepository#lockByIdWithPessimisticLock), 그 뒤에 ManagerUser를 찾거나 만듭니다.manager_users.user_id에 유니크 제약이 없어서, 같은 사용자의 서로 다른 신청 두 건을 동시에 승인하면 ManagerUser가 두 개 생길 수 있었기 때문입니다. 이제 두 번째 승인은 첫 번째가 끝날 때까지 기다렸다가 이미 만들어진 ManagerUser를 다시 씁니다. 반려는 User 행을 잠그지 않습니다.ACTIVATED 또는 REVOKED 만 설정 가능합니다., 404 B019해당 업장 등록 신청을 찾을 수 없습니다.)은 기존과 같습니다.잠금
WorkspaceRequestQueryRepository에 행 잠금 조회 두 개를 추가했습니다. QueryDSLPESSIMISTIC_WRITE를 씁니다.findByIdWithPessimisticLock(workspaceRequestId)— 관리자 승인·반려findByIdAndUserIdWithPessimisticLock(workspaceRequestId, userId)— 신청 취소SET LOCAL lock_timeout = '5s'를 실행합니다(LOCK_TIMEOUT_STATEMENT상수).SET LOCAL은 트랜잭션 전체에 적용되므로, 승인 중 이어지는 User 행 잠금 대기도 5초로 제한됩니다.GlobalExceptionHandler가PessimisticLockingFailureException을 429 E001로 바꿉니다. 트랜잭션은 롤백되므로 아무것도 바뀌지 않습니다.Swagger
AdminWorkspaceRequestControllerSpec상태 변경: 409(취소된 요청의 승인·반려, 이미 승인된 요청의 재처리)와 429 설명을 추가했습니다. 관리자 신청 상세 조회GET /admin/workspace-requests/{workspaceRequestId}는 200/404 그대로입니다.UserWorkspaceRequestControllerSpec,ManagerWorkspaceRequestControllerSpec신청 취소: 429 설명을 추가했습니다.프론트 영향
message를 그대로 보여 주면 됩니다.테스트
WorkspaceRequestTests(엔티티) — CANCELLED 승인·반려 시 409와 상태 유지, REVOKED 재반려 시 상태 유지, 기존 취소·승인 상태 검사CancelWorkspaceRequestTests— 소유자 조건을 포함한 잠금 조회 사용, 남의 신청이면 잠금 조회 결과가 비어 NOT_FOUND이고 취소하지 않음UpdateWorkspaceRequestStatusTests— 잠금 조회 사용, 승인은 User 행을 잠근 뒤에 ManagerUser를 조회·생성(호출 순서 검증), 반려는 User 행을 잠그지 않음WorkspaceRequestConcurrencyTests)와 base 브랜치에 있던 H2 승인 통합 테스트(WorkspaceRequestApprovalIntegrationTests,DataJpaTest)를 삭제했습니다.4d675ee6에서./gradlew test --rerun전체 680건 통과(실패·오류·skip 0).리뷰 반영 전 기준(head
7612c0a)으로는 실제 PostgreSQL과 로컬 서버에서 아래를 확인했습니다.이후 바뀐 세 가지(취소된 신청의 반려 차단, 승인 시 User 행 잠금, 취소 잠금 조회의 소유자 조건)는 단위 테스트로만 확인했습니다. 실제 DB 동시 요청과 HTTP 측정은 다시 하지 않았습니다.
남긴 것
manager_users.user_id유니크 제약은 추가하지 않았습니다. 이번에는 승인 경로에서 User 행 잠금으로만 중복 생성을 막습니다. 제약을 넣으려면 기존 중복 데이터 확인과 마이그레이션이 필요해 범위에서 뺐습니다.TOO_MANY_REQUESTS(429 E001)를 재사용했습니다. 문구가 "요청이 너무 많습니다"라 상황과 딱 맞지는 않지만, 새 ErrorCode를 만들지 않는 팀 규칙을 따랐습니다.병합 순서
fix/alt-297-qa-followup은 PR fix: [alt-297] 업장 신청·승인 연락처 정규화 및 기존 신청 호환 #108(fix/alt-297→dev)의 앞부분 커밋(bf154a30까지)입니다. PR #108을 먼저 머지한 뒤 이 PR을 머지해 주세요.WorkspaceRequestApprovalIntegrationTests를 삭제합니다. 같은 파일을 양쪽에서 지우는 것이라 충돌은 나지 않습니다.UpdateWorkspaceRequestStatusTests의 테스트를ExecuteTests안으로 옮겼고, 이 PR은 같은 파일에 잠금 검증을 넣었습니다.dev위로 올릴 때 이 파일의 충돌을 정리해야 합니다.dev로 바꾸고fix/alt-297-qa-followup이후 커밋만dev위로 rebase해야 합니다.관련 문서