Skip to content

chore: bump fig-extract to v2.19.4 - #39

Merged
onetwothr1 merged 2 commits into
devfrom
chore/vendor-fig-extract-2.19.4
Jul 28, 2026
Merged

chore: bump fig-extract to v2.19.4#39
onetwothr1 merged 2 commits into
devfrom
chore/vendor-fig-extract-2.19.4

Conversation

@onetwothr1

@onetwothr1 onetwothr1 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

엔진 PDFViewer-Figure-Extract v2.19.4를 벤더링한다 (엔진 SHA af44f5a49c6dec19344e9893dee4963b60de76ab). 직전 벤더링본은 v2.14.0이었고, 그 사이 소비자 계약이 두 가지 바뀌었다 — cross-page figure의 captionPage 방출과 FigRenderError.

Changes

cross-page figure (엔진 v2.19.0) — 캡션이 다음 장 상단에 있는 그림을 이제 실제 그림 페이지에 방출한다. figure.page는 그림 페이지이고, 캡션이 다른 페이지일 때만 figure.captionPage(optional)가 실린다. same-page figure에는 필드 자체가 없다.

  • captionBoxPt캡션 페이지 좌표계다 — 그림 페이지 높이로 toPdfRect하면 조용히 틀린다. 타입·문서에 명시했다.
  • FigureSeed.captionPage를 필수로 두고 toFigureEntries?? page로 정규화한다. FigureEntry는 넓히지 않았다 (captionAnchor.page가 목적지 필드).
  • 새 경계 함수 toFigureEntry()가 필드를 명시 나열해 seed 전용 필드가 FigureEntry(→ chrome.storage)로 새지 않게 한다. 스프레드는 TS strict에서도 초과 속성 검사를 받지 않아 타입이 막아주지 못한다.

FigRenderError (엔진 v2.19.1) — Chrome이 메모리 압력에서 캔버스 백킹 스토어를 회수하면 엔진이 즉시 실패시킨다(이전에는 백지 크롭이 조용히 저장됐다). tab-figures.ts가 엔진과 동일한 duck-typing(error.name)으로 판별해 메모리 안내 문구를 띄운다 — realm을 넘으면 instanceof만 깨지고 이름은 남는다.

  • ⚠️ 부분 결과가 없다: 앞 20페이지를 다 잡았어도 21페이지에서 죽으면 목록이 0건이다. 실패 모드가 "일부 백지"에서 "전부 없음"으로 옮겨간다. 재시도는 백오프 없는 즉시 전량 재스캔이라, 문구가 "다른 탭을 닫고"를 먼저 안내하는 것이 유일한 완화다.

크롭 접근자cropCanvas가 export에서 사라졌고 cropDataURL·cropBlob은 내부 cropPng_를 읽는 접근자다. "엔진 figure 객체를 그대로 넘겨라 / structuredClone·JSON 왕복 금지"는 필드 이름만 바뀐 채 그대로 유효하다.

ExtractOptionscropImages·onDiagnostic 추가. onDiagnostic record에는 캡션 줄 원문이 앵커당 최대 180자 실리므로 로컬 디버깅 외 사용 금지를 주석에 명시했다.

문서 — 버전 핀이 지키는 범위가 "상수 ↔ 엔진 파일" 한 쌍뿐이고 선언 타입이 어느 버전 기준인지는 기계가 검사할 수 없다는 점을 명시. 갱신 절차에 엔진 repo clean 확인 + SHA 기재 추가. figure-ux.md·implementation-plan.md의 캡션 검색 페이지 기준, pdf-host.ts의 낡은 크롭 주석, 엔진 v2.16.0에서 해소된 v2.11.0 캐비앳도 정정.

Test plan

  • npm run typecheck 통과

  • npm test 48 passed (직전 41 → +7)

  • npm run build 통과

  • 실 PDF 스모크 3편 — 벤더링본을 헤드리스로 로드해 확인

    논문 기대 결과
    PLOS pbio-3002205 7@p15, captionPage 16 PASS (17건 중 captionPage 보유 1건)
    npj Microgravity Sanesi-2023 10@p12, captionPage 13 PASS (10건 중 1건)
    Barak & Krakauer-2021 1@p2, captionPage 3 PASS (4건 중 1건)

    세 편 모두 크롭(cropDataURL)이 PNG data URL로 생성되는 것까지 확인했다.

새 테스트가 죽이는 회귀 (뮤테이션으로 검증):

  1. 좌표 변환에 캡션 페이지 높이를 쓰는 것 — 페이지별로 다른 높이를 주는 mock + 호출 인자 단언
  2. 카드가 캡션 페이지를 가리키는 것 — dataset.page·aria-label·p.N 칩 세 곳
  3. FigRenderError 판별을 instanceof로 좁히는 것
  4. toFigureEntry가 seed를 스프레드해 captionPage를 흘리는 것

