Skip to content

[Fix] 긴급신고 권장 체크 박스 수정 오류#48

Merged
yeonju73 merged 1 commit intomainfrom
fix/#47/report-records-update-error
Aug 5, 2025
Merged

[Fix] 긴급신고 권장 체크 박스 수정 오류#48
yeonju73 merged 1 commit intomainfrom
fix/#47/report-records-update-error

Conversation

@yeonju73
Copy link
Copy Markdown
Contributor

@yeonju73 yeonju73 commented Aug 5, 2025

💻 Related Issue

closed #47

🚀 Work Description

스크린샷 2025-08-05 14 49 35
  • 신고 현황 수정 api 오류 수정: 완료된 step에서 수정 불가한 항목은 필수 조치 체크박스만 해당

🙇🏻‍♀️ To Reviewer

  • 체크박스 수정 관련 신고 현황 수정 api 오류 수정했습니다
  • error code 메시지 수정했습니다!

Summary by CodeRabbit

  • 버그 수정

    • 완료된 단계의 필수 체크박스 상태가 변경되지 않은 경우에만 수정이 허용되도록 검증 로직이 개선되었습니다.
  • 스타일

    • 완료된 단계의 체크박스 관련 에러 메시지가 보다 명확하게 수정되었습니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 5, 2025

Walkthrough

신고 현황 단계의 체크박스 검증 로직이 변경되었습니다. 완료된 단계의 경우, 필수 체크박스는 상태가 동일할 때만 수정이 허용되고, 권장 체크박스는 수정이 가능하도록 검증 방식이 개선되었습니다. 또한, 체크박스 조회 메서드가 일반화되어 코드가 정리되었습니다.

Changes

Cohort / File(s) Change Summary
신고 단계 검증 및 체크박스 로직 개선
src/main/java/com/blockguard/server/domain/report/application/ReportRecordService.java
- validateProgressIsCompleted 메서드가 요청 객체와 진행 객체를 모두 받아 검증하도록 변경
- 완료 단계에서 필수 체크박스만 상태가 동일할 때 수정 허용
- 권장 체크박스는 수정 가능
- getRequiredCheckboxes 메서드를 getCheckboxes로 이름 변경 및 일반화
- 관련 주석 추가 및 호출부 반영
에러 메시지 수정
src/main/java/com/blockguard/server/global/common/codes/ErrorCode.java
- REPORT_STEP_ALREADY_COMPLETED의 한글 에러 메시지 변경(권장 → 필수 체크박스로 명확화)

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ReportRecordService
    participant ErrorCode

    Client->>ReportRecordService: UpdateReportStepRequest 전송
    ReportRecordService->>ReportRecordService: validateProgressIsCompleted(request, progress)
    alt 완료된 단계
        alt 필수 체크박스 상태 변경 시도
            ReportRecordService->>ErrorCode: REPORT_STEP_ALREADY_COMPLETED 예외 발생
        else 상태 동일
            ReportRecordService-->>Client: 정상 처리
        end
    else 미완료 단계 또는 권장 체크박스 변경
        ReportRecordService-->>Client: 정상 처리
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Assessment against linked issues

Objective Addressed Explanation
신고 현황 수정 api: 완료된 step 권장 체크 박스 수정 가능하게 변경 (#47)

Assessment against linked issues: Out-of-scope changes

(해당 사항 없음)

Possibly related PRs

  • [Feat] 긴급대응 API #40: 기존에 도입된 ReportRecordService의 검증 및 체크박스 처리 로직을 이번 PR에서 직접적으로 개선·확장함.

Suggested labels

🐶 연주

Poem

체크박스가 춤추는 밤,
필수는 굳건히, 권장은 자유롭게!
토끼는 코드를 살피며 깡총깡총,
오류 메시지도 더 또렷하게~
리뷰어여, 이 변화에 박수를!
🐰✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e4e1e7 and ff97b82.

📒 Files selected for processing (2)
  • src/main/java/com/blockguard/server/domain/report/application/ReportRecordService.java (3 hunks)
  • src/main/java/com/blockguard/server/global/common/codes/ErrorCode.java (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: yeonju73
PR: Block-Guard/BlockGuard-Server#40
File: src/main/java/com/blockguard/server/domain/report/application/ReportRecordService.java:133-149
Timestamp: 2025-07-31T05:31:21.011Z
Learning: yeonju73의 코드에서는 체크박스 업데이트 전에 validateCheckboxCounts로 개수 검증을 수행하여 IndexOutOfBoundsException을 방지하고 있다. boxIndex는 순차적으로 할당되므로 추가적인 인덱스 범위 검증이 불필요하다.
Learnt from: yeonju73
PR: Block-Guard/BlockGuard-Server#32
File: src/main/java/com/blockguard/server/domain/fraud/dto/request/FraudUrlRequest.java:6-10
Timestamp: 2025-07-29T05:20:31.567Z
Learning: yeonju73은 DTO 수준에서의 입력 필드 검증과 해당하는 에러 코드 추가를 선호한다.
📚 Learning: yeonju73의 코드에서는 체크박스 업데이트 전에 validatecheckboxcounts로 개수 검증을 수행하여 indexoutofboundsexception을 방지하고 있다....
Learnt from: yeonju73
PR: Block-Guard/BlockGuard-Server#40
File: src/main/java/com/blockguard/server/domain/report/application/ReportRecordService.java:133-149
Timestamp: 2025-07-31T05:31:21.011Z
Learning: yeonju73의 코드에서는 체크박스 업데이트 전에 validateCheckboxCounts로 개수 검증을 수행하여 IndexOutOfBoundsException을 방지하고 있다. boxIndex는 순차적으로 할당되므로 추가적인 인덱스 범위 검증이 불필요하다.

Applied to files:

  • src/main/java/com/blockguard/server/domain/report/application/ReportRecordService.java
🔇 Additional comments (5)
src/main/java/com/blockguard/server/global/common/codes/ErrorCode.java (1)

37-37: 에러 메시지 명확성 개선이 적절합니다.

에러 메시지가 "필수 조치 체크박스"로 구체화되어 비즈니스 로직과 일치하며, 권장 체크박스는 수정 가능하다는 의도를 명확히 전달합니다.

src/main/java/com/blockguard/server/domain/report/application/ReportRecordService.java (4)

100-100: 검증 메서드 호출 수정이 적절합니다.

UpdateReportStepRequest 파라미터를 전달하여 현재 상태와 요청 상태를 비교할 수 있도록 하는 변경이 올바릅니다.


106-115: 완료된 단계 검증 로직 개선이 우수합니다.

이전 로직에서는 완료된 단계의 모든 수정을 차단했지만, 새로운 로직은 실제로 필수 체크박스 상태가 변경되는 경우에만 예외를 발생시켜 idempotent한 업데이트를 허용합니다. 이는 권장 체크박스 수정 허용이라는 요구사항을 정확히 구현합니다.


187-188: 체크박스 조회 로직 일반화가 적절합니다.

getCheckboxes 메서드를 일반화하여 필수/권장 체크박스 모두에 사용함으로써 코드 중복을 제거하고 유지보수성을 향상시켰습니다.


202-208: 헬퍼 메서드 일반화가 우수합니다.

getRequiredCheckboxes에서 getCheckboxes로 이름을 변경하고 CheckboxType 파라미터를 추가하여 메서드를 일반화한 것이 적절합니다. 코드 재사용성과 유지보수성이 향상되었습니다.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#47/report-records-update-error

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yeonju73 yeonju73 added 🐞 BugFix Something isn't working 🐶 연주 labels Aug 5, 2025
@yeonju73 yeonju73 merged commit 7b5ac6e into main Aug 5, 2025
1 check passed
@yeonju73 yeonju73 deleted the fix/#47/report-records-update-error branch August 5, 2025 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 BugFix Something isn't working 🐶 연주

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] 긴급신고 권장 체크 박스 수정 오류

1 participant