refactor(reverse_sync_cli): 핵심 알고리즘 4개 모듈 분리 #679
Merged
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.
Summary
reverse_sync_cli.py(1,271줄)에 핵심 알고리즘 4개가 밀집되어 테스트·디버깅이 어려운 문제를 해결합니다.4개 모듈로 분리하여 단위 테스트 가능성을 확보하고, 후속 작업(정규화 테스트 매트릭스, 매칭 실패 로깅)의 기반을 마련합니다.
text_normalizer.py(70줄):normalize_mdx_to_plain,collapse_ws,strip_list_marker,EMOJI_RE,INVISIBLE_RE추출text_transfer.py(78줄):align_chars,find_insert_pos,transfer_text_changes추출block_matcher.py(137줄):find_mapping_by_text,find_containing_mapping추출patch_builder.py(296줄):build_patches,build_list_item_patches, table/list 헬퍼 함수 추출reverse_sync_cli.py에서 추출된 함수 제거 및 import 교체 (1,271→714줄)test_reverse_sync_cli.py,test_reverse_sync_e2e.py)의존성 방향 (비순환)
네이밍 변경
모듈 간 공개 API는
_prefix를 제거합니다 (예:_normalize_mdx_to_plain→normalize_mdx_to_plain).Test plan
PYTHONPATH=bin python -m pytest tests/ -v— 202 passed)cd tests && make test-reverse-sync)Related tickets & links
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 [email protected]