-
Notifications
You must be signed in to change notification settings - Fork 3
[REFACTOR] QA 반영 3차 #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REFACTOR] QA 반영 3차 #120
Changes from all commits
ac4b387
2bfaa2e
9732605
30d5544
fdcefd7
bbe16b4
5f3b426
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -263,7 +263,8 @@ class FeedRepository @Inject constructor( | |||||||||||||
| feedId = feedId, | ||||||||||||||
| isLiked = it.isLiked, | ||||||||||||||
| likeCount = newLikeCount, | ||||||||||||||
| isSaved = currentIsSaved // isSaved 상태는 그대로 유지 | ||||||||||||||
| isSaved = currentIsSaved, // isSaved 상태는 그대로 유지 | ||||||||||||||
| commentCount = 0 // 좋아요 함수에서는 댓글 수 정보 없음 | ||||||||||||||
| ) | ||||||||||||||
|
Comment on lines
+266
to
268
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chaincommentCount=0로 브로드캐스트 시 댓글 수가 0으로 초기화되는 치명적 가능성 좋아요/저장 처리에서 권장 수정안 A(타입 안전):
- commentCount = 0 // 좋아요 함수에서는 댓글 수 정보 없음
+ commentCount = null // 댓글 수는 변경하지 않음- commentCount = 0 // 저장 함수에서는 댓글 수 정보 없음
+ commentCount = null // 댓글 수는 변경하지 않음추가로 필요한 외부 변경(예시): // FeedStateUpdateResult.kt (예시)
data class FeedStateUpdateResult(
val feedId: Long,
val isLiked: Boolean,
val likeCount: Int,
val isSaved: Boolean,
val commentCount: Int? = null // null이면 기존 값 유지
)권장 수정안 B(임시 우회):
대안 C(호출부 전달):
다음 스크립트로 머지 로직이 Also applies to: 291-293 🏁 Script executed: #!/bin/bash
# FeedStateUpdateResult 병합 경로 및 commentCount 사용 방식 확인
rg -nP --type=kt -C3 'updateFeedStateFromResult|apply.*FeedStateUpdateResult|commentCount'Length of output: 119 기존 스크립트가 🏁 Script executed: #!/bin/bash
# Kotlin 파일 전체에서 FeedStateUpdateResult와 commentCount 사용 위치 검색
# 1. updateFeedStateFromResult 호출 위치 검색
rg -n 'updateFeedStateFromResult' -C3 -g '*.kt'
# 2. FeedStateUpdateResult 생성/사용 위치 검색
rg -n 'FeedStateUpdateResult' -C3 -g '*.kt'
# 3. apply { FeedStateUpdateResult(...) } 패턴 검색
rg -nP 'apply.*FeedStateUpdateResult' -C3 -g '*.kt'
# 4. commentCount 필드 접근 또는 할당 위치 검색
rg -n 'commentCount' -C3 -g '*.kt'Length of output: 43136 commentCount 초기화 버그 발견 — 긴급 수정 필요
다음 위치를 확인해주세요:
권장 수정안 A (타입 안전) // app/src/main/java/com/texthip/thip/ui/feed/mock/FeedStateUpdateResult.kt
- data class FeedStateUpdateResult(
+ data class FeedStateUpdateResult(
val feedId: Long,
val isLiked: Boolean,
val likeCount: Int,
val isSaved: Boolean,
- val commentCount: Int
+ val commentCount: Int? = null // null이면 기존 값 유지
)// app/src/main/java/com/texthip/thip/data/repository/FeedRepository.kt
- commentCount = 0 // 좋아요/저장 함수에서는 댓글 수 정보 없음
+ commentCount = null // 댓글 수는 변경하지 않음// app/src/main/java/com/texthip/thip/ui/feed/viewmodel/FeedViewModel.kt
- commentCount = result.commentCount
+ commentCount = result.commentCount ?: feed.commentCount※ 임시 우회(B) 및 호출부 전달(C) 대안은 앞선 코멘트를 참고하세요. 📝 Committable suggestion
Suggested change
|
||||||||||||||
| _feedStateUpdateResult.emit(update) | ||||||||||||||
| } | ||||||||||||||
|
|
@@ -287,7 +288,8 @@ class FeedRepository @Inject constructor( | |||||||||||||
| feedId = feedId, | ||||||||||||||
| isLiked = currentIsLiked, // isLiked 상태는 그대로 유지 | ||||||||||||||
| likeCount = currentLikeCount, | ||||||||||||||
| isSaved = it.isSaved | ||||||||||||||
| isSaved = it.isSaved, | ||||||||||||||
| commentCount = 0 // 저장 함수에서는 댓글 수 정보 없음 | ||||||||||||||
| ) | ||||||||||||||
| _feedStateUpdateResult.emit(update) | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
MyFeedItem에 isSaved/isLiked 추가: 서버 누락 시 크래시 가능
신규 불린 필드를 비-옵셔널로 추가하면, 구버전 서버/캐시된 응답/실험 플래그 미적용 환경에서 역직렬화가 실패할 수 있습니다. 기본값을 지정해 하위 호환성을 확보하세요.
또한, 새 필드가 누락되더라도 UI/도메인 매핑이 자연스럽게 동작하는지(예: 기본 false로 표시) 확인 바랍니다.
디코딩 회귀 테스트 추가 제안:
기본값 누락 여부 확인을 위해 아래 스크립트를 실행합니다.
🏁 Script executed:
Length of output: 1031
MyFeedResponse.kt의 isSaved/isLiked에 기본값(false) 지정 필수
검증 결과,
app/src/main/java/com/texthip/thip/data/model/feed/response/MyFeedResponse.kt파일의 26–27행에 선언된 두 Boolean 필드에 기본값이 없어, 서버에서 해당 필드가 누락될 경우 역직렬화 실패로 앱이 크래시될 수 있습니다.수정 제안:
app/src/main/java/com/texthip/thip/data/model/feed/response/MyFeedResponse.kt추가 확인 및 작업:
false로 자연스럽게 처리되는지 확인isSaved/isLiked누락 기존 JSON → 기본값 적용 후 정상 디코딩📝 Committable suggestion
🤖 Prompt for AI Agents