Skip to content

[debate: failed] fix(reverse_sync): code span 뒤 공백이 소실되는 문제를 수정합니다#979

Open
jk-kim0 wants to merge 3 commits intomainfrom
fix/reverse-sync-code-span-trailing-space
Open

[debate: failed] fix(reverse_sync): code span 뒤 공백이 소실되는 문제를 수정합니다#979
jk-kim0 wants to merge 3 commits intomainfrom
fix/reverse-sync-code-span-trailing-space

Conversation

@jk-kim0
Copy link
Copy Markdown
Contributor

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

Summary

  • _apply_text_changes의 gap whitespace 축소 로직에서, gap 전체가 노드의 leading whitespace인 경우 leading = gap_new로 조정하도록 변경합니다
  • 기존에는 gap이 축소되면 leading을 전부 제거하여, <code>{{..}}</code><span> 안의</span> 구조에서 span 선행 공백이 소실되었습니다
  • 테스트케이스 883654669 (Slack DM 연동) 추가

Root Cause

collapse_ws가 XHTML text의 연속 공백을 1개로 축소한 후, _apply_text_changes의 gap 분석 로직이 이 축소를 감지하여 노드의 leading whitespace를 전부 제거했습니다. gap이 노드 자체의 leading whitespace인 경우에는 축소된 만큼만 조정해야 합니다.

Test plan

  • make test-reverse-sync-bugs-one TEST_ID=883654669 PASS
  • make test-reverse-sync-bugs — 43 passed, 0 failed
  • make test-convert — 21 passed
  • make test-reverse-sync — 43 passed
  • make test-skeleton — 18 passed
  • make test-image-copy — 1 passed
  • make test-xhtml-diff — 15 passed
  • make test-byte-verify — 21 passed
  • make test-render — 21 passed
  • pytest — 959 passed (1 pre-existing failure)

🤖 Generated with Claude Code

@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 4, 2026 11:42am

Request Review

@jk-kim0
Copy link
Copy Markdown
Contributor Author

jk-kim0 commented Apr 4, 2026

[debate-review][sha:bee8454fbfba5b34451cf65f94a769e9601feb34] Consensus reached after 2 rounds.

No actionable issues remain.

@jk-kim0
Copy link
Copy Markdown
Contributor Author

jk-kim0 commented Apr 4, 2026

[debate-review][sha:0f41c45496e5bb8f5999cf30282f4e719a8c8ac8] Consensus reached after 3 rounds.

Debate Summary

  • isu_001 [withdrawn] gap이 이전 노드의 trailing 공백과 현재 노드의 leading 공백에 걸쳐 있을 때, len(gap_old) > len(leading) 조건으로 leading을 전부 제거하면 trailing_in_range가 trailing도 흡수하여 총 공백이 0이 되는 엣지 케이스가 존재합니다. 예: X 안의에서 gap 2→1 축소 시 두 노드 모두 공백이 제거됩니다.

Withdrawn Findings

  • confluence-mdx/bin/reverse_sync/xhtml_patcher.py:684 - gap이 이전 노드의 trailing 공백과 현재 노드의 leading 공백에 걸쳐 있을 때, len(gap_old) > len(leading) 조건으로 leading을 전부 제거하면 trailing_in_range가 trailing도 흡수하여 총 공백이 0이 되는 엣지 케이스가 존재합니다. 예: X 안의에서 gap 2→1 축소 시 두 노드 모두 공백이 제거됩니다.
    Reason: 현재 코드와 base 코드에서 동일하게 재현되는 기존 문제라서 이번 PR diff가 도입한 신규 이슈로 볼 수 없습니다.

jk-kim0 added a commit that referenced this pull request Apr 4, 2026
## Summary

- `navigable_string_as_markdown()`에서 `re.sub(r'\s+', ' ', text)` 연속 공백
정규화를 제거합니다
- HTML과 Markdown/MDX 모두 렌더링 시 연속 공백을 단일 공백으로 표시하므로, FC 변환 단계의 정규화는
불필요합니다
- 이 정규화는 XHTML 원본의 공백 정보를 손실시켜, reverse-sync 파이프라인에서 `collapse_ws` 보상
로직과 gap 공백 축소 등 불필요한 복잡도를 유발합니다 (PR #979 참조)

## 변경 내용

- `bin/converter/context.py`: 연속 공백 정규화 2줄 제거
- 7개 테스트케이스의 `expected.mdx` 및 `expected.roundtrip.json` 업데이트

## 이력

이 정규화는 2025-07-25 PR #34 (`a0da79dd`)에서 `as_markdown()` 함수 추출 시 방어적으로
추가된 것으로, 특정 버그 수정이 아닌 HTML 텍스트 노드의 일반적인 공백 정규화 목적이었습니다.

## Test plan

- [x] 변환 테스트 21/21 통과
- [x] pytest 938 passed
- [x] reverse-sync 통합 테스트 42/42 통과

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
jk-kim0 and others added 2 commits April 4, 2026 20:35
_apply_text_changes의 gap whitespace 축소 로직에서, gap 전체가 노드의
leading whitespace인 경우(gap_old <= leading) 축소된 gap만큼만 leading을
조정하도록 변경합니다. 기존에는 gap이 축소되면 leading을 전부 제거하여,
<code>{{..}}</code><span>  안의</span> 구조에서 span 선행 공백이 소실되었습니다.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
<code>{{..}}</code><span>  안의</span> 구조에서 gap이 2→1로 축소될 때
leading이 전부 제거되는 버그를 재현하는 테스트케이스입니다.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jk-kim0 jk-kim0 force-pushed the fix/reverse-sync-code-span-trailing-space branch from 0f41c45 to 25b9f57 Compare April 4, 2026 11:35
FC가 이중 공백을 보존하므로 original.mdx, improved.mdx의
`{{..}}` 뒤 공백을 1→2로 맞춥니다.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jk-kim0
Copy link
Copy Markdown
Contributor Author

jk-kim0 commented Apr 4, 2026

[debate-review][sha:5abda6e94b92c4b0e025ab504a0380d60d87a731] Consensus reached after 2 rounds.

No actionable issues remain.

@jk-kim0 jk-kim0 changed the title fix(reverse_sync): code span 뒤 공백이 소실되는 문제를 수정합니다 [debate: failed] fix(reverse_sync): code span 뒤 공백이 소실되는 문제를 수정합니다 Apr 4, 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