fix: 문서 교체 시 진행 중인 figure 스캔을 실제로 중단 - #36
Conversation
setDocument()은 #scanGeneration만 올려 이전 스캔의 결과를 버렸을 뿐, #scan()이 opts.signal을 넘기지 않아 작업은 끝까지 돌았다. 통합 규약 §취소가 요구하는 호스트 측 배선이 빠져 있었다. - setDocument에서 이전 컨트롤러 abort (여기에만 둔다 — 문서 교체만이 진행 중인 스캔을 무효화하는 사건이고, 재시도는 종료 상태 'error'에서만 진입한다) - ensureScanned가 스캔마다 새 AbortController를 만들고 #scan이 signal 전달 - 취소는 정상 흐름이므로 에러 UI를 띄우지 않는다. 엔진이 던지는 이름 (AbortError·RenderingCancelledException…)에 기대지 않고 signal.aborted만 본다 - 성공/실패 경로를 대칭으로: generation을 올리지 않는 abort 지점이 나중에 생겨도 취소된 스캔 결과가 후임 문서 탭에 그려지지 않는다 - 조기 반환을 try 안으로 옮겨 #scanAbort 정리가 finally를 항상 거치게 한다 Closes #34 typecheck 0 · vitest 29/29 · build 0. 신규 테스트 2건은 src 수정을 되돌리면 실패함을 확인했다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Summary
FiguresTab.setDocument()은#scanGeneration을 올려 이전 스캔의 결과만 버렸고,#scan()이 엔진에opts.signal을 넘기지 않아 작업은 끝까지 돌았다. 문서를 빠르게 갈아타면 스캔이 중첩돼 크롭 세트가 두 벌 상주한다 — 통합 규약(docs/fig-extract-integration.md §취소)이 명시적으로 요구하는 호스트 측 배선이 빠져 있었다.엔진은 v2.5.0부터
opts.signal을 지원하고 v2.5.1부터 진행 중 렌더도RenderTask.cancel()로 끊는다.ExtractOptions.signal도 이미 선언돼 있었다. 호스트만 배선하면 되는 문제였다.Closes #34
Changes
setDocument()가 이전AbortController를 abort한다. abort는 여기에만 둔다 — 문서 교체만이 진행 중인 스캔을 무효화하는 사건이고, 재시도(ensureScanned)는 종료 상태'error'에서만 진입하므로 그때는 취소할 스캔이 없다.ensureScanned()가 스캔마다 새 컨트롤러를 만들고#scan()이signal을 전달한다.catch는 generation 불일치로 에러 UI가 가려지는 구조였는데, 그에 의존하지 않고signal.aborted를 명시적으로 본다. 안 그러면 문서를 바꿀 때마다 "figure 스캔에 실패했어요"가 번쩍인다. 엔진이 던지는 이름(AbortError·RenderingCancelledException…)에 기대지 않는다.dispose·패널 닫기 등)이 나중에 생겨도, 취소된 스캔의 결과가 후임 문서 탭에 그려지지 않는다.try안으로 옮겨#scanAbort정리가 항상finally를 거치게 했다 (현재 도달 불가하지만 새 불변식을 가드 하나에만 의존시키지 않는다).Test plan
npm run typecheck통과 ·vitest run29/29 (기존 27 + 신규 2) ·npm run build통과src/viewer/panel/tab-figures.ts만 stash하고 돌려 두 테스트가 정확히 실패하는 것을 봤다.new DOMException('figure 추출이 취소됨', 'AbortError'))로 거절하며, ①signal.aborted가 실제로 true가 되는지 ② 취소가 에러 UI·console.error를 남기지 않는지 ③ 새 문서 스캔이 정상 렌더되는지를 본다.기대 결과
알아 둘 것
checkAborted()와 진행 중 렌더에서만 멈추므로, 문서 교체 후에도 나가는 스캔이 약 1페이지 분량을 더 들고 있을 수 있다. "스캔 두 개가 끝까지" 대비 이득이 목적이다.PdfHost.#setDocument가 이전PDFDocumentProxy를destroy()하지 않아 세션 내내 상주한다. 문서를 열수록 단조 증가하므로 이 PR보다 영향이 크다.Checklist
feat: …,fix: …— squash 커밋 메시지가 됨)npm run typecheck·npm test통과🤖 Generated with Claude Code