Checklist

  • PR 제목이 Conventional Commits 형식
  • npm run typecheck · npm test 통과
  • AI-assisted (에이전트가 작성/보조한 PR이면 체크)

Summary by CodeRabbit

  • 새로운 기능
    • 그림과 캡션이 다른 페이지에 있는 경우 캡션 앵커 및 영속화를 더 안정적으로 처리합니다.
    • 진단 기록 및 이미지 크롭 비용을 줄이는 옵션을 지원합니다.
    • 메모리 부담으로 렌더 실패 시 재시도 안내가 더 명확해졌습니다.
  • 버그 수정
    • 캡션 앵커 누락/잘못된 라벨 판정, 캡션 클릭 히트 감지 오류를 개선했습니다.
    • 페이지별 크기 기반 좌표 변환 정확도를 높였습니다.
  • 문서
    • 캡션 처리 원칙, 오류/재시도 동작, 엔진 갱신 절차를 최신 내용으로 보강했습니다.
  • 테스트
    • 캡션 페이지·실패 모드·좌표 변환 관련 검증을 확장했습니다.

엔진 PDFViewer-Figure-Extract v2.19.4를 벤더링한다 (엔진 SHA
af44f5a49c6dec19344e9893dee4963b60de76ab, 벤더링 시점 HEAD).
직전 벤더링본은 v2.14.0이었다.

## 소비자에게 영향 있는 계약 변화

**cross-page figure (v2.19.0)** — 캡션이 다음 장 상단에 있는 그림을 이제 실제
그림 페이지에 방출한다. `figure.page`는 그림 페이지이고, 캡션이 다른 페이지면
`figure.captionPage`(optional)가 실린다. same-page figure에는 필드 자체가 없다.
`captionBoxPt`는 **캡션 페이지 좌표계**다 — 그림 페이지 높이로 변환하면 조용히
틀린다. `FigureSeed.captionPage`를 필수로 두고 `toFigureEntries`가 `?? page`로
정규화하며, 새 경계 함수 `toFigureEntry()`가 필드를 명시 나열해 seed 전용 필드가
`FigureEntry`(→ chrome.storage)로 새지 않게 한다. 스프레드는 TS strict에서도
초과 속성 검사를 받지 않아 타입이 막아주지 못한다.

**FigRenderError (v2.19.1)** — Chrome이 메모리 압력에서 캔버스 백킹 스토어를
회수하면 엔진이 즉시 실패시킨다. 이전에는 백지 크롭이 조용히 저장됐다.
`tab-figures.ts`가 이 오류를 이름으로 판별해(엔진과 동일한 duck-typing — realm을
넘으면 instanceof만 깨진다) 메모리 안내 문구를 띄운다. **부분 결과는 없다**:
앞 20페이지를 다 잡았어도 21페이지에서 죽으면 목록이 0건이다. 실패 모드가
"일부 백지"에서 "전부 없음"으로 옮겨간다.

**크롭 접근자 (v2.19.1)** — `cropCanvas`가 export에서 사라졌고 `cropDataURL`·
`cropBlob`은 내부 `cropPng_`를 읽는 접근자다. "엔진 figure 객체를 그대로 넘겨라 /
structuredClone·JSON 왕복 금지"는 필드 이름만 바뀐 채 그대로 유효하다.

**ExtractOptions** — `cropImages`(v2.19.1)·`onDiagnostic`(v2.15.0) 추가.
onDiagnostic record에는 캡션 줄 원문이 앵커당 최대 180자 실리므로 로컬 디버깅
외에는 쓰지 않는다.

v2.13.1~v2.19.4의 나머지 변경(감지 품질·관측 계층)은 출력 스키마에 영향이 없다.

## 검증

typecheck 통과 · 48 tests 통과(직전 41 → +7) · build 통과.
실 PDF 스모크 3편에서 cross-page 방출과 크롭 생성을 확인했다 — PLOS pbio 7@p15
(captionPage 16), Sanesi 10@p12(13), Barak 1@p2(3). 세 편 모두 captionPage를
가진 행은 그 1건뿐이고 나머지 same-page 행에는 필드가 없다.

새 테스트가 죽이는 회귀: ① 좌표 변환에 캡션 페이지 높이를 쓰는 것(페이지별로
다른 높이를 주는 mock + 호출 인자 단언) ② 카드가 캡션 페이지를 가리키는 것
③ FigRenderError 판별을 instanceof로 좁히는 것 ④ toFigureEntry가 seed를
스프레드해 captionPage를 흘리는 것.

## 문서

§벤더링 상태를 v2.19.4 완료로 갱신하고, 버전 핀이 지키는 범위가 "상수 ↔ 엔진
파일" 한 쌍뿐이며 선언 타입이 어느 버전 기준인지는 기계가 검사할 수 없다는 점을
명시했다. 갱신 절차에 엔진 repo clean 확인과 SHA 기재를 추가했다.
figure-ux.md·implementation-plan.md의 캡션 검색 페이지 기준, pdf-host.ts의 낡은
크롭 주석, v2.16.0에서 해소된 v2.11.0 캐비앳도 함께 정정했다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@onetwothr1
onetwothr1 requested a review from enu3379 as a code owner July 28, 2026 14:59
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 797e1b5a-7821-4936-9860-4012f04ce6ee

📥 Commits

Reviewing files that changed from the base of the PR and between 62c62c0 and 5ba94c1.

📒 Files selected for processing (1)
  • docs/fig-extract-integration.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/fig-extract-integration.md

📝 Walkthrough

Walkthrough

fig-extract 엔진을 v2.19.4로 갱신하고, 캡션 페이지 정규화·구조화 진단·렌더 오류·PNG 크롭 처리를 추가했다. FigureEntry 변환, figures UI, 테스트와 관련 문서도 새 계약에 맞춰 수정했다.

Changes

fig-extract 엔진 통합

Layer / File(s) Summary
FigureSeed 계약과 캡션 페이지 변환
src/core/fig-engine.ts, test/fig-engine.test.ts, docs/figure-ux.md, docs/implementation-plan.md
captionPage를 seed에서 필수로 정규화하고, toFigureEntry에서 영속 FigureEntry로 유입되지 않도록 변환 및 테스트를 갱신했다.
캡션 앵커 인식 정규화
src/core/fig-extract.js
조판 글리프를 제거한 텍스트를 캡션·라벨·hard/soft anchor 판정에 사용하도록 변경했다.
진단·렌더·크롭 파이프라인
src/core/fig-extract.js, src/core/fig-engine.ts
구조화 진단 콜백, FigRenderError, 빈 캔버스 검출, 인접 페이지 관측, PNG 기반 크롭과 문서 종료 처리를 추가했다.
렌더 오류 UI와 운영 문서
src/viewer/panel/tab-figures.ts, src/viewer/pdf-host.ts, test/tab-figures.test.ts, docs/fig-extract-integration.md
FigRenderErrorname으로 판별해 메모리 부족 안내와 재시도 UI를 표시하고, 관련 동작 및 갱신 절차를 문서화했다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related issues

Possibly related PRs

  • enu3379/PDFViewer#23 — 동일한 fig-extract 엔진 갱신과 cropCanvas, abort 렌더 처리 계약을 다룬다.
  • enu3379/PDFViewer#33cropCanvas 제거 및 cropDataURL·cropBlob 경로 변경과 직접 연결된다.
  • enu3379/PDFViewer#15 — figures 탭의 FigRenderError 실패 처리와 재시도 UI를 함께 다룬다.

Suggested reviewers: enu3379

Poem

새 엔진이 깡충 왔네, 당근!
캡션 길을 페이지 따라 찾고,
빈 캔버스엔 멈춤을 외치며,
진단 기록을 바구니에 담네. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 fig-extract 엔진을 v2.19.4로 올리는 핵심 변경을 정확하고 간결하게 요약합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/vendor-fig-extract-2.19.4

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.

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

Actionable comments posted: 1

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

Inline comments:
In `@docs/fig-extract-integration.md`:
- Around line 41-44: 정본 예시의 반복 처리에서 정의되지 않은 seed 참조를 수정하세요. seeds 배열의 각 항목을
순회하도록 예시 코드를 변경하고, 각 항목을 toFigureEntry()에 전달해 기존 captionPage 제거 및
anchorFoundIn() 동작을 유지하세요.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 46219e06-566d-4151-97de-d6329ce13c9c

📥 Commits

Reviewing files that changed from the base of the PR and between 2ef8da7 and 62c62c0.

📒 Files selected for processing (9)
  • docs/fig-extract-integration.md
  • docs/figure-ux.md
  • docs/implementation-plan.md
  • src/core/fig-engine.ts
  • src/core/fig-extract.js
  • src/viewer/panel/tab-figures.ts
  • src/viewer/pdf-host.ts
  • test/fig-engine.test.ts
  • test/tab-figures.test.ts

Comment thread docs/fig-extract-integration.md Outdated
@onetwothr1
onetwothr1 merged commit 0798330 into dev Jul 28, 2026
3 checks passed
@onetwothr1
onetwothr1 deleted the chore/vendor-fig-extract-2.19.4 branch July 28, 2026 17:55
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