Skip to content

confluence-mdx: Phase 2 + Phase 3 — clean block replacement 및 inline-anchor 재구성#902

Open
jk-kim0 wants to merge 9 commits intomainfrom
jk/feat-sidecar-type-based-with-fixes
Open

confluence-mdx: Phase 2 + Phase 3 — clean block replacement 및 inline-anchor 재구성#902
jk-kim0 wants to merge 9 commits intomainfrom
jk/feat-sidecar-type-based-with-fixes

Conversation

@jk-kim0
Copy link
Contributor

@jk-kim0 jk-kim0 commented Mar 11, 2026

Phase 2: Clean block whole-fragment replacement

paragraph/heading/code/table 등 XHTML 비보존 요소를 포함하지 않는 "clean block"에 대해 MDX를 XHTML로 재변환하여 전체 fragment를 교체하는 replace_fragment patch action을 구현합니다.

변경 파일:

  • bin/reverse_sync/patch_builder.pyreplace_fragment 패치 생성 로직
  • bin/reverse_sync/xhtml_patcher.pyreplace_fragment 액션 처리
  • bin/reverse_sync/sidecar.py — RoundtripSidecar v3 reconstruction 메타데이터
  • tests/test_reverse_sync_reconstruction_goldens.py — golden test 2개

Phase 3: Inline-anchor (ac:image) 재구성

paragraph 내부의 ac:image를 보존하면서 텍스트 변경을 반영하는 reconstruction pipeline을 구현합니다.

핵심 흐름:

  1. sidecar.py: _build_anchor_entries로 paragraph의 ac:image 위치(offset + raw XHTML)를 sidecar에 기록
  2. reconstructors.py (신규): difflib 기반 offset 매핑 + DOM 삽입 helper
  3. patch_builder.py: anchors가 있는 paragraph에 reconstruction 경로 연동

변경 파일:

  • bin/reverse_sync/sidecar.py_build_anchor_entries 추가, _build_reconstruction_metadata 갱신
  • bin/reverse_sync/reconstructors.py (신규) — map_anchor_offset, insert_anchor_at_offset, reconstruct_inline_anchor_fragment
  • bin/reverse_sync/patch_builder.py — inline-anchor reconstruction 경로 추가
  • tests/test_reverse_sync_reconstruction_goldens.py — 파서 불일치 수정 + golden test 10개
  • tests/test_reverse_sync_reconstruct_paragraph.py (신규) — unit + integration test

Test Plan

  • python3 -m pytest tests/ -q — 886 tests all pass
  • test_reverse_sync_reconstruction_goldens.py — 10개 golden test 모두 green
  • test_reverse_sync_reconstruct_paragraph.py — unit/integration test 모두 green

🤖 Generated with Claude Code

@vercel
Copy link

vercel bot commented Mar 11, 2026

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

Project Deployment Actions Updated (UTC)
querypie-docs Ready Ready Preview, Comment Mar 15, 2026 6:57am

Request Review

@jk-kim0 jk-kim0 self-assigned this Mar 12, 2026
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-with-fixes branch from d12dd8a to 9b4a715 Compare March 12, 2026 12:01
@jk-kim0 jk-kim0 changed the base branch from main to jk/feat-sidecar-type-based-core March 12, 2026 14:09
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-with-fixes branch 2 times, most recently from 5439392 to 51b8c40 Compare March 12, 2026 14:22
@jk-kim0 jk-kim0 changed the title confluence-mdx: sidecar 타입 기반 매핑 — 버그 수정 및 단위 테스트 추가 fix(reverse_sync): 헤딩 공백 변경 XHTML 전파 방지 및 normalize_mdx_to_plain trailing space 수정 Mar 12, 2026
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-with-fixes branch from 51b8c40 to c92817d Compare March 12, 2026 14:31
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-core branch from 710a8e6 to 55bd453 Compare March 12, 2026 14:41
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-with-fixes branch from c92817d to 3be48ec Compare March 12, 2026 14:41
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-with-fixes branch from 3be48ec to 3ffb486 Compare March 12, 2026 14:48
Base automatically changed from jk/feat-sidecar-type-based-core to main March 12, 2026 16:05
@jk-kim0 jk-kim0 closed this Mar 15, 2026
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-with-fixes branch from 3ffb486 to 9e0d43b Compare March 15, 2026 03:30
@jk-kim0 jk-kim0 reopened this Mar 15, 2026
@jk-kim0 jk-kim0 changed the title fix(reverse_sync): 헤딩 공백 변경 XHTML 전파 방지 및 normalize_mdx_to_plain trailing space 수정 confluence-mdx: Phase 2 — clean block whole-fragment replacement Mar 15, 2026
@jk-kim0 jk-kim0 force-pushed the jk/feat-sidecar-type-based-with-fixes branch from 651cf24 to 8df7202 Compare March 15, 2026 05:26
jk-kim0 and others added 9 commits March 15, 2026 15:20
…anchor entry 추출 구현

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…se로 p 탐색 범위 제한

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lper 구현

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t tracking 수정

find(string=) 검색 대신 직접 참조(pivot)를 유지하여 동일 텍스트가 여러 번
나타날 때 잘못된 노드를 찾는 문제와 find('ac:image')가 다른 이미지를 찾는
문제를 수정합니다.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…경로 연동

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jk-kim0 jk-kim0 reopened this Mar 15, 2026
@jk-kim0 jk-kim0 changed the title confluence-mdx: Phase 2 — clean block whole-fragment replacement confluence-mdx: Phase 2 + Phase 3 — clean block replacement 및 inline-anchor 재구성 Mar 15, 2026
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