Task #1035: HWP3 vs HWP5 변환본 페이지 alignment fix (37.5% → 93.75%, closes #1035)#1036
Closed
jangster77 wants to merge 8 commits into
Closed
Task #1035: HWP3 vs HWP5 변환본 페이지 alignment fix (37.5% → 93.75%, closes #1035)#1036jangster77 wants to merge 8 commits into
jangster77 wants to merge 8 commits into
Conversation
devel baseline 측정: - HWP3 sample16: 64 페이지 - HWP5 변환본 sample16: 64 페이지 - alignment 정합률: 24/64 (37.5%) — 40 페이지 미정합 PR edwardkim#1009 hunks 임시 적용 결과: - sample16-hwp5: 64 → 65 (+1 over-split 회귀 재현) - alignment: 24 → 23 (오히려 악화) - main_trigger 자체는 정확 (pi=472 prev_end=68312 > 0.85×72848=61920 + pi=473 vpos=284 < 1500) - HWP3 native 동일 paragraph 도 vpos=0 reset 패턴 — 휴리스틱 의도는 정확 Over-split 메커니즘: - p18~p23: PR edwardkim#1009 휴리스틱 정확히 작동 - p24 부근 PartialParagraph 처리 (pi=460 paragraph 내부 vpos-reset@line3) - PR edwardkim#1009 force-break + PartialParagraph split 효과 누적 → +1 추가 페이지 Narrow 가드 후보 4 식별: - A: PartialParagraph 가능성 paragraph 에서 trigger skip - B: high_threshold 0.85 → 0.90/0.95 - C: 다음 paragraph height 검증 - D (권고): naturally-breaks 단언 — paginator 가 자연 break 할 위치인지 미리 계산, 자연 break 시 force-break skip CHARS_PER_LINE 45 (PR edwardkim#1009 commit message claim 45→50 부정확, actual diff 없음). 본 task 에서 composer.rs 무수정. Stage 2 진행: PR edwardkim#1009 base + narrow 가드 D 우선 시도. Refs edwardkim#1035 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…% → 93.75%) PR edwardkim#1009 (Task edwardkim#1007, closed) 의 cross-paragraph vpos reset 감지 휴리스틱 base 적용 + Task edwardkim#1035 narrow 가드 2 항목: 1. high_threshold 0.85 → 0.95 (자연 paginator break 영역 외 제외) 2. aux_trigger 제거 (empty bridge 휴리스틱은 false positive 다수) Stage 1 진단 + Stage 2 narrow 가드 실험 결과: | 시도 | sample16-hwp5 | alignment | |------|---------------|-----------| | devel baseline | 64 | 24/64 (37.5%) | | PR edwardkim#1009 그대로 (0.85+aux) | 65 (+1) | 23/64 (악화) | | 0.95 + aux 유지 | 65 | 23/64 | | all triggers disabled | 64 | 24/64 | | 0.95 + aux 제거 (채택) | 64 ✓ | 60/64 (93.75%) ✓ | → aux_trigger 자체가 over-split 의 직접 원인 (empty bridge 휴리스틱 false positive). main_trigger 만 + threshold 0.95 narrow 로 정합률 대폭 향상. 변경 파일 (PR edwardkim#1009 base): - src/renderer/pagination/engine.rs (+84, variant_vpos_reset_break) - src/renderer/typeset.rs (+136, 동일 로직 두 경로 정합) - src/renderer/pagination.rs (PaginationOpts::is_hwp3_variant 필드) - src/document_core/queries/rendering.rs (is_hwp3_variant 전달) variant 식별 인프라 (cfb_reader/parser/model) 는 이미 edwardkim#1005 머지 — 재활용. 회귀 sweep: - 변환본 9종 페이지 수: 모두 무변동 (over-split 회귀 0) - HWP3 native + 일반 HWP5 (exam_*, aift, biz_plan): 무변동 - cargo test --lib: 1308 passed (1 추가 — variant 인프라 테스트) - cargo test --tests: FAILED 0 (전체 integration) - clippy / fmt --all: clean (feedback_cargo_fmt_all_required 정합) 회귀 가드 추가: tests/issue_1035_alignment.rs hwp3_sample16_hwp5_page_count_64 — sample16-hwp5 64 유지 단언 (PR edwardkim#1009 over-split 65 회귀 재발 방지). 성공 기준 C1~C6 자동 단언 완료. C7 (시각 검증) Stage 4 시점. Refs edwardkim#1035 / PR edwardkim#1009 follow-up Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ension 진단 p21 미정합 (HWP5 변환본 p21 시작 pi=442 vs HWP3 pi=440) case-specific fix 시도: - aux_trigger narrow (empty_between≥3 + prev_end > body × 0.75): 65p +1 over-split 회귀 - aux_trigger 그대로 + main만 narrow: 동일 회귀 - 모든 narrow 가드 실패 — aux_trigger 발동 자체가 over-split 직접 원인 Root cause — paginator cumulative height vs encoder vpos signal: - HWP5 변환본 encoder: pi=440 vpos=852 (page-reset signal, hwp_used=32.7px 작음) - rhwp paginator: cumulative paragraph height 측정 971.0px (body 거의 full) - HWP5 변환본 paragraph height 가 HWP3 보다 약 2배 (font/spacing metric 차이) - aux_trigger force-break 후 paginator cumulative 누적이 자연 break 보다 큼 → +1 페이지 한컴 정답지 비교 단언: - 한컴 한글 viewer p21 (footer "-21-") = rhwp HWP3 p23 (idx=22) 내용 정합 (11 items pi=450~460 + "나." Table subheader) - HWP5 변환본 p23 (rhwp): 같은 11 items 이나 paragraph height 2배 → pi=460 PartialParagraph split + 시각적 overflow - 38 페이지 추정 = 한컴 viewer 로딩 시 근사값 (별도 issue 등록 대상 아님) 잔존 미정합의 본질: - p21 alignment + p23 overflow 모두 HWP5 변환본 paragraph height 과대 측정 원인 - Task edwardkim#1008 격차 D (폰트 매핑) 영역 연장 - 별도 issue 등록 권고: "HWP5 변환본 paragraph height 과대 측정 — HWP3 대비 약 2배" 본 task Stage 2 fix (60/64 alignment, 64 페이지 유지) 가 최선 — PR 진행 권고. Refs edwardkim#1035 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Stage 1~3 종결: - Stage 1: 진단 — PR edwardkim#1009 휴리스틱 over-split + alignment 악화 재현 - Stage 2: PR edwardkim#1009 base + Task edwardkim#1035 narrow 가드 (0.85→0.95, aux 제거) → alignment 37.5% → 93.75% (60/64) + sample16-hwp5 64 유지 - Stage 3: case-specific p21 fix 시도 — fundamental tension 단언 성공 기준 C1~C7 모두 충족 (작업지시자 한컴 정답지 시각 검증 포함). 잔존 미정합 (p21 alignment + p23 overflow) 의 본질 = HWP5 변환본 paragraph height 가 HWP3 의 약 2배 (font/spacing metric 차이). 별도 issue 등록 권고. closes edwardkim#1035 (alignment 부분 해결, paragraph height 본질 후속 issue) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 20, 2026
edwardkim
added a commit
that referenced
this pull request
May 21, 2026
…ent fix (37.5% → 93.75%) @jangster77 (Taesup Jang) PR #1036 — closes #1035 (M100, v1.0.0). 핵심: - HWP3 vs HWP5 변환본 페이지 alignment 24/64 (37.5%) → 60/64 (93.75%) - is_hwp3_variant 가드 + cross-paragraph vpos reset 감지 (engine.rs + typeset.rs) - 조건 4개: variant + non-synth + prev_end > body × 0.95 + curr_first < 1500 HU - PR #1009 대비 narrow (aux_trigger 제거 + threshold 0.85 → 0.95) - 회귀 가드: tests/issue_1035_alignment.rs (sample16-hwp5 페이지 수 64 유지) 검증: - cargo test --release --lib: 1319 passed - cargo test --release --test issue_1035_alignment: 1/1 passed - 10 fixture BEFORE/AFTER 페이지 수 모두 일치 (회귀 부재) - 작업지시자 시각 판정 통과 본 환경 dry-run (PR base a52859d → origin/devel bc5683f) 본질 11 파일 squash 적용.
Owner
|
PR #1036 cherry-pick merge 완료 (squash → devel 402e0ce). Task #1035 HWP3 vs HWP5 변환본 페이지 alignment 24/64 (37.5%) → 60/64 (93.75%). 작업지시자 시각 판정 통과 + 10 fixture 회귀 부재 + 1319 lib + issue_1035 1/1 통과. 본 PR base (a52859d) 가 origin/devel (bc5683f) 보다 5 commit behind 였으나 본질 11 파일 (4 코드 + 1 test + 6 문서) 충돌 없이 통합. PR #1009 close 사유 (sample16-hwp5 +1 over-split) 정정 — aux_trigger 제거 + high_threshold 0.85 → 0.95 narrow. 잔존 4 미정합 페이지 (p21 등) + p23 overflow 의 본질 (HWP5 변환본 paragraph height 가 HWP3 의 약 2배) 은 별도 issue 후속 권고. 감사합니다, @jangster77. |
edwardkim
added a commit
that referenced
this pull request
May 21, 2026
- mydocs/pr/archives/pr_1036_review.md (이동) - mydocs/pr/archives/pr_1036_report.md (최종 보고서 신규) - mydocs/plans/archives/task_m100_1035.md + task_m100_1035_impl.md (이동) - mydocs/orders/20260521.md PR #1036 항목 추가 PR #1036 (closes #1035, @jangster77 26+번째 기여): HWP3 vs HWP5 변환본 페이지 alignment 24/64 (37.5%) → 60/64 (93.75%). PR #1009 close 사유 정정 — aux_trigger 제거 + high_threshold 0.85 → 0.95 narrow. squash merge (devel 402e0ce) + 10 fixture 페이지 수 회귀 부재 + 작업지시자 시각 판정 통과 + WASM 4.90MB 동기화.
edwardkim
pushed a commit
that referenced
this pull request
May 21, 2026
#1037) HWP3 → HWP5 변환본 의 raw ParaShape 값이 한컴 변환기에 의해 2× scaled 저장되는 quirk 를 parser 단계 normalize + 문단모양 dialog margin/indent 표시 산식을 raw_ps 직접 사용 + HWP3/HWP5 변환본 unit semantic 차이 분기로 한컴 정답 정합 달성. 3 본질 코드 파일: - src/parser/mod.rs (+16): is_hwp3_variant 직후 ParaShape margin_left/right + indent + spacing_before/after /= 2 (한컴 변환기 2× quirk parser 단계 normalize) - src/renderer/style_resolver.rs (+5/-4): 종전 variant_div=4 (Task #1001 case-specific 보정) → uniform variant_div=2 — parser normalize 후 normal HWP5 동등 처리 - src/document_core/commands/formatting.rs (+20/-1): build_para_properties_json dialog margin/indent 산식 raw_ps 직접 + variant 분기 (HWP3 native: effective first-line = margin_left + min(0, indent), HWP5 변환본: raw 직접) 효과 (sample16 p452 / p97 동일 paragraph 비교): - dialog 4 필드 한컴 정합: 왼쪽 40 / 오른쪽 10 / 내어쓰기 20 / 문단위 8.5 - HWP3 + HWP5 변환본 모두 한컴 정답 정합 - rendering 무변동: spacing_before /2 + variant_div /2 = 종전 /4 동등 → 페이지 수 64 + PR #1036 alignment 60/64 유지 - 회귀 부재 sweep: 변환본 9종 + HWP3 + 일반 fixture 모두 페이지 수 무변동 작업지시자 시각 검증 — "(3) 원격지 재해복구센터(DR: Disaster Recovery) 구축" paragraph 에서 한컴 / rhwp HWP3 / rhwp HWP5 변환본 dialog 완전 정합. 자동 검증: - cargo build --release ✓ warning 0 - cargo clippy --release --lib -- -D warnings ✓ clean - cargo fmt --all -- --check ✓ clean - cargo test --release --lib ✓ 1308 passed (PR #1036 회귀 가드 양립) - cargo test --release --tests ✓ FAILED 0 - CI 모두 SUCCESS (Build & Test / CodeQL / Canvas visual diff) PR #1036 (Task #1035, closed) 잔존 후속: - PR #1036 의 alignment 60/64 (93.75%) 달성 후 잔존 미정합 4 페이지 + p23 overflow 의 본질 = HWP5 변환본 paragraph height 2× — 본 PR 정정 - PR base bbd38e8 (PR #1033 머지 후) 로 multi-merge 상태 — 본질 3 코드 파일만 origin/devel (402e0ce = PR #1036 머지 후) 위에 cherry-pick squash 적용 Stage 4 negative result (PR 본문 명시): - page break vpos==0 휴리스틱: Recall 31.6%, FP 4 (부적합) - p23 overflow line_seg 합성 옵션 B': Task #1010 회귀 (+24 페이지) - 잔존 2 이슈 (p23 overflow + page_break_before 손실) 별도 task 분리 권고 closes #1037 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
edwardkim
added a commit
that referenced
this pull request
May 21, 2026
…malize + Dialog 한컴 정합 fix @jangster77 (Taesup Jang) PR #1040 — closes #1037 (M100, v1.0.0). PR #1036 (Task #1035, 방금 머지) 잔존 본질 해결. 핵심: - HWP3 → HWP5 변환본 ParaShape margin/indent/spacing 2× quirk parser 단계 normalize - Dialog 4 필드 한컴 정합 (왼쪽 40 / 오른쪽 10 / 내어쓰기 20 / 문단위 8.5 — HWP3 + HWP5 변환본 모두 정합) - style_resolver variant_div 종전 4 (case-specific Task #1001) → uniform 2 단순화 - build_para_properties_json raw_ps 직접 사용 + is_hwp3_variant 분기 검증: - cargo test --release --lib: 1319 passed (PR #1036 회귀 가드 양립) - cargo test --release --tests: FAILED 0 (전체 통합) - cargo clippy --release --lib -D warnings: clean - cargo fmt --check: clean - 10 fixture BEFORE/AFTER diff = 0 (rendering 무변동 정량 입증) - 작업지시자 시각 판정 통과 (dialog 4 필드 한컴 정합) PR base bbd38e8 (PR #1033 머지 후) → origin/devel 402e0ce (PR #1036 머지 후 + docs) cherry-pick squash. 본질 3 코드 파일 + Task #1037 plans/working/report 7 문서 적용. 잔존 후속 (PR 본문 명시): p23 overflow + page_break_before 손실 별도 task 분리 권고.
edwardkim
added a commit
that referenced
this pull request
May 21, 2026
- mydocs/pr/archives/pr_1040_review.md (이동) - mydocs/pr/archives/pr_1040_report.md (최종 보고서 신규) - mydocs/plans/archives/task_m100_1037.md + task_m100_1037_impl.md (이동) - mydocs/orders/20260521.md PR #1040 항목 추가 PR #1040 (closes #1037, @jangster77 30번째 기여): HWP5 변환본 ParaShape unit normalize + Dialog 한컴 정합 fix. parser 단계 ParaShape /= 2 normalize + style_resolver variant_div 4 → uniform 2 + build_para_properties_json raw_ps 직접 사용 + is_hwp3_variant 분기. squash merge (devel c6fb7f2) + 10 fixture BEFORE/AFTER diff = 0 (rendering 무변동 정량 입증) + Dialog 4 필드 한컴 정합 시각 판정 통과 + WASM 4.90MB 동기화. PR #1036 alignment 60/64 + 페이지 수 64 완전 보존. HWP3 sample16 정합 시리즈 (PR #1031/#1034/#1036/#1040) 마무리.
edwardkim
pushed a commit
that referenced
this pull request
May 25, 2026
scope 재정의: "p23 외곽선 overflow" → "HWP3→HWP5 multi-fixture paragraph alignment 정합 — sample16-hwp5/k-water-rfp 한컴 오피스 버전별 정확 정렬 (PR #1036 후속)". 이슈 #1042 title/body 정정 완료. 진단 결과 종합: - 5 fixture baseline (sample16-hwp5 4 버전 + 변환기): 변환기/2010/2018/2024 = 64 정합, 2022 만 +1 회귀. - k-water-rfp.hwp/2024.hwp: rhwp 29 vs 한컴 PDF 27 = +2 over-split. - Raw binary 리버싱: 변환기+2010+2022 가 59 PARA_LINE_SEG 누락. 2018+2024 자동 보정 (+5KB). - 한컴 viewer 추론: PARA_LINE_SEG 는 layout cache, viewer 가 paragraph header 만으로 layout 가능. rhwp baseline 이 viewer 동작 모방. - 2018/2024 reverse engineering 합성 공식 (lh+ls 999/999 매칭): lh=th=max_base_size, ls=th×(line_spacing-100)/100, bl=th×0.85, cs=ParaShape.margin_left, sw=body_width-margin_left-margin_right. - paragraph_layout multi-path 차이 단언 (line_segs.empty vs filled). - k-water-rfp 페이지 별 +4~+19 px diff = paragraph 별 +0.5~+1 px 누적. Stage 1 산출물: - 새 fixture: hwp3-sample16-hwp5-{2010,2018,2022,2024}.hwp + k-water-rfp-2024 + pdf/k-water-rfp-2024.pdf (한컴 정답 27 페이지 reference) - 진단 test: tests/diag_1042_raw_binary.rs, tests/diag_1042_2024_reverse.rs - 수행/구현 계획서: epic-level scope + 4 sub-task stage 분리 (본 task 내) - 진단 보고서: 본 task 의 모든 fix 시도 회귀 패턴 입증. 다음 stage: - Stage 2: paragraph 드래그 선택 (composer fallback segment_width) - Stage 3: k-water-rfp +2 over-split (paragraph_layout height 정밀화) - Stage 4: 2022 +1 baseline 회귀 - Stage 5: p23 외곽선 overflow (PartialParagraph) - Stage 6: 최종 보고서 + PR (closes #1042) 새 issue 등록 X — 본 task 내에서 모든 sub-task stage 처리. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
samples/hwp3-sample16-hwp5.hwp(HWP5 변환본) 의 페이지별 paragraph alignment 가 동일 문서 HWP3 native 와 37.5% (24/64) 만 정합. PR #1009 (Task #1007, closed — sample16-hwp5 +1 over-split 회귀로 close) 의 cross-paragraph vpos reset 감지 휴리스틱 base 적용 + Task #1035 narrow 가드 2 항목 으로 over-split 회피 + alignment 93.75% (60/64) 달성.PR #1009 close 사유 정정
PR #1009 의 +1 over-split 직접 원인 = aux_trigger (empty bridge 휴리스틱 false positive). aux_trigger 제거 + high_threshold 0.85→0.95 narrow 로 over-split 회피.
핵심 변경
src/renderer/pagination/engine.rs+src/renderer/typeset.rs두 경로 모두 동일 narrow.변경 위치
src/renderer/pagination/engine.rssrc/renderer/typeset.rssrc/renderer/pagination.rsPaginationOpts::is_hwp3_variant필드src/document_core/queries/rendering.rsis_hwp3_variant전달variant 식별 인프라 (cfb_reader, model/document.rs, parser/mod.rs, hwpx/mod.rs) 는 #1005 이미 머지 — 재활용.
Test plan
cargo build --release: warning 0cargo clippy --release --lib -- -D warnings: cleancargo fmt --all -- --check: cleancargo test --release --lib: 1308 passed; 0 failedcargo test --release --tests: FAILED 0 (전체 integration)cargo test --release --test issue_1035_alignment: 1 passed (회귀 가드)회귀 가드
tests/issue_1035_alignment.rs::hwp3_sample16_hwp5_page_count_64— sample16-hwp5 64 유지 단언.잔존 + 후속 작업
잔존 4 미정합 페이지 (p21 등) + p23 overflow 의 본질 = HWP5 변환본 paragraph height 가 HWP3 의 약 2배 (font/spacing metric 차이). Task #1008 격차 D (폰트 매핑) 영역 연장. 별도 issue 등록 예정 — "HWP5 변환본 paragraph height 과대 측정 (HWP3 대비 약 2배)".
Closes #1035
🤖 Generated with Claude Code