Skip to content

fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트#583

Closed
oksure wants to merge 1 commit intoedwardkim:develfrom
oksure:contrib/fix-group-picture-serialize-v2
Closed

fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트#583
oksure wants to merge 1 commit intoedwardkim:develfrom
oksure:contrib/fix-group-picture-serialize-v2

Conversation

@oksure
Copy link
Copy Markdown
Contributor

@oksure oksure commented May 4, 2026

배경

이전 PR #428에서 동일 수정을 제출했으나, Copilot 리뷰에서 라운드트립
테스트 부재를 지적받아 close됨. 이번 PR은 해당 피드백을 반영.

문제

serialize_group_child()ShapeObject::Picture 분기가 TODO로 빈 상태:

ShapeObject::Picture(_pic) => {
    // TODO: 그룹 내 그림 직렬화
}

그룹 도형에 포함된 그림이 저장 시 누락됨.

해결

기존 단독 Picture 직렬화(serialize_picture_control)와 동일한 패턴으로
그룹 자식 경로에 레코드 2개 생성:

  1. HWPTAG_SHAPE_COMPONENT (comp_level) — serialize_shape_component(SHAPE_PICTURE_ID, ...)
  2. HWPTAG_SHAPE_COMPONENT_PICTURE (type_level) — serialize_picture_data(pic)

다른 그룹 자식(Line, Rectangle, Ellipse, Chart, OLE)과 동일한 구조.

검증

라운드트립 테스트 test_roundtrip_group_picture_child:

  • Group{children: [Picture{bin_data_id=7, size=5000x3000}]} 구성

  • serialize_sectionparse_body_text_section

  • Picture 자식 존재, bin_data_id, original_width/height 보존 확인

  • cargo test 전체 통과

  • cargo clippy -- -D warnings 경고 0

이전 PR: #428 (closed)

그룹 도형 자식으로 포함된 Picture가 serialize_group_child()에서
TODO로 빈 분기로 남아 있어 저장 시 누락되던 문제 수정.

변경:
- serialize_group_child()의 ShapeObject::Picture 분기에
  SHAPE_COMPONENT + SHAPE_COMPONENT_PICTURE 레코드 생성 추가
- 라운드트립 테스트 추가: serialize→parse 후 Picture 자식의
  bin_data_id, shape_attr 필드 보존 검증

이전 PR #428은 테스트 미포함으로 close됨. 이번에 Copilot 리뷰
피드백 반영하여 라운드트립 테스트 포함.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 4, 2026 07:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements serialization for ShapeObject::Picture when it appears as a child inside a Group shape, fixing the issue where grouped pictures were dropped on save. It also adds a roundtrip test to ensure grouped picture metadata (e.g., bin_data_id, original dimensions) is preserved through serialize → parse.

Changes:

  • Implement serialize_group_child() handling for ShapeObject::Picture by emitting HWPTAG_SHAPE_COMPONENT + HWPTAG_SHAPE_COMPONENT_PICTURE.
  • Add a new roundtrip test test_roundtrip_group_picture_child to verify grouped picture child survival and key fields preservation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/serializer/control.rs Implements grouped Picture child serialization by emitting the appropriate SHAPE_COMPONENT + SHAPE_COMPONENT_PICTURE records at the expected nesting levels.
src/serializer/control/tests.rs Adds a regression test ensuring Group → Picture child roundtrips and preserves bin_data_id and original dimensions.

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

@edwardkim edwardkim self-requested a review May 4, 2026 08:47
@edwardkim edwardkim added this to the v1.0.0 milestone May 4, 2026
@edwardkim edwardkim added the enhancement New feature or request label May 4, 2026
edwardkim added a commit that referenced this pull request May 4, 2026
cherry-pick:
- 21fe401 (8dc75f6): fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트

본질:
- src/serializer/control.rs +13/-2 (serialize_group_child Picture 분기)
- src/serializer/control/tests.rs +79 (라운드트립 테스트 신규)
- 기존 단독 Picture 직렬화와 동일 패턴 적용
  · HWPTAG_SHAPE_COMPONENT (comp_level)
  · HWPTAG_SHAPE_COMPONENT_PICTURE (type_level)
- 다른 그룹 자식 (Line/Rectangle/Ellipse/Chart/OLE) 과 동일 구조

검증:
- cargo test --lib 1125 passed (신규 test_roundtrip_group_picture_child GREEN)
- 회귀 0 (issue_505/530/546/418/501/svg_snapshot)
- cargo clippy --lib 0 건

직렬화 영역 (저장 시 누락 정정), 시각 영향 없음 — B 처리 (라운드트립 테스트로 결정적 검증).

