Refactor: 생성 로직 보상트랜잭션 도입 및 서비스 분리#180
Merged
Merged
Conversation
…드 추가(forSaveContent)
Refactor: 문서 생성 보상트랜잭션 도입 / 명령-조회 서비스 책임분리 / 외 잔잔한 코드수정
Collaborator
|
안녕하세요 문성님, 리뷰는 진행이 모두 끝나고 하면 될까요? |
Collaborator
Author
전체 작업이 끝난 뒤에 한 번에 PR을 올리면 변경 범위가 커져서 파악이 어려울 것 같아, 미리 올려두었습니다. 리뷰는 편하실 때 언제든지 진행해주셔도 괜찮습니다! |
Chore: 인증서 갱신 스크립트 및 구조 변경
- CommitServiceMockTest에 merge 동일 브랜치(COMMIT_BAD_REQUEST) 검증 케이스 추가 - CommitServiceMockTest에 merge 권한 검증(base/target 중 하나 실패) 케이스 추가 - CommitService 의존성 변경에 맞춰 GetCommitMockTest를 CommitQueryService 기준으로 보정 - DocCreateOrchestrator 의존성 변경에 맞춰 DocCreateOrchestratorTest를 SaveService 기준으로 보정
…ave, createSaveContent
- createBranchOrSave 흐름을 BranchCreateOrchestrator + Mongo/MySQL TxService로 분리 - BranchQueryService를 도입해 branch repository 접근/검증 로직을 이관 - BranchService는 검증/흐름 조립 중심으로 정리 - Doc/Commit 경로의 branch 조회·검증 호출을 BranchQueryService로 전환
- CommitService 의존성 변경(BranchService -> BranchQueryService)에 맞춰 mock/verify 호출부 정리 - create/merge 검증 테스트의 branch 권한 체크 대상 동기화
- createNewBranch 분기를 도입해 leaf 상태에서도 새 브랜치 생성 의도를 반영 - save가 있는 브랜치에서 새 브랜치 생성 시 기존 브랜치 save 추가로 잘못 분기되던 문제를 수정 - 새 브랜치 생성 경로에서 브랜치 이름 중복 검증을 수행하도록 보정 - 같은 브랜치 이어서작업 시 기존 save 재사용으로 saves(branch_id) 중복 insert 방지 - BranchCreateRequest.fromCommitId를 @NotNull 검증
- leaf + 동일 브랜치명 재요청 시 기존 save 재사용 검증 추가 - leaf + 다른 브랜치명에서 이름 중복이면 BRANCH_NAME_DUPLICATED 검증 추가 - fromBranch에 save가 있어도 새 브랜치 생성 경로가 정상 동작하는지 검증 추가 - BranchService 리팩토링 의존성(BranchQueryService, BranchCreateOrchestrator)에 맞춰 BranchServiceTest 수정
…하던 오류 -> BRANCH_NAME_DUPLICATED예외 처리
- BranchCreateOrSaveIntegrationTest 추가 - leafCommit=rootCommit + save 존재 + 같은 이름 요청 시 BRANCH_NAME_DUPLICATED 검증 - leafCommit=rootCommit + save 존재 + 다른 이름 요청 시 새 브랜치/새 save 생성 검증 - leafCommit=rootCommit + save 없음 + 같은 이름 요청 시 기존 브랜치에 save 생성 검증 - 새 브랜치 생성 경로에서 이름 중복 시 BRANCH_NAME_DUPLICATED 검증 - BranchServiceTest를 현재 분기 로직에 수정
- SaveService의 저장소 직접 의존 제거 - Doc/Branch/Commit MySQL Tx 서비스의 SaveService 의존을 SaveQueryService로 변경 - SaveErrorCode.FAIL_TO_SAVE 추가 및 updateSave Mongo 저장 실패 매핑 정리
- BranchQueryService 의존성 변경에 따른 테스트 변경 - GraphBranchDto 네이밍 변경 -> BranchGraphDto
- CommitQueryService#getCommitGraphList 추가 - CommitRepository#findCommitsByDocId -> getCommitGraphList 네이밍 정리 - DocService 그래프 조회에서 CommitQueryService 경유로 전환 - EdgeRepository projection DTO 경로(EdgeDto) 반영
- BranchServiceTest를 EdgeService 의존 기준으로 수정
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.
🛰️ Issue Number
🪐 작업 내용
변경 내용
생성 로직에 보상트랜잭션 도입
Doc의 예
Command / Query 책임 분리
이어서 작업하기 버그 수정
새 브랜치 생성 시점에 이름 중복이 DB까지 가서 DataIntegrityViolationException로 터질 수 있었음.
createNewBranch == true 경로에서 먼저 checkDuplicatedWithBranchName 수행해서 BRANCH_NAME_DUPLICATED로 처리.
기존로직은 isLeaf == true면 요청 이름과 무관하게 기존 브랜치 save 생성 경로로 감 -> save있는데 save또 생성하려해서 saves.branch_id 유니크 제약 위반(500) 발생
(펑)
(펑)
(안터져용~)
createNewBranch = !isLeaf || !sameName || (isLeaf && isRoot && hasSave)로 분기.변경 초기에는
(isLeaf && isRoot && hasSave)는 없었으나 Leaf이면서 Root이면서 Save가 있으면서 이름이 같으면 createNewBranch가 false가 되어 이름중복 예외가 터지지않고 DataIntegrityViolationException가 또 터져서 조건을 늘렸습니다.(너무 복잡 간략화 필요)그 외
테스트
참고사항
📚 Reference
✅ Check List