Skip to content

fix(reverse_sync): preserved anchor 리스트의 아이템 제거를 XHTML에 반영합니다#978

Merged
jk-kim0 merged 7 commits intomainfrom
fix/reverse-sync-list-item-removal
Apr 3, 2026
Merged

fix(reverse_sync): preserved anchor 리스트의 아이템 제거를 XHTML에 반영합니다#978
jk-kim0 merged 7 commits intomainfrom
fix/reverse-sync-list-item-removal

Conversation

@jk-kim0
Copy link
Copy Markdown
Contributor

@jk-kim0 jk-kim0 commented Apr 3, 2026

Summary

  • numbered list에서 빈 항목(12.)을 제거하고 이전 항목에 병합할 때, preserved anchor(<ac:image>)가 있는 리스트의 XHTML 패치가 누락되는 버그를 수정합니다.
  • _build_list_item_merge_patch 함수 추가: 아이템 수 변경 시 XHTML DOM을 직접 조작하여 <li> 병합/제거 수행
  • 재현: page 798064641 (integrating-with-email.mdx)

원인

  • XHTML에 <ac:image> 포함 → _contains_preserved_anchor_markup True → should_replace_clean_list False
  • sidecar_block_requires_reconstruction False (reconstruction metadata 없음)
  • text-level 패치 경로로 진입하나, 리스트 아이템 구조 변경(삭제/병합)은 처리 불가
  • 결과: 빈 <li> 제거 안 됨 → FC가 12. 재생성

수정 내용

  • _count_mdx_list_items: MDX 리스트의 indent 레벨별 아이템 수 계산
  • _build_list_item_merge_patch: preserved anchor 리스트에서 아이템 제거 시 원본 XHTML DOM 직접 조작
    • 제거된 <li>의 자식(<ac:image> 등)을 이전 <li>로 이동
    • <p> 제거하여 불필요한 <br/> 방지
    • 텍스트 변경은 _apply_text_changes로 처리
  • text-level 패치 경로 진입 전에 아이템 수 변경 감지 → DOM 조작 경로로 분기

Test plan

  • pytest 단위 테스트 (TestListItemRemovalWithPreservedAnchor)
  • 셸 통합 테스트 (798064641, expected_status: pass)
  • 전체 로컬 테스트 통과 (pytest 935, convert 21, skeleton 18, reverse-sync 42, bugs 42, image-copy 1, xhtml-diff 15, byte-verify 42, render 21)

🤖 Generated with Claude Code

numbered list에서 빈 항목(12.)을 제거하고 이전 항목에 병합할 때,
preserved anchor(<ac:image>)가 있는 리스트의 XHTML 패치가 누락되는 현상을 재현합니다.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
querypie-docs Ready Ready Preview, Comment Apr 3, 2026 4:06pm

Request Review

jk-kim0 and others added 2 commits April 4, 2026 00:29
numbered list에서 빈 항목(12.)을 제거하고 이전 항목에 병합할 때,
preserved anchor(<ac:image>)가 있는 리스트의 XHTML 패치가 누락되는
문제를 수정합니다.

- _build_list_item_merge_patch: 아이템 수 변경 시 XHTML DOM 직접 조작
- 제거된 아이템의 <ac:image> 등을 이전 아이템으로 이동
- 빈 <p> 제거하여 불필요한 <br/> 방지
- 텍스트 변경은 _apply_text_changes로 처리

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jk-kim0 jk-kim0 marked this pull request as ready for review April 3, 2026 15:30
@jk-kim0 jk-kim0 changed the title fix(reverse_sync): numbered list 항목 제거가 XHTML에 반영되지 않는 문제를 수정합니다 fix(reverse_sync): preserved anchor 리스트의 아이템 제거를 XHTML에 반영합니다 Apr 3, 2026
jk-kim0 and others added 2 commits April 4, 2026 00:33
git show main:src/content/...로 덮어써서 의도치 않게 변경된 fixture를
원래 테스트케이스 생성 시의 내용으로 복원합니다.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
기존 fixture에서 12. 제거만 반영하고, 의도치 않은 콜론 공백 변경을 복원합니다.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- isu_001 (confluence-mdx/bin/reverse_sync/patch_builder.py:463): 여기서는 삭제 여부를 들여쓰기별 개수 감소로만 계산한 뒤, 같은 depth의 모든 <ol>/<ul>에서 마지막 <li>를 병합합니다. 그래서 preserved anchor가 있는 항목이 중간에서 삭제되거나 같은 depth의 하위 리스트가 둘 이상 있으면 실제로 바뀌지 않은 마지막 항목까지 함께 병합되어 XHTML이 잘못 생성됩니다.
- isu_002 (confluence-mdx/bin/reverse_sync/xhtml_patcher.py:377): bold 제거와 경계 이동은 처리하지만, bold 추가(len(new) > len(old))는 return으로 무시됩니다. preserved anchor를 포함하는 p에서 새로운 bold 서식을 추가하는 MDX 편집은 이 함수에 도달하지만, 아무 변경 없이 반환되어 bold 적용이 누락됩니다.
@jk-kim0
Copy link
Copy Markdown
Contributor Author

jk-kim0 commented Apr 3, 2026

[debate-review][sha:8d12fe87308c17152ddea1a78869d09c462da2b1] Consensus reached after 5 rounds.

Debate Summary

  • isu_001 [accepted] 여기서는 삭제 여부를 들여쓰기별 개수 감소로만 계산한 뒤, 같은 depth의 모든
      /
        에서 마지막
      • 를 병합합니다. 그래서 preserved anchor가 있는 항목이 중간에서 삭제되거나 같은 depth의 하위 리스트가 둘 이상 있으면 실제로 바뀌지 않은 마지막 항목까지 함께 병합되어 XHTML이 잘못 생성됩니다.
      • isu_002 [accepted] bold 제거와 경계 이동은 처리하지만, bold 추가(len(new) > len(old))는 return으로 무시됩니다. preserved anchor를 포함하는 p에서 새로운 bold 서식을 추가하는 MDX 편집은 이 함수에 도달하지만, 아무 변경 없이 반환되어 bold 적용이 누락됩니다.

      Applied Fixes

      • confluence-mdx/bin/reverse_sync/patch_builder.py:463 - (reported by codex, applied by codex) 여기서는 삭제 여부를 들여쓰기별 개수 감소로만 계산한 뒤, 같은 depth의 모든
          /
            에서 마지막
          • 를 병합합니다. 그래서 preserved anchor가 있는 항목이 중간에서 삭제되거나 같은 depth의 하위 리스트가 둘 이상 있으면 실제로 바뀌지 않은 마지막 항목까지 함께 병합되어 XHTML이 잘못 생성됩니다.
          • confluence-mdx/bin/reverse_sync/xhtml_patcher.py:377 - (reported by cc, applied by None) bold 제거와 경계 이동은 처리하지만, bold 추가(len(new) > len(old))는 return으로 무시됩니다. preserved anchor를 포함하는 p에서 새로운 bold 서식을 추가하는 MDX 편집은 이 함수에 도달하지만, 아무 변경 없이 반환되어 bold 적용이 누락됩니다.

@jk-kim0 jk-kim0 self-assigned this Apr 3, 2026
@jk-kim0 jk-kim0 merged commit ba0a833 into main Apr 3, 2026
7 checks passed
@jk-kim0 jk-kim0 deleted the fix/reverse-sync-list-item-removal branch April 3, 2026 16:29
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.

1 participant