Skip to content

[Fix] canvas 이미지 URL 변환 오류 수정 - presigned URL로 변환 후 AI 처리 가능#199

Merged
gaeunee2 merged 2 commits intodevfrom
fix/198-canvas-image-url-conversion
Feb 18, 2026
Merged

[Fix] canvas 이미지 URL 변환 오류 수정 - presigned URL로 변환 후 AI 처리 가능#199
gaeunee2 merged 2 commits intodevfrom
fix/198-canvas-image-url-conversion

Conversation

@gaeunee2
Copy link
Copy Markdown
Collaborator

@gaeunee2 gaeunee2 commented Feb 18, 2026

📌 관련 이슈

🏷️ PR 타입

  • ✨ 기능 추가 (Feature)
  • 🐛 버그 수정 (Bug Fix)
  • ♻️ 리팩토링 (Refactoring)
  • 📝 문서 수정 (Documentation)
  • 🎨 스타일 변경 (Style)
  • ✅ 테스트 추가 (Test)

📝 작업 내용

  • canvas 이미지 URL 변환 버그 수정
  • convertAssetIdsToUrls() 함수에 canvasImageIds 추가하여 AI가 이미지 다운로드 및 OCR 처리 가능하게 수정

📸 스크린샷

✅ 체크리스트

  • 코드 리뷰를 받을 준비가 완료되었습니다
  • 테스트를 작성하고 모두 통과했습니다
  • 문서를 업데이트했습니다 (필요한 경우)
  • 코드 스타일 가이드를 준수했습니다
  • 셀프 리뷰를 완료했습니다

📎 기타 참고사항

  • canvas 이미지는 이제 S3 업로드 후 presigned URL로 변환되어 AI 서비스에 전달됩니다.

Summary by CodeRabbit

  • Bug Fixes
    • 채팅 기능에서 canvas image 자산이 URL 생성에 포함되도록 개선되었습니다.

@gaeunee2 gaeunee2 requested a review from chowon442 February 18, 2026 18:45
@gaeunee2 gaeunee2 self-assigned this Feb 18, 2026
@gaeunee2 gaeunee2 added the bug Something isn't working label Feb 18, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 18, 2026

Warning

Rate limit exceeded

@gaeunee2 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

ChatServiceImpl의 채팅 초기화 시 asset URL 변환 로직을 수정하여, mentionedAssetIds와 canvasImageIds를 모두 집계한 통합 목록(allAssetIdsForUrl)을 생성 후 convertAssetIdsToUrls에 전달합니다. 로그 메시지도 두 asset ID 그룹과 결과 URL을 반영하도록 업데이트되었습니다.

Changes

Cohort / File(s) Summary
Canvas 이미지 URL 변환 통합
src/main/java/com/proovy/domain/conversation/service/ChatServiceImpl.java
mentionedAssetIds와 canvasImageIds를 결합하여 단일 목록으로 통합한 후 convertAssetIdsToUrls에 전달. 로그 메시지 업데이트로 canvas 이미지 asset도 포함된 URL 변환 과정을 반영.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

🗨️Conversations

Suggested reviewers

  • Ncs89

Poem

🐰 Canvas 이미지 URL로 변환되고,
AI가 이제 다운로드할 수 있네요!
모든 자산을 모아 함께 처리하니,
버그는 사라지고 대화는 완성됩니다. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경 내용의 핵심을 명확하게 반영하고 있으며, canvas 이미지 URL 변환 버그 수정이라는 주요 변경사항을 정확하게 설명합니다.
Description check ✅ Passed PR 설명이 저장소의 템플릿을 충실히 따르고 있으며, 관련 이슈, PR 타입, 작업 내용, 체크리스트 및 참고사항을 모두 포함하고 있습니다.
Linked Issues check ✅ Passed 변경 사항이 이슈 #198의 요구사항을 충족합니다. canvasImageIds를 mentionedAssetIds와 함께 convertAssetIdsToUrls()에 전달하여 presigned URL로 변환하는 목표가 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경 사항이 이슈 #198의 canvas 이미지 URL 변환 버그 수정 범위 내에 있으며, 범위를 벗어난 변경사항은 없습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/198-canvas-image-url-conversion

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@chowon442 chowon442 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정말 "핵심"을 찌른 수정입니다!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/main/java/com/proovy/domain/conversation/service/ChatServiceImpl.java (1)

183-190: allAssetIdsForUrl 변수 제거 및 중복 DB 조회 개선 권고

allAssetIdsForUrl(183-189)은 이미 144~151라인에서 동일한 로직으로 구성된 allAssetIds와 완전히 동일한 값을 가집니다. 같은 람다 스코프 내에서 allAssetIds를 그대로 재사용할 수 있으므로, allAssetIdsForUrl 블록 전체가 불필요한 중복 코드입니다.

또한 convertAssetIdsToUrls(490번 라인)는 내부적으로 assetRepository.findAllByIdInAndUserId를 다시 호출하므로, 153번 라인에서 이미 수행된 동일한 DB 쿼리가 같은 트랜잭션 안에서 두 번 실행됩니다.

♻️ allAssetIdsForUrl 제거 및 allAssetIds 재사용 제안
-            // 6. 자산 URL 변환 (mentionedAssetIds + canvasImageIds 모두 포함)
-            List<Long> allAssetIdsForUrl = new ArrayList<>();
-            if (request.getMentionedAssetIds() != null) {
-                allAssetIdsForUrl.addAll(request.getMentionedAssetIds());
-            }
-            if (request.getCanvasImageIds() != null) {
-                allAssetIdsForUrl.addAll(request.getCanvasImageIds());
-            }
-            List<String> filesUrl = convertAssetIdsToUrls(allAssetIdsForUrl, userId);
+            // 6. 자산 URL 변환 (4-1에서 구성한 allAssetIds 재사용)
+            List<String> filesUrl = convertAssetIdsToUrls(allAssetIds, userId);

더 나아가 중복 DB 조회를 제거하려면, convertAssetIdsToUrlsList<Asset>을 직접 받도록 오버로드하고, 153번 라인에서 조회된 assets를 전달하는 방식을 고려할 수 있습니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/proovy/domain/conversation/service/ChatServiceImpl.java`
around lines 183 - 190, Remove the redundant allAssetIdsForUrl block and reuse
the already-built allAssetIds; stop calling convertAssetIdsToUrls with IDs that
cause a second DB lookup via assetRepository.findAllByIdInAndUserId. Instead
overload or add a convertAssetIdsToUrls(List<Asset> assets, Long userId) (or
similar) and pass the already-fetched assets variable from the earlier query
(assets) into it so the assets are not queried twice; update call sites to use
the new overload and remove allAssetIdsForUrl and its population logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/com/proovy/domain/conversation/service/ChatServiceImpl.java`:
- Around line 191-192: The INFO-level log in ChatServiceImpl (the log statement
that logs filesUrl) exposes S3 presigned URLs; remove the presigned URL from
that log or downgrade it to DEBUG and log only non-sensitive identifiers (e.g.,
mentionedAssetIds, canvasImageIds) instead, and ensure the same change is
applied inside convertAssetIdsToUrls where the log "Presigned URL 생성 - assetId:
{}, s3Key: {}, url: {}" is emitted so that the URL value is no longer written at
INFO level (log only assetId/s3Key at INFO or include the full URL only at
DEBUG).
- Around line 183-189: The code builds allAssetIdsForUrl by concatenating
request.getMentionedAssetIds() and request.getCanvasImageIds() without
deduplication, causing duplicate asset IDs to trigger false mismatches in
convertAssetIdsToUrls and duplicate presigned URLs; fix by deduplicating after
merging (e.g., collect into a LinkedHashSet or use stream().distinct()) when
constructing allAssetIdsForUrl and apply the same deduplication to allAssetIds
(the variable created earlier) so both the URL conversion call and payload to
the AI service receive unique asset IDs; ensure references to
request.getMentionedAssetIds(), request.getCanvasImageIds(), allAssetIdsForUrl,
allAssetIds, and convertAssetIdsToUrls are updated accordingly.

---

Nitpick comments:
In `@src/main/java/com/proovy/domain/conversation/service/ChatServiceImpl.java`:
- Around line 183-190: Remove the redundant allAssetIdsForUrl block and reuse
the already-built allAssetIds; stop calling convertAssetIdsToUrls with IDs that
cause a second DB lookup via assetRepository.findAllByIdInAndUserId. Instead
overload or add a convertAssetIdsToUrls(List<Asset> assets, Long userId) (or
similar) and pass the already-fetched assets variable from the earlier query
(assets) into it so the assets are not queried twice; update call sites to use
the new overload and remove allAssetIdsForUrl and its population logic.

Comment thread src/main/java/com/proovy/domain/conversation/service/ChatServiceImpl.java Outdated
Comment thread src/main/java/com/proovy/domain/conversation/service/ChatServiceImpl.java Outdated
@gaeunee2 gaeunee2 merged commit 9c1fbe0 into dev Feb 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] canvas 이미지 presigned URL 변환 버그 수정

2 participants