Skip to content

confluence-mdx: flat list inline 마커 경계 변경 감지 정밀화 및 content-only 변경 제외#852

Merged
jk-kim0 merged 2 commits intomainfrom
fix/reverse-sync-bold-boundary-change
Feb 25, 2026
Merged

confluence-mdx: flat list inline 마커 경계 변경 감지 정밀화 및 content-only 변경 제외#852
jk-kim0 merged 2 commits intomainfrom
fix/reverse-sync-bold-boundary-change

Conversation

@jk-kim0
Copy link
Contributor

@jk-kim0 jk-kim0 commented Feb 25, 2026

Summary

  • flat list에서 inline 마커 경계 이동 시 new_inner_xhtml 재생성하도록 수정합니다.
  • _flat_inline_change 판단에서 마커 내부 content만 변경된 경우(예: bold 안 띄어쓰기 교정)를 제외하여, <ac:image> 등 XHTML 고유 요소가 소실되지 않도록 합니다.
  • has_inline_boundary_change 함수를 도입하여 type 추가/제거 및 마커 간 텍스트 변경(경계 이동)만 감지합니다.

Test plan

  • test_reverse_sync_patch_builder.py — 103건 통과
  • make test-reverse-sync — 16건 통과 (880181257 포함)
  • make test-convert / test-skeleton / test-image-copy / test-xhtml-diff / test-byte-verify / test-render — 전체 통과
  • CI 확인

🤖 Generated with Claude Code

@vercel
Copy link

vercel bot commented Feb 25, 2026

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

Project Deployment Actions Updated (UTC)
querypie-docs Ready Ready Preview, Comment Feb 25, 2026 5:09pm

Request Review

## Description
- flat list의 inline 포맷 감지를 `has_inline_marker_added`에서 `has_inline_format_change`로 변경합니다.
- `has_inline_marker_added`는 마커 type 추가/제거만 감지하여, bold 경계 이동(`**after :**` → `**after**  :`) 등
  마커 content 변경을 놓쳤습니다.
- `has_inline_format_change`는 마커 content 변경과 마커 간 텍스트 변경도 감지하여,
  text-only 패치로 처리 불가한 구조 변경을 올바르게 포착합니다.

### Background
`external-api-changes-9100-version.mdx`의 `**after :**` → `**after**  :` 변경에서
bold 내부의 colon이 bold 외부로 이동해야 하지만, 기존 `has_inline_marker_added`는
bold type이 양쪽 모두 존재하므로 변경을 감지하지 못했습니다.
같은 수정으로 `9.12.0-9.12.14.mdx`의 inline code 경계 확장 문제도 해결됩니다.

## Added/updated tests?
- [x] Yes
  - `test_flat_list_bold_boundary_change_generates_inner_xhtml` — bold 경계 변경 시 new_inner_xhtml 생성 확인

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
_flat_inline_change 판단 시 has_inline_format_change 대신
has_inline_boundary_change를 사용하여 마커 내부 content만 변경된
경우(예: bold 안의 띄어쓰기 교정)에 전체 리스트 inner XHTML이
재생성되지 않도록 수정합니다. 이로 인해 <ac:image> 등 XHTML 고유
요소가 소실되는 문제를 해결합니다.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jk-kim0 jk-kim0 changed the title confluence-mdx: flat list에서 inline 마커 경계 변경 시 new_inner_xhtml 재생성하도록 수정 confluence-mdx: flat list inline 마커 경계 변경 감지 정밀화 및 content-only 변경 제외 Feb 25, 2026
@jk-kim0 jk-kim0 merged commit 9813379 into main Feb 25, 2026
7 checks passed
@jk-kim0 jk-kim0 deleted the fix/reverse-sync-bold-boundary-change branch February 25, 2026 17:10
jk-kim0 added a commit that referenced this pull request Feb 26, 2026
## Summary

\`patch_builder.py\` (719줄)를 책임 단위로 분해하여 유지보수성을 개선합니다. **동작 변경 없음** — 함수
이동 + import 변경만 수행합니다.

### 변경 내용

| 구분 | 내용 |
|------|------|
| R8 | \`NON_CONTENT_TYPES\` 상수를 \`block_diff.py\`로 통합 (6곳 → 1곳 정의) |
| R7 | \`xhtml_patcher.py\`의 \`_iter_block_children()\` 중복 제거
(\`mapping_recorder.py\` import) |
| R4 | \`patch_builder.py\` (719줄) → 3개 모듈 분리 |

### 신규 모듈

| 모듈 | 추출 내용 |
|------|-----------|
| \`inline_detector.py\` | 인라인 포맷 변경 감지 6개 함수 + regex 4개 |
| \`list_patcher.py\` | 리스트 블록 패치 4개 함수 (\`_resolve_child_mapping\`,
\`split_list_items\`, \`extract_list_marker_prefix\`,
\`build_list_item_patches\`) |
| \`table_patcher.py\` | 테이블 블록 패치 4개 함수 (\`is_markdown_table\`,
\`split_table_rows\`, \`normalize_table_row\`,
\`build_table_row_patches\`) |

\`patch_builder.py\` 잔여: 342줄 (719줄 → 342줄, 52% 감소)

### Rebase 시 main 변경 사항 반영 (#852)

main 브랜치 rebase 과정에서
[#852](https://github.com/querypie/querypie-docs/pull/852)의 인라인 감지 정밀화
변경을 \`inline_detector.py\`에 통합했습니다.

- \`has_inline_marker_added\` (type 추가/제거만 감지) →
\`has_inline_boundary_change\`로 교체
  - 기존: 마커 type 목록 변경만 감지
  - 변경: 마커 type 변경 **또는** 연속된 마커 사이 텍스트 변경(경계 이동)을 감지
- \`list_patcher.py\`의 \`build_list_item_patches\`도 동일하게 갱신

## Test plan

- [x] 매 Task 완료 후 전체 테스트 실행
- [x] main rebase 후 최종 \`python3 -m pytest tests/ -q
--ignore=tests/test_unused_attachments.py\` → **735 passed** (main 신규
테스트 5개 포함)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
jk-kim0 added a commit that referenced this pull request Feb 26, 2026
## Description

- `reverse_sync`에서 callout 매크로(`panel`, `info`, `note` 등) 내부 텍스트 변경이
패치되지 않는 버그를 수정합니다.
- 페이지 544375505 (`menu-improvement-guide-9120.mdx`)에서 발견된 문제입니다.

### Background

3가지 계층에서 동시에 문제가 발생했습니다:

1. **`mapping_recorder.py`**: callout 매크로의 `xhtml_plain_text` 추출 시
`<ac:parameter>` 메타데이터(`:purple_circle:`, `#F4F5F7` 등)가 포함되고,
`<ac:emoticon>`의 fallback 텍스트(`🔎`)가 누락되어 sidecar 텍스트 매칭이 실패
2. **`sidecar.py` / `patch_builder.py`**: emoticon 차이로 인한 텍스트 불일치를 허용하는
짧은 prefix 매칭 패스가 없어 매핑 실패
3. **`xhtml_patcher.py`**: modify 검증에서 `element.get_text()`를 사용하여
emoticon fallback 텍스트가 빠진 채 비교, 패치 적용이 skip됨

### 수정 내용

- `mapping_recorder.py`: `_get_text_with_emoticons()` 헬퍼 추가, callout
매크로는 `<ac:rich-text-body>`에서만 텍스트 추출
- `sidecar.py`: `_find_text_match`에 4차 짧은 prefix 포함 매칭 패스 추가
- `patch_builder.py`: `_resolve_child_mapping`에 5차 prefix 매칭 패스 추가
- `xhtml_patcher.py`: modify 검증을 `_get_text_with_emoticons()` 사용으로 변경

## Related tickets & links

- `bin/reverse_sync_cli.py verify
--branch=split/ko-proofread-20260221-release-notes` 실패 6건 중 마지막 건
- 관련 PR: #850, #851, #852 (동일 verify 배치의 Bug 1-5 수정)

## Added/updated tests?

- [x] Yes
- `test_callout_panel_excludes_parameter_metadata`: panel callout의
`xhtml_plain_text`에서 파라미터 메타데이터 제외 검증
- `test_callout_includes_emoticon_fallback_text`: `<ac:emoticon>`
fallback 텍스트 포함 검증
- `test_short_prefix_match_with_emoticon_difference`: emoticon 차이 시 짧은
prefix 매칭 검증
  - `test_short_prefix_match_with_metadata_prefix`: 메타데이터 prefix 매칭 검증
- `test_callout_panel_with_emoticon_maps_to_mdx`: panel+emoticon 통합
sidecar 매핑 검증

## Additional notes

- 전체 테스트 433건 통과 (신규 5건 포함)
- verify 결과: 핵심 텍스트 변경("9.12.0부터")은 정상 적용, `🔎` 앞 공백 정규화 차이(double
space)만 잔존 (Bug 4와 동일 유형의 XHTML round-trip 정규화)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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