Skip to content

render: add CanvasKit replay policy diagnostics#925

Closed
seo-rii wants to merge 2 commits into
edwardkim:develfrom
seo-rii:render-p15
Closed

render: add CanvasKit replay policy diagnostics#925
seo-rii wants to merge 2 commits into
edwardkim:develfrom
seo-rii:render-p15

Conversation

@seo-rii

@seo-rii seo-rii commented May 16, 2026

Copy link
Copy Markdown
Contributor

What

  • CanvasKit replay policy plan을 추가했습니다.
  • getCanvasKitReplayPlan(page, mode) native/WASM API를 추가해서 현재 PageLayerTree가 CanvasKit에서 어떻게 replay될지 diagnostics JSON으로 확인할 수 있게 했습니다.
  • CanvasKit mode를 default / compat으로 나눴습니다.
    • default: native Skia로 이어지는 direct replay 준비 모드입니다. 지원하지 못하는 op를 Canvas2D overlay로 조용히 숨기지 않고 directRequired / hiddenOverlayForbidden으로 드러냅니다.
    • compat: 사용자-visible 안정성을 위한 transition 모드입니다. 아직 direct replay가 없는 op는 compatOverlay로 표시하고, overlay 허용 여부를 명시합니다.
  • P14에서 추가한 analyze_text_variant_selection 결과를 CanvasKit replay plan에 연결했습니다. GlyphRun / GlyphOutline은 여전히 strict sidecar gate를 통과할 때만 direct candidate가 되고, 아니면 TextRun fallback을 유지합니다.
  • Studio wasm bridge에도 getCanvasKitReplayPlan fallback을 추가해서 새 wasm이 아니어도 호출부가 깨지지 않게 했습니다.
  • docs/text-ir-v2.md와 README에 P15 방향을 문서화했습니다.

Why

P14까지는 Text IR v2의 strict sidecar 후보와 backend selection diagnostics를 잡는 단계였습니다. P15는 그 다음 단계로, CanvasKit을 Canvas2D-assisted preview가 아니라 native Skia로 이어지는 독립 replay backend로 키우기 위한 policy boundary를 먼저 만듭니다.

이번 PR은 CanvasKit renderer를 실제 public path로 전환하지 않습니다. 목적은 “무엇이 direct replay 가능하고, 무엇이 아직 overlay/fallback인지”를 숨기지 않고 reviewer와 후속 PR이 볼 수 있게 만드는 것입니다. 특히 hidden Canvas2D overlay가 기본 경로처럼 굳어지지 않도록 default mode에서는 gap을 명시적으로 드러냅니다.

Non-goals

  • public Canvas / CanvasKit render path를 바꾸지 않습니다.
  • CanvasKit에서 image/equation/form/text effect를 직접 그리도록 전환하지 않습니다.
  • Canvas2D overlay를 실제로 제거하지 않습니다.
  • GlyphRun / GlyphOutline을 canonical text path로 바꾸지 않습니다.
  • native Skia glyph replay나 CanvasKit glyph replay를 기본값으로 켜지 않습니다.
  • resource interning / font blob extraction은 하지 않습니다.

Compatibility

  • 기존 SVG/Canvas/native Skia 출력은 바뀌지 않습니다.
  • getCanvasKitReplayPlan은 diagnostics-only API입니다.
  • default mode는 hidden Canvas2D overlay를 금지하는 계획을 보여줄 뿐, 현재 public render output을 바꾸지 않습니다.
  • compat mode는 transition overlay를 명시적으로 보고합니다.
  • 새 wasm API가 없는 Studio 빌드에서도 bridge fallback이 빈 plan JSON을 반환합니다.

관련 이슈

Refs #536

Tests

  • git diff --check upstream/devel...HEAD
  • cargo test renderer::canvaskit_policy --lib
  • cargo test test_canvaskit_replay_plan_export_uses_mode_policy --lib
  • cargo clippy -- -D warnings
  • cargo test --lib

스크린샷

없음.

이번 PR은 renderer output 변경이 아니라 CanvasKit replay policy diagnostics 추가입니다.

@seo-rii seo-rii marked this pull request as ready for review May 16, 2026 10:12
Copilot AI review requested due to automatic review settings May 16, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds diagnostics-only CanvasKit replay policy planning so callers can inspect how a PageLayerTree would be classified for CanvasKit direct replay versus compatibility overlays.

Changes:

  • Adds canvaskit_policy analysis with default/compat modes, summary counts, per-op replay items, and text variant selection reports.
  • Exposes getCanvasKitReplayPlan(page, mode) through native/WASM APIs and Studio bridge fallback.
  • Documents P15 CanvasKit policy direction and adds tests for mode-level export behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/renderer/canvaskit_policy.rs Implements CanvasKit replay policy diagnostics and unit tests.
src/renderer/mod.rs Registers the new renderer policy module.
src/document_core/queries/rendering.rs Adds native JSON export for CanvasKit replay plans.
src/wasm_api.rs Exposes the replay plan API to wasm-bindgen callers.
src/wasm_api/tests.rs Adds coverage for mode policy JSON export.
rhwp-studio/src/core/wasm-bridge.ts Adds Studio bridge wrapper and old-WASM fallback plan.
README.md Notes P14/P15 renderer diagnostics milestones.
docs/text-ir-v2.md Documents CanvasKit direct replay and overlay policy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/renderer/canvaskit_policy.rs
Comment thread src/renderer/canvaskit_policy.rs Outdated
Comment thread src/renderer/canvaskit_policy.rs Outdated
Comment thread src/document_core/queries/rendering.rs Outdated
@edwardkim edwardkim self-requested a review May 17, 2026 04:06
@edwardkim edwardkim added this to the v1.0.0 milestone May 17, 2026
@edwardkim edwardkim added the enhancement New feature or request label May 17, 2026
edwardkim pushed a commit that referenced this pull request May 17, 2026
additive diagnostics API, 기존 렌더링 경로 무변경.

- renderer/canvaskit_policy.rs (+829) — replay plan 생성 (default/compat 모드)
- wasm_api.rs — getCanvasKitReplayPlan(page, mode) WASM 바인딩
- rendering.rs — native API
- rhwp-studio wasm-bridge.ts — fallback 추가
- docs/text-ir-v2.md + README — P15 문서화

검증:
- cargo test 1286 passed (+9 신규)
- 렌더링 무영향 (시각 판정 불필요)

Refs #536

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@edwardkim

Copy link
Copy Markdown
Owner

검토 + cherry-pick 머지 완료. 감사합니다.

처리 결과

재검증

  • cargo test: 1286 passed (+9 신규)
  • 렌더링 무영향 — diagnostics-only API, 시각 판정 불필요

P12→P13→P14→P15 일관된 단계적 진행입니다. 수고하셨습니다.

@edwardkim edwardkim closed this May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants