confluence-mdx: reverse-sync 정확도 개선 및 테스트케이스 fixture 업데이트#895
Draft
confluence-mdx: reverse-sync 정확도 개선 및 테스트케이스 fixture 업데이트#895
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
638bfd2 to
b1e1514
Compare
c192fbc to
03dfd58
Compare
03dfd58 to
a656ad5
Compare
a656ad5 to
b0fc47a
Compare
16ec541 to
76a3fba
Compare
7302033 to
f7e30b2
Compare
This was referenced Mar 11, 2026
f7e30b2 to
f13ba08
Compare
…딩 공백 처리 - `bin/mdx_to_storage/inline.py`, `bin/reverse_sync/mdx_to_xhtml_inline.py`: inline code 변환 시 `html.escape()` 적용 - `<`, `>`, `&` 등 HTML 특수문자가 포함된 코드 스니펫이 XHTML에서 깨지는 문제를 수정합니다. - `bin/reverse_sync/list_patcher.py`, `bin/reverse_sync/xhtml_patcher.py`: `<ol start="N">` 속성 변경 감지 및 적용 - `_get_ordered_list_start()` 헬퍼를 추가하여 MDX 순서 목록의 시작 번호를 추출합니다. - 시작 번호가 변경된 경우 패치에 `ol_start` 필드를 포함하고, xhtml_patcher에서 `<ol start>` 속성을 갱신하거나 제거합니다. - `bin/reverse_sync/patch_builder.py`: 헤딩 공백 차이만 있는 변경을 XHTML에 전파하지 않음 - 레벨과 텍스트가 동일한 헤딩 변경(공백 차이만 있는 경우)은 건너뜁니다. - Confluence XHTML의 ` ` 등 고유 공백 문자가 손실되는 것을 방지합니다. - `bin/text_utils.py`: HTML 태그 제거로 인한 trailing space 아티팩트 제거 - 링크 텍스트의 genuine trailing space는 보존하고, 태그 제거로 생긴 공백만 제거합니다. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- `tests/test_reverse_sync_mdx_to_xhtml_inline.py`: inline code 내 HTML 특수문자 escape 테스트 추가 - `TestConvertInline`: `<`, `&` 포함 코드 스니펫의 escape 처리 검증 - `TestBlockConversion`: reverse-sync 경로(`mdx_block_to_inner_xhtml`)에서의 escape 처리 검증 - `tests/test_reverse_sync_xhtml_patcher.py`: `<ol start="N">` 속성 변경 테스트 추가 - `ol_start` 패치 필드로 `start` 속성을 설정하는 케이스 - `ol_start=1` 패치로 `start` 속성을 제거하는 케이스 - `tests/test_reverse_sync_patch_builder.py`: `TestHeadingWhitespaceSkip` 클래스 추가 - 공백 차이만 있는 헤딩 변경이 패치를 생성하지 않는 것 검증 - 실제 텍스트가 변경된 헤딩은 패치를 생성하는 것 검증 - `bin/text_utils.py`: trailing space 아티팩트 제거 로직 revert - `s_before_html` 비교를 통한 trailing space 제거는 특정 케이스만을 위한 해킹으로 판단하여 취소합니다. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- `reverse_sync_cli.py`: 패치된 XHTML의 forward 변환 전, `page.v1.yaml`을 `var/<page_id>/`로 복사합니다. Forward converter가 크로스 페이지 링크 해석 시 `page.v1.yaml`을 XHTML과 같은 디렉터리에서 읽으므로, 이를 보장합니다. - `roundtrip_verifier.py`: `_normalize_blank_line_after_blockquote()` 추가 — blockquote(`>`) 줄 바로 다음의 단일 빈 줄을 제거합니다. Forward converter가 blockquote 뒤에 빈 줄을 체계적으로 추가하므로, 비교 시 이를 정규화합니다. - 1454342158: `#unexpected-failure` 링크 → 정상 크로스 페이지 링크로 수정 - 1907294209: blockquote 뒤 빈 줄 차이 제거 → PASS - feature/type-based-sidecar-mapping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1. `bin/text_utils.py`: `normalize_mdx_to_plain`에서 HTML 태그 제거로 생긴 trailing space 아티팩트를 제거합니다. (링크 텍스트의 genuine trailing space는 보존) 2. `bin/reverse_sync/patch_builder.py`: heading 블록에서 레벨과 텍스트가 동일한 경우(공백 차이만 있는 경우) XHTML을 변경하지 않습니다. (` ` 등 XHTML 고유 공백 문자가 손실되는 것을 방지) 3. `tests/reverse-sync/*/improved.mdx`: WS_ONLY 테스트케이스 11건 trailing space, double space 등 whitespace 정규화 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
각 테스트케이스의 page.xhtml을 현재 버전의 forward converter로 변환하여 original.mdx와 mapping.yaml을 업데이트합니다. 이를 통해 테스트케이스가 현재 converter 버전의 출력을 정확하게 반영하게 됩니다. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- tests/reverse-sync/pages.yaml: 25개 미등록 테스트케이스 항목을 var/pages.yaml 에서 복사하여 추가합니다 - tests/reverse-sync/*/original.mdx: 전체 42개 케이스를 올바른 --attachment-dir 옵션으로 재생성합니다 - attachment-dir 는 pages.yaml 의 mdx_path 에서 유도하여 이미지 경로가 실제 문서 경로와 일치하게 합니다 - tests/reverse-sync/*/mapping.yaml: original.mdx 재생성에 따른 sidecar 매핑 업데이트 - tests/reverse-sync/README.md: page.xhtml → original.mdx 변환 가이드 문서 추가 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 543981760: improved.mdx의 HTML 테이블을 original.mdx 형식으로 복원합니다 - 544382364: <br/> 주변 blank line 누락 및 셀 내용 형식을 수정합니다 - 793608206: paragraph 텍스트 변경으로 round-trip 검증 가능하도록 수정합니다 - bin: list_patcher, xhtml_patcher, mdx_to_xhtml_inline, inline 개선사항 포함 - tests: page.v1.yaml 및 mapping.yaml 업데이트합니다 Co-Authored-By: Atlas <atlas@jk.agent>
- list_patcher.py: `_get_ordered_list_start` 중복 정의 제거 - roundtrip_verifier.py: 잉여 빈 줄 제거 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f13ba08 to
45ac5e5
Compare
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.
배경
PR #901(타입 기반 sidecar 매핑)이 main에 머지된 이후, 이 PR은 해당 변경과 함께
이전에 개발된 아래의 추가 개선사항 및 fixture 업데이트를 포함합니다.
변경 내용
코드 수정
patch_builder.py: 헤딩 공백 차이만 있는 변경을 XHTML에 전파하지 않음## foo→## foo같은 공백 차이만 있는 헤딩 변경은 건너뜁니다. 등 고유 공백 문자 손실 방지.roundtrip_verifier.py:_normalize_blank_line_after_blockquote()추가text_utils.py: HTML 태그 제거로 인한 trailing space 아티팩트 제거list_patcher.py,xhtml_patcher.py:<ol start="N">속성 변경 주석 추가단위 테스트
test_reverse_sync_patch_builder.py:TestHeadingWhitespaceSkip클래스 추가test_reverse_sync_xhtml_patcher.py:TestOlStartPatch기존 테스트 유지test_reverse_sync_mdx_to_xhtml_inline.py: inline code escape 테스트 추가테스트케이스 fixture 업데이트
original.mdx재생성 (현재 converter 기준)mapping.yaml파일 추가 (21개 케이스)page.v1.yaml픽스처 추가 (3개 케이스)improved.mdx파일 업데이트 (다수 케이스)_meta.ts파일 추가 (8개 케이스)검증
🤖 Generated with Claude Code