Skip to content

confluence-mdx: reverse_sync callout 매크로 패치 누락 수정#853

Open
jk-kim0 wants to merge 2 commits intomainfrom
fix/reverse-sync-callout-patch
Open

confluence-mdx: reverse_sync callout 매크로 패치 누락 수정#853
jk-kim0 wants to merge 2 commits intomainfrom
fix/reverse-sync-callout-patch

Conversation

@jk-kim0
Copy link
Contributor

@jk-kim0 jk-kim0 commented Feb 25, 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

Added/updated tests?

  • 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

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

@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:35pm

Request Review

## Description
- Callout 매크로(`<ac:structured-macro ac:name="panel">`)의 `xhtml_plain_text`에서
  파라미터 메타데이터(`:purple_circle:`, `1f7e3`, `🟣`, `#F4F5F7` 등)를 제외하고
  `<ac:rich-text-body>` 내 body 텍스트만 추출하도록 수정합니다.
- `<ac:emoticon>` 태그의 `ac:emoji-fallback` 속성값(🔎 등)을 텍스트에 포함하는
  `_get_text_with_emoticons()` 헬퍼를 추가합니다. MDX에서 리터럴 이모지로 표현되는
  emoticon을 XHTML 측에서도 동일하게 포함시켜 텍스트 매칭을 가능하게 합니다.
- `_find_text_match` 4차 pass 추가: 20자 짧은 prefix 포함 매칭으로
  emoticon/lost_info 차이가 있어도 매칭이 가능합니다.
- `_resolve_child_mapping` 5차 pass 추가: 앞부분 20자 prefix 비교로
  child paragraph를 emoticon 차이에도 불구하고 정확히 찾습니다.
- `xhtml_patcher`의 modify 검증에서 `get_text()` 대신 `_get_text_with_emoticons()`를
  사용하여 emoticon fallback 텍스트를 포함한 비교를 수행합니다.

### Background
페이지 544375505 (menu-improvement-guide-9120.mdx)에서 Callout 블록의 텍스트 변경이
XHTML에 패치되지 않는 문제가 있었습니다. 원인은 3가지였습니다:
1. `mapping_recorder`가 `get_text()`로 전체 매크로 텍스트를 추출하여 파라미터 메타데이터가
   `xhtml_plain_text`에 포함됨 → sidecar 텍스트 매칭 실패
2. `<ac:emoticon>` 태그가 self-closing으로 `get_text()`에서 이모지가 누락됨 →
   MDX 텍스트와 매칭 불일치
3. `xhtml_patcher`의 modify 검증에서 `get_text()` 결과가 `old_plain_text`와 다름 →
   패치가 skip됨

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- _resolve_child_mapping 5차 prefix 매칭에 길이 비율 검사를 추가합니다.
- callout 전체 텍스트가 내부 paragraph와 같은 prefix를 공유하는 경우,
  old_nospace가 child의 2배를 초과하면 잘못된 매칭으로 판단합니다.
- 기존: callout(238자)이 paragraph-30(40자)와 prefix 매칭되어
  list-31 내부 변경(지정시 → 지정 시)이 누락되었습니다.
- 수정: 길이 비율 > 2배이면 prefix 매칭에서 제외하고 containing
  strategy로 처리하여 두 변경이 모두 적용됩니다.
- 재현 테스트를 추가합니다 (test_prefix_match_rejects_long_text).

Co-Authored-By: Claude Sonnet 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