작성자: @oksure (Hyunwoo Park) — 세 번째 PR (PR #581/#582 후속)

PR #428 후속 — Copilot 리뷰 피드백 (라운드트립 테스트 부재) 반영.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
edwardkim added a commit that referenced this pull request May 4, 2026
…commit)

본 PR 은 외부 컨트리뷰터 @oksure (Hyunwoo Park) 의 세 번째 PR (PR #581/#582 후속).

cherry-pick:
- 21fe401 (8dc75f6): fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트
  · src/serializer/control.rs +13/-2
  · src/serializer/control/tests.rs +79

본질: serialize_group_child 의 ShapeObject::Picture TODO 빈 분기 → 단독 Picture
직렬화와 동일 패턴 적용 (HWPTAG_SHAPE_COMPONENT + HWPTAG_SHAPE_COMPONENT_PICTURE).
PR #428 후속 (Copilot 리뷰 피드백 반영, 라운드트립 테스트 포함).

검증:
- cargo test --lib 1125 passed (신규 GREEN +1)
- test_roundtrip_group_picture_child 통과
- 회귀 0 (issue_505/530/546/418/501/svg_snapshot)
- cargo clippy --lib 0 건

작업지시자 의견 정합 (HWP 직렬화 영역, PR #553 close 시 명시).
@edwardkim
Copy link
Copy Markdown
Owner

@oksure 님, 세 번째 PR 도 cherry-pick 머지로 devel 에 반영했습니다 (devel `146db57`).

머지된 commit

  • `21fe401` ← `8dc75f6` : fix: 그룹 내 그림(Picture) 직렬화 구현 + 라운드트립 테스트

author 는 @oksure 으로 보존되었습니다.

검증 (B 처리 — 직렬화 영역, 라운드트립 테스트로 결정적 검증)

  • `cargo test --lib` 1125 passed (신규 `test_roundtrip_group_picture_child` GREEN)
  • 회귀 0 (issue_505/530/546/418/501/svg_snapshot)
  • `cargo clippy --lib` 0 건

본 PR 은 직렬화 영역 (저장 시 누락 정정) 이라 SVG/web Canvas 시각 영향 없음 — 라운드트립 테스트로 결정적 검증 충분 (작업지시자 결정).

작업지시자 의견 정합

작업지시자 의견 (PR #553 close 시):

HWP 3.0 은 렌더링 뿐만 아니라 향후 시리얼라이제이션도 생각해야 합니다.

→ 본 PR 은 HWP5 직렬화 영역의 누락 정정. 작업지시자의 직렬화 본질 강조와 정합한 영역.

정합한 영역 인정

본 PR 의 정합한 영역 (PR #581/#582 에 이은 세 번째 모범 사례):

  1. PR fix: 그룹 내 그림(Picture) 직렬화 구현 #428 후속 정합 — 이전 PR 의 Copilot 리뷰 피드백 (라운드트립 테스트 부재) 정확히 반영. 컨트리뷰터의 정합한 워크플로우 학습
  2. 단일 commit + 작은 변경 (+92/-2, 2 files) — 본질 명확
  3. 신규 라운드트립 테스트 — `test_roundtrip_group_picture_child` (Group{Picture child} → serialize → parse → 모든 필드 보존 검증)
  4. 기존 그룹 자식 (Line/Rectangle/Ellipse/Chart/OLE) 과 동일 패턴 — 일관된 구조 정합
  5. 별도 fork branch (`contrib/fix-group-picture-serialize-v2`) — 본 사이클 패턴 정합

컨트리뷰터께 부탁드리는 사항 — devel 동기화

세 번째 PR 도 PR #581/#582 와 같은 오래된 base (`30351cdf`) 로 분기되어 있어 PR diff stat 에 본 환경 최근 변경분이 "삭제" 로 표시되었지만 본 commit 의 실제 변경은 2 files 정합.

다음 PR 작업 전 본 환경 `devel` 동기화 부탁드립니다 — PR #581 close 댓글의 절차 참조:

```bash
git fetch upstream
git checkout devel
git pull --ff-only upstream devel
git push origin devel
git checkout -b contrib/your-next-task
```

base 동기화하면 다음 PR 의 변경 stat 이 본질 commit 만 표시되어 검토가 더 정합합니다.

처리 보고서

`mydocs/pr/archives/pr_583_report.md`

세 번 연속 매우 정합한 PR입니다. PR #428 의 Copilot 피드백을 정확히 반영하신 점도 매우 인상적이었습니다.

@edwardkim edwardkim closed this May 4, 2026
edwardkim added a commit that referenced this pull request May 4, 2026
- mydocs/pr/pr_583_report.md → archives/

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
edwardkim pushed a commit that referenced this pull request May 4, 2026
# Conflicts:
#	Cargo.toml
#	mydocs/orders/20260420.md
#	src/document_core/queries/rendering.rs
#	src/lib.rs
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