chore(fig-extract): v2.19.1 cropCanvas 제거 계약 반영 + 벤더링 버전 핀 - #33
Merged
Conversation
엔진 v2.19.1이 figure.cropCanvas 필드와 cropCanvas() 접근자를 제거했다 ([BREAKING], 백로그 B7 — Chrome이 메모리 압력에서 캔버스 백킹 스토어를 회수해 크롭이 백지 PNG가 되던 결함). 이 repo에서 cropCanvas 호출부는 0곳이고 tab-figures.ts는 cropDataURL만 쓴다. **엔진 벤더링은 하지 않는다** — src/core/fig-extract.js는 v2.14.0 유지. 선언 타입은 벤더링 런타임의 부분집합으로 유지한다: 제거는 지금, 추가는 벤더링과 함께. 근거는 좁히기가 컴파일 타임에 요란하게, 넓히기가 런타임에 조용히 실패하기 때문이다. captionPage·onDiagnostic·cropImages는 다음 벤더링 할 일로 남겼다. - VENDORED_ENGINE_VERSION 상수 + 검사 테스트: 벤더링하면 깨져 TODO로 돌려보낸다 - 현재 v2.14.0 런타임의 cropDataURL이 f.cropCanvas를 읽는 순수 접근자라는 사실 명시 (엔진 객체를 그대로 넘겨야 함 — M3 storage 작업의 함정) - FigRenderError는 v2.19.1+ 에서만 발생 — 지금 분기하면 죽은 코드임을 명시 - AbortController 미배선을 벤더링 무관 선재 결함으로 분리 typecheck 0 · vitest 27/27 · build 0 · dist 무변화 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
📝 WalkthroughWalkthrough벤더링 엔진 버전과 선언 타입/API의 차이를 정리하고, Changes엔진 계약 및 통합 문서
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
엔진 repo가 v2.19.1에서
figure.cropCanvas필드와cropCanvas()접근자를 제거했다 ([BREAKING]). 이 PR은 그 계약 변경을 타입·테스트·문서에 반영한다.엔진 벤더링은 하지 않음 —
src/core/fig-extract.js는 v2.14.0 그대로고 추후 벤더링은 별도 PR.왜 지금 타입만 고치는가
cropCanvas를 호출하는 코드가 이 repo에 하나도 없다.tab-figures.ts는cropDataURL만 쓰고, 애초에Pick<FigExtractApi, 'extract' | 'cropDataURL'>로 API를 좁혀 놨다. 나머지 등장 위치는 전부 타입 선언과 테스트 더미({} as HTMLCanvasElement)였다.운영 원칙을 문서에 명시했다: 선언 타입은 벤더링 런타임이 실제로 제공하는 것의 부분집합으로 유지한다 — 제거는 지금, 추가는 벤더링과 함께. 근거는 두 방향의 실패 방식이 다르기 때문이다.
그래서 v2.15.0~v2.19.1이 추가한
captionPage·onDiagnostic·cropImages는 타입에 넣지 않고 「다음 벤더링 할 일」로 남겼다.변경
src/core/fig-engine.ts—EngineFigure.cropCanvas필드 ·FigExtractApi.cropCanvas메서드 제거VENDORED_ENGINE_VERSION상수 + 검사 테스트 신설 — 벤더링하면 테스트가 깨져 할 일 목록으로 돌려보낸다. 버전 스큐를 날짜 박힌 문단이 아니라 테스트가 지키게 하려는 것docs/fig-extract-integration.md— §크롭 이미지 수명 재작성, 버전 스큐 절 신설, 「다음 벤더링 할 일」 5항목, 「벤더링과 무관한 선재 결함」 분리toFigureEntries의 shape 단언은surplusEngineField로 보강했다 — 더미 제거로 rest-spread 리팩터를 못 잡게 되는 걸 막는다알아 둘 것 — 지금 이 확장에도 같은 결함이 있다
엔진 백로그 B7의 원인은 Chrome이 메모리 압력에서 캔버스 백킹 스토어를 예외 없이 회수하는 것이다. 회수된 캔버스는 그리기가 전부 무성과로 끝나고 읽으면 전면 투명이다.
벤더링본 v2.14.0은 figure마다
cropCanvas를 만들어 문서 스캔이 끝날 때까지 들고 있고(tab-figures.ts가cropDataURL을 렌더 시점에야 부른다),FigRenderError도 없다. 즉 같은 상황에서 오류도 재시도 버튼도 없이 프리뷰 카드가 백지로 뜬다. 엔진 전수 배치에서는 한 논문 크롭 23장이 통째로 백지 PNG가 됐고 그게 출하본에까지 들어갔다.문서에 이 사실과, 벤더링 전까지 유효한 주의 두 가지를 남겼다.
cropDataURL은f.cropCanvas를 읽는 순수 접근자다. 엔진이 준 figure 객체를 그대로 넘겨야 한다 — 선언된 필드만으로 재구성하거나structuredClone/JSON 왕복을 거치면 타입은 통과하고 런타임에서 죽는다. M3의 storage 저장 작업이 정확히 이 함정을 부른다.tab-figures.ts가signal을 넘기지 않아 문서 교체 시 이전 스캔이 계속 돈다. 스캔 두 개가 동시에 돌면 크롭 세트가 두 벌 상주해 이 결함의 발생 확률을 호스트가 스스로 올린다. 엔진 버전과 무관한 선재 결함이라 벤더링을 기다릴 이유가 없다.검증
npm run typecheck:winexit 0 ·vitest run27/27 ·npm run build:winexit 0 ·dist/무변화🤖 Generated with Claude Code
Summary by CodeRabbit
변경 사항
cropCanvas공개 API를 제거하고 크롭 결과는 데이터 URL 또는 Blob 방식으로 제공합니다.FigRenderError로 처리되는 동작을 명확히 했습니다.테스트