Repository navigation
fix: 지운 커스텀 문구 슬롯 키 재사용 시 복구 - #519
Conversation
판매자 앱 상품 관리 구현 중 발견. sellerDeleteProductCustomTextToken으로 슬롯을 지운 뒤 같은 tokenKey로 sellerUpsertProductCustomTextToken(tokenId 생략)을 부르면 soft-delete 행이 uk_product_custom_text_token(template_id, token_key)에 걸려 P2002 → 500. - repository upsertCustomTextToken 등록 경로: 같은 (template, tokenKey)의 삭제 슬롯이 있으면 그 행(같은 id)을 복구하며 입력값으로 갱신, 없으면 생성. 관리자 createOrRestoreTag·카테고리와 같은 방식. - 등록 경로는 템플릿 행을 FOR UPDATE로 잠가 같은 템플릿의 슬롯 생성을 직렬화. 잠금 없이는 같은 삭제 슬롯을 동시에 복구한 2건이 모두 성공한다(반증 확인). - unique 충돌(활성 키 중복·경쟁, 수정으로 삭제 슬롯 키로 변경)은 CUSTOM_TEXT_TOKEN_KEY_TAKEN(409)로 좁힘. 수정 경로를 삭제 키로 바꾸는 경우 오류로 두는 것은 관리자 태그·카테고리 이름 변경과 같은 정책. - 에러 카탈로그에 CUSTOM_TEXT_TOKEN_KEY_TAKEN 추가(파라미터 없는 고정 메시지라 RENDER_PARAMS 불요). - SDL은 sellerUpsertProductCustomTextToken description에 복구·충돌 동작만 추가. - 감사 로그는 기존 그대로 등록 경로 CREATE(복구도 CREATE, tokenId는 복구된 id). - 회귀 테스트 7건(real DB): 삭제 후 같은 키 재등록 → 같은 id 복구·필드 갱신·감사 / 활성 키 중복 → 409·무변경 / 수정으로 활성·삭제 키로 변경 → 409(2) / 다른 템플릿의 같은 키 무관 / 동시 등록 2건(새 키·삭제 키) → 1 성공 1 409(2). 복구 분기를 지우면 첫 케이스가 409로 실패(반증 확인).
판매자 앱이 슬롯 좌표를 베이스 이미지 한 변을 10000으로 본 정수 비율로 저장한다 (SCALE = 10_000, x·y는 왼쪽 위 모서리, 가로·세로 모두 같은 한 변 기준). SDL description에 이 계약이 없어 클라이언트마다 단위를 추측해야 했음. - SellerCustomTextToken·SellerUpsertProductCustomTextTokenInput의 posX·posY·width·height description에 기준(왼쪽 위 모서리, 한 변 10000)과 범위(위치 0~10000, 크기 1~10000)를 명시. width·height는 기존 @min(1) 검증이 있어 1부터로 적음. - 서버는 범위를 검사하지 않는다는 점을 posX에 함께 적음. 범위 검증 추가는 이번 범위 밖. - 코드·DTO 변경 없음.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
🧹 knip — dead-code 리포트전체 리포트
|
🩺 NestJS Doctor — 90/100 (Excellent)진단 484건 (error 12).
architecture / security 상위 항목
|
Coverage report
Show files with reduced coverage 🔻
Test suite run success4244 tests passing in 383 suites. Report generated by 🧪jest coverage report action from b371546 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
요약
tokenKey로 슬롯을 다시 등록하면 500이 나던 버그를 고칩니다. 판매자 앱 상품 관리 구현 중 발견했습니다.sellerDeleteProductCustomTextToken→ 같은 키로sellerUpsertProductCustomTextToken(tokenId 생략)uk_product_custom_text_token(template_id, token_key)를 계속 점유해 P2002createOrRestoreTag·카테고리 복구와 같은 방식입니다.CREATE이며, 복구된 경우afterJson.tokenId가 복구된 id입니다.FOR UPDATE로 잠가 같은 템플릿의 슬롯 생성을 직렬화합니다.CUSTOM_TEXT_TOKEN_KEY_TAKEN(409)로 좁힙니다.error-catalog.spec의RENDER_PARAMS에는 추가하지 않았습니다(파라미터 메시지 전용 표).sellerUpsertProductCustomTextToken에 복구·충돌 동작SellerCustomTextToken·SellerUpsertProductCustomTextTokenInput의posX·posY·width·height에 좌표 계약SCALE = 10_000)을 그대로 적었습니다.posX·posY는 문구 영역 왼쪽 위 모서리10000, 크기 110000(width·height는 기존@Min(1)검증이 있어 1부터)posX에 함께 적었고, 범위 검증 추가는 이번 범위 밖입니다.FE 영향
CUSTOM_TEXT_TOKEN_KEY_TAKEN이 됩니다.테스트
product-seller-custom-template.service.spec(real DB)에 회귀 7건을 추가했습니다.CREATE2건 모두 같은 tokenIdCUSTOM_TEXT_TOKEN_KEY_TAKEN, 기존 행 무변경, 감사 0건CUSTOM_TEXT_TOKEN_KEY_TAKEN(it.each2건)it.each2건): 1건 성공·1건CUSTOM_TEXT_TOKEN_KEY_TAKEN, 활성 행 1개, 감사CREATE1건CUSTOM_TEXT_TOKEN_KEY_TAKEN으로 실패합니다(동시 등록의 삭제 키 케이스도 함께 실패).tsc --noEmit·변경 파일 eslint·prettier·yarn docs:check·yarn dto:check·yarn arch:check가 통과했고,yarn graphql:codegen을 다시 돌렸습니다.플랜 대조