Skip to content

Task #301: exam_math.hwp 12쪽 z-table 셀 수식 이중 렌더링 수정#303

Merged
edwardkim merged 3 commits into
edwardkim:develfrom
planet6897:task301
Apr 25, 2026
Merged

Task #301: exam_math.hwp 12쪽 z-table 셀 수식 이중 렌더링 수정#303
edwardkim merged 3 commits into
edwardkim:develfrom
planet6897:task301

Conversation

@planet6897

Copy link
Copy Markdown
Contributor

개요

samples/exam_math.hwp 페이지 12 좌측 컬럼 #29 안의 정규분포 z-table에서 모든 셀의 숫자/헤더 텍스트가 SVG 출력 시 두 번 그려져 겹치던 버그 수정. (closes
#301)

근본 원인 — Task #287 회귀

z-table 셀은 text="" + Equation 컨트롤 1개 구조. 빈 runs를 가진 셀 paragraph의 TAC 수식이 두 경로에서 EquationNode로 emit:

  1. paragraph_layout.rs:1996-2057 (Task #287에서 추가) — 빈-runs 인라인 EquationNode push + set_inline_shape_position 호출
  2. table_layout.rs:1602-1648 (기존) — has_text_in_para = false 분기에서 직접 EquationNode push, 중복 검사 없음

Task #287 도입 시 table_layout 측 가드를 함께 추가하지 않은 것이 원인. 두 경로의 좌표 계산 미세 차이(Δx≈2.5/28.9, Δy≈-1.31)로 살짝 어긋난 두 텍스트가 겹쳐
보였음.

변경 내용

코드

  • src/renderer/layout/table_layout.rs (+5 -1)
    • Equation 분기에 tree.get_inline_shape_position(section_index, cp_idx, ctrl_idx).is_some() 가드 추가
    • paragraph_layout이 이미 렌더했으면 inline_x만 진행하고 직접 emit 스킵
    • 기존 has_text_in_para 검사는 보조 가드로 유지 (코너 케이스 보호)

테스트

  • tests/issue_301.rs (신규, +45)
    • z-table 값 0.1915/0.3413/0.4332 각 1회 출현 검증
    • 0.4772는 본문에도 등장하므로 2회 검증

검증

항목 결과
cargo test --release 1039 passed / 0 failed / 1 ignored
cargo clippy --release clean
기존 SVG 골든 6건 무회귀
tests/issue_301.rs (수정 전) FAIL (0.1915 found 2)
tests/issue_301.rs (수정 후) PASS
회귀 스캔 (exam_math.hwp 20쪽 + exam_math_no.hwp 20쪽 + exam_math_8.hwp 1쪽) 셀 내 중복 패턴 0건

시각 비교

수정 전: z-table 셀 텍스트 겹침 (헤더 P(0≤Z≤z)IR(t)≤Z≤2)처럼 보이고, 0.19150.191$.1915 형태로 출력)
수정 후: z-table 1회 깔끔한 렌더링

영향 범위

  • 수정 영향: 빈 텍스트 셀 + TAC 수식 컨트롤 가진 모든 표
  • WASM canvas 경로: 동일 RenderTree 사용하므로 본 수정으로 동시 해결
  • Picture/Shape 유사 패턴: 본 PR 범위 외, 별도 이슈 후보

산출물

  • mydocs/plans/task_301{,_impl}.md
  • mydocs/working/task_301_stage{1,2,3}.md
  • mydocs/report/task_301_report.md

교훈

양방향 렌더 경로의 동기화 검증. Task #287에서 paragraph_layout에 빈-runs TAC 수식 처리를 추가할 때 table_layout의 기존 fallback과의 중복 가능성이 점검되지 않아 회귀가 발생. 같은 노드를 emit할 수 있는 두 경로가 있는 구조에서는 한쪽 추가 시 다른쪽 가드를 함께 점검하는 절차가 필요. 본 수정은 set_inline_shape_position이라는 기존 메커니즘을 그대로 is_rendered 플래그로 재활용하여 별도 상태 추가 없이 해결.

planet6897 and others added 3 commits April 24, 2026 23:32
paragraph_layout(Task #287의 빈-runs 경로)과 table_layout이
같은 TAC Equation을 중복 emit하던 회귀 버그를 수정.

table_layout.rs:1602 Equation 분기에 get_inline_shape_position
가드를 추가하여 paragraph_layout이 이미 렌더한 경우 직접 emit을
스킵.

회귀 테스트 tests/issue_301.rs 신규 추가.
- 수정 전: z-table 값이 SVG에 각 2회 출현 (FAIL)
- 수정 후: 각 1회 출현 (PASS)

cargo test --release: 1039 passed / 0 failed
cargo clippy --release: clean
기존 SVG 골든 6건 무회귀

@edwardkim edwardkim left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Approved. 🎉

@planet6897 님, 어제 머지된 Task #287 회귀를 다음날 즉시 발견·수정하셨네요.

평가 포인트

  • Task #287 회귀 정확 식별 — 두 경로(paragraph_layout/table_layout)의 비대칭성 명확히 분석
  • 최소 수정set_inline_shape_position 메커니즘 재활용으로 1줄 OR 추가만으로 해결. 별도 상태 추가 없음
  • 신규 회귀 테스트tests/issue_301.rs 로 z-table 값 (0.1915/0.3413/0.4332 각 1회, 0.4772는 본문 포함 2회) 검증
  • 정직한 교훈 기록 — '양방향 렌더 경로의 동기화 검증' 절차 개선 제안

메인테이너 검증

항목 결과
cargo test --lib ✅ 992 / 0 / 1 ignored
cargo test --test svg_snapshot ✅ 6 / 0 (golden 유지)
cargo test --test issue_301 ✅ 1 / 0 (신규)
cargo test --test tab_cross_run ✅ 1 / 0 (#290 회귀 없음)
cargo clippy / wasm32 ✅ clean
CI (원본) ✅ 전부 SUCCESS
실제 SVG z-table 셀 출현 ✅ 0.1915/0.3413/0.4332 각 1회, 0.4772 2회 (본문 포함)
WASM Docker 빌드 + rhwp-studio 브라우저 시각 검증 ✅ 작업지시자 판정 성공

후속 후보

  • Picture/Shape 유사 패턴 (작성자 인지) — 별도 이슈 후보

Merge 진행합니다.

@edwardkim edwardkim merged commit 798b845 into edwardkim:devel Apr 25, 2026
6 checks passed
edwardkim added a commit that referenced this pull request Apr 25, 2026
- 작성자: @planet6897 (Task #301, PR #303)
- Merge commit: 798b845 (Task #287/PR #289 회귀 수정)
- 이슈 #301 CLOSED

변경 (1파일 1줄):
- src/renderer/layout/table_layout.rs +7 -2:
  - Equation 분기에 tree.get_inline_shape_position() 가드 추가
  - paragraph_layout(Task #287) 이 이미 렌더했으면 직접 emit 스킵

테스트:
- tests/issue_301.rs (신규, +44): z_table_equations_rendered_once
  - 0.1915/0.3413/0.4332 각 1회, 0.4772는 본문 포함 2회

검증:
- cargo test --lib: 992 passed
- svg_snapshot: 6 passed (golden 유지)
- 실제 SVG z-table 출현 횟수: 작성자 주장 정확히 일치
- WASM Docker 빌드 + rhwp-studio 브라우저 시각 검증: 성공

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@planet6897 planet6897 deleted the task301 branch April 30, 2026 00:03
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.

2 participants