Skip to content

fix: 캡챠 화면 미실행 수정#39

Merged
kim-subsub merged 2 commits into
developfrom
bug/38
May 7, 2026
Merged

fix: 캡챠 화면 미실행 수정#39
kim-subsub merged 2 commits into
developfrom
bug/38

Conversation

@kim-subsub

@kim-subsub kim-subsub commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

캡챠 화면 미실행으로 인한 코드 수정

해당 PR에 대한 작업 요약을 작성해주세요.

Tasks

캡챠 화면 실행

Summary by CodeRabbit

버그 수정

  • 스캔 제출 중 중복 요청 발생을 방지하도록 동시성 제어 추가

Chores

  • API 라우팅을 쿼리 매개변수 기반에서 경로 세그먼트 기반으로 업데이트

@vercel

vercel Bot commented May 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
veri-q Ready Ready Preview, Comment May 7, 2026 4:30pm

@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Rate limit exceeded

@kim-subsub has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 37 minutes and 28 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a91e4d77-d1e4-4918-af34-dceb9ae1a8f7

📥 Commits

Reviewing files that changed from the base of the PR and between 299d7a8 and 7be33b8.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • src/pages/QRScan/hooks/useQRScanPage.ts

Walkthrough

이 PR은 API 라우팅을 쿼리 매개변수에서 경로 매개변수 스타일로 변경하고, 캡차 에러 감지 로직을 단순화하며, QR 스캔 제출 흐름에 동시성 가드를 추가합니다.

Changes

QR 스캔 API 라우팅 및 동시성 개선

레이어 / 파일 요약
API 라우팅 설정
vercel.json, api/be1.js, api/be3.js
Vercel 라우팅 재작성이 /api/be1/:path*/api/be3/:path* 형식의 경로 매개변수 통과를 사용하도록 업데이트되었습니다. 두 핸들러가 BE1_PROXY_TARGET_URLBE3_PROXY_TARGET_URL 환경변수를 통해 요청을 프록시합니다.
캡차 에러 감지 단순화
src/features/scan-url/api/uploadErrors.ts, src/features/scan-url/api/uploadErrors.test.ts
isCaptchaRequiredUploadError 함수가 HTTP 상태 코드 429만 확인하도록 단순화되었습니다. 이전의 페이로드/메시지 텍스트 스캔 로직이 제거되었고, 테스트가 평문 429 응답에 대해 true를 반환하도록 업데이트되었습니다.
QR 스캔 제출 동시성 제어
src/pages/QRScan/hooks/useQRScanPage.ts, src/pages/QRScan/QRScanPage.tsx
isScanSubmittingRef 참조 및 beginScanSubmission/finishScanSubmission 헬퍼를 사용하여 제출 흐름에 동시성 가드가 추가되었습니다. handleCapturePhotohandleGalleryFileChange는 중복 제출을 방지하기 위해 초기에 제출을 게이트합니다. handleOpenGalleryisCapturing이 true일 때 갤러리 선택을 차단합니다. 갤러리 업로드 버튼이 인라인 핸들러 대신 handleOpenGallery 참조를 직접 사용하도록 단순화되었습니다.
🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 주요 목표와 부합합니다. 캡챠 화면 실행 문제 수정이라는 명확한 의도가 반영되어 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/QRScan/hooks/useQRScanPage.ts (1)

524-550: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

갤러리 경로에서 동기 예외 시 제출 락이 해제되지 않을 수 있습니다.

beginScanSubmission() 이후 Promise 체인 이전 구간에서 예외가 나면 .finally()에 도달하지 않아 isScanSubmittingRef/isCapturing이 고정될 수 있습니다. 전체 구간을 try/finally로 감싸 해제를 보장해 주세요.

🔧 제안 수정안
-  const handleGalleryFileChange = useCallback(
-    (event: ChangeEvent<HTMLInputElement>) => {
+  const handleGalleryFileChange = useCallback(
+    async (event: ChangeEvent<HTMLInputElement>) => {
       const selectedFile = event.target.files?.[0];

       if (!selectedFile) {
         return;
       }

       if (!beginScanSubmission()) {
         event.target.value = '';
         return;
       }

-      const photoUrl = URL.createObjectURL(selectedFile);
-
-      updateCaptureRecord({
-        badgeLabel: 'UPLOAD',
-        capturedAt: formatCapturedAt(new Date()),
-        headline: selectedFile.name,
-        photoUrl,
-        summary: '갤러리 이미지를 불러와 최근 기록에 반영했습니다.',
-      });
-
-      void submitScanFile({
-        file: selectedFile,
-        fileName: selectedFile.name,
-        onSuccessMessage: '이미지를 업로드하고 분석을 시작했습니다.',
-      })
-        .catch((error) => {
-          console.error('Failed to upload QR scan image from gallery.', error);
-          showApiError(message, error, '갤러리 이미지 업로드에 실패했습니다.');
-        })
-        .finally(() => {
-          finishScanSubmission();
-        });
-
-      event.target.value = '';
+      try {
+        const photoUrl = URL.createObjectURL(selectedFile);
+
+        updateCaptureRecord({
+          badgeLabel: 'UPLOAD',
+          capturedAt: formatCapturedAt(new Date()),
+          headline: selectedFile.name,
+          photoUrl,
+          summary: '갤러리 이미지를 불러와 최근 기록에 반영했습니다.',
+        });
+
+        await submitScanFile({
+          file: selectedFile,
+          fileName: selectedFile.name,
+          onSuccessMessage: '이미지를 업로드하고 분석을 시작했습니다.',
+        });
+      } catch (error) {
+        console.error('Failed to upload QR scan image from gallery.', error);
+        showApiError(message, error, '갤러리 이미지 업로드에 실패했습니다.');
+      } finally {
+        finishScanSubmission();
+        event.target.value = '';
+      }
     },
     [beginScanSubmission, finishScanSubmission, message, submitScanFile, updateCaptureRecord],
   );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/QRScan/hooks/useQRScanPage.ts` around lines 524 - 550, The code
calls beginScanSubmission() then performs synchronous work (creating a blob URL,
updateCaptureRecord, and starting submitScanFile()) but if a synchronous
exception occurs before the Promise chain the submission lock
(isScanSubmittingRef / isCapturing) won't be released; wrap the whole
post-beginScanSubmission block in try { ... } finally { finishScanSubmission();
} so finishScanSubmission() always runs, move the submitScanFile() call inside
the try and keep its existing .catch/.finally semantics for upload-specific
cleanup, and ensure event.target.value = '' and
URL.createObjectURL(selectedFile) / updateCaptureRecord(...) are inside the try
so any thrown errors still trigger the finally; reference beginScanSubmission,
submitScanFile, updateCaptureRecord, finishScanSubmission,
isScanSubmittingRef/isCapturing, and selectedFile when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/pages/QRScan/hooks/useQRScanPage.ts`:
- Around line 524-550: The code calls beginScanSubmission() then performs
synchronous work (creating a blob URL, updateCaptureRecord, and starting
submitScanFile()) but if a synchronous exception occurs before the Promise chain
the submission lock (isScanSubmittingRef / isCapturing) won't be released; wrap
the whole post-beginScanSubmission block in try { ... } finally {
finishScanSubmission(); } so finishScanSubmission() always runs, move the
submitScanFile() call inside the try and keep its existing .catch/.finally
semantics for upload-specific cleanup, and ensure event.target.value = '' and
URL.createObjectURL(selectedFile) / updateCaptureRecord(...) are inside the try
so any thrown errors still trigger the finally; reference beginScanSubmission,
submitScanFile, updateCaptureRecord, finishScanSubmission,
isScanSubmittingRef/isCapturing, and selectedFile when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f796e775-d03c-4a30-991c-84fcfa7ea217

📥 Commits

Reviewing files that changed from the base of the PR and between 51afe1a and 299d7a8.

📒 Files selected for processing (7)
  • api/be1.js
  • api/be3.js
  • src/features/scan-url/api/uploadErrors.test.ts
  • src/features/scan-url/api/uploadErrors.ts
  • src/pages/QRScan/QRScanPage.tsx
  • src/pages/QRScan/hooks/useQRScanPage.ts
  • vercel.json
💤 Files with no reviewable changes (2)
  • api/be3.js
  • api/be1.js

@kim-subsub kim-subsub merged commit 852601d into develop May 7, 2026
8 checks passed
@kim-subsub kim-subsub deleted the bug/38 branch May 7, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant