Skip to content

Task #1557: HWPX 저장본 한글 페이지 붕괴 해소 (secCnt) [#1558 위 스택]#1559

Merged
jangster77 merged 2 commits into
edwardkim:develfrom
planet6897:pr/task-1557-squash
Jun 26, 2026
Merged

Task #1557: HWPX 저장본 한글 페이지 붕괴 해소 (secCnt) [#1558 위 스택]#1559
jangster77 merged 2 commits into
edwardkim:develfrom
planet6897:pr/task-1557-squash

Conversation

@planet6897

Copy link
Copy Markdown
Contributor

개요

HWPX 저장(serialize_hwpx)본을 한글 2024 가 열 때 다중 페이지 문서가 1쪽으로 붕괴하는 결함을 해소합니다 (closes #1557).

⚠️ #1558 위에 스택: 본 브랜치는 pr/task-1552-1554-squash(#1558) 위에서 분기했습니다. upstream:devel 에 #1552·#1554 가 아직 없어 PR diff 에 함께 보입니다. #1558 머지 후 본 PR 은 #1557 단일 커밋만 남습니다(또는 base 를 재타겟). 본 PR 고유 변경은 08e1970f 입니다.

근본원인

src/serializer/hwpx/header.rs:37<hh:head secCnt> 를 stale 가능한 doc.doc_properties.section_count(=1)에서 가져옴. 섹션 파일doc.sections(=3) 기준으로 방출되어 secCnt(1) < 실제 섹션 수(3) 불일치 → 한글이 구역 1·2 를 로드하지 않고 1쪽으로 붕괴.

격리 실험으로 확정: 저장본의 secCnt="1""3" 치환만으로 한글 8→8 완전 복원.

수정

- let sec_cnt = doc.doc_properties.section_count.max(1).to_string();
+ let sec_cnt = doc.sections.len().max(1).to_string();

실제 직렬화 섹션 수와 항상 일치. IR 의미 변경 없음(메타데이터 교정).

검증

  • 36382669: 한글 8→8 완전 복원(IR diff=0 불변), 36388145 5→5, 36384160 1→3 개선.
  • 회귀 가드 단위 테스트 write_header_seccnt_matches_section_count(한글 미접근 환경 감지).
  • cargo test --test hwpx_roundtrip_baseline 4 passed(회귀 없음), 결합 빌드 성공.
  • 실문서(hwpdocs) 표본 40건 한글 페이지 붕괴율 10% → 5%(다중구역 붕괴 전부 복구).

발견 경위

fidelity v2(fresh 바이너리, hwpdocs 실문서 1135건) 4단계 오라클 검증에서 발견. IR diff 게이트도 rhwp 페이지수도 검출 불가, 한글 오라클 전용(PASS 파일도 붕괴). 근거: output/poc/fidelity2/report.md.

범위 외 (후속)

표 셀 pic 드롭(545건), char_shape 8유닛 시프트(#1556), 잔여 2→1 단일구역 붕괴, header.xml 기타 차이(imgBrush/strikeout/shadow/tabDef switch).

🤖 Generated with Claude Code

serialize_hwpx 가 header.xml <hh:head secCnt> 를 stale 한
doc_properties.section_count(=1)에서 가져와, 섹션 파일은 3개 쓰면서 secCnt=1
기록 → 한글이 뒤 구역 미로드 → 다중 페이지 문서가 1쪽으로 붕괴(IR diff 무관,
PASS 파일 포함). header.rs:37 을 doc.sections.len() 으로 교정.

검증: 36382669 한글 8→8 완전 복원(IR diff=0 불변), 36388145 5→5. 회귀 가드
단위 테스트 + hwpx_roundtrip_baseline 4 passed. 실문서 표본 붕괴율 10%→5%.

closes edwardkim#1557

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@planet6897 planet6897 force-pushed the pr/task-1557-squash branch from 08e1970 to b8fa020 Compare June 26, 2026 09:04
@jangster77 jangster77 merged commit 944d5f7 into edwardkim:devel Jun 26, 2026
8 checks passed
@jangster77

Copy link
Copy Markdown
Collaborator

@planet6897 감사합니다. #1558 위 스택 PR로 확인했고, 최신 devel 기준 branch update 후 CI를 다시 확인한 뒤 merge 완료했습니다.

검증 결과:

  • Build & Test: pass
  • CodeQL/Analyze: pass
  • WASM Build: skipped

merge commit: 944d5f7ade282ebe2bf0ae4294dde387d98b63dd
관련 이슈 #1557 은 자동 close 되지 않아 수동으로 close 처리하겠습니다.

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