refactor(reverse-sync): Sidecar 전용 매칭으로 전환 — fuzzy matching 제거#688
Merged
refactor(reverse-sync): Sidecar 전용 매칭으로 전환 — fuzzy matching 제거#688
Conversation
## Description - `build_patches()`에 sidecar 직접 조회(O(1))를 primary 매칭으로 추가합니다. - Sidecar로 parent mapping을 찾은 후, child 해석을 통해 개별 자식 매핑으로 정확히 대응합니다. - Child 해석 실패 시 (list/table 블록 등) 기존 fuzzy matching으로 자연스럽게 fallback합니다. - `run_verify()`에서 `generate_sidecar_mapping()`으로 on-the-fly sidecar를 생성하여 `build_patches()`에 전달합니다. ### 매칭 흐름 1. Phase 1: Sidecar 직접 조회 → parent일 경우 child 해석 (4단계: 완전 일치, 공백 무시, 리스트 마커 제거) 2. Phase 2: Fuzzy matching fallback (`find_mapping_by_text()`) 3. Phase 3: Sub-block 분리 매칭 (list item, table row, containing mapping) ### 기존 동작과의 호환성 - `mdx_to_sidecar`, `xpath_to_mapping` 파라미터는 Optional (None이면 기존 fuzzy matching만 사용) - 기존 `build_patches()` 호출부는 변경 없이 동작 ## Related tickets & links - #685, #687 (sidecar_lookup.py 모듈) ## Added/updated tests? - [x] No, and this is why: 기존 241개 pytest + 16개 reverse-sync 통합 테스트가 모두 통과하여 회귀 없음 확인 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
block_matcher.py(138줄) 삭제 — find_mapping_by_text, find_containing_mapping 제거. build_patches()의 3단계 매칭(sidecar → fuzzy → sub-block)을 1단계(sidecar O(1) 조회 + child 해석 + containing fallback)으로 간소화. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
child 해석 성공/실패, unmapped block skip, list item sidecar 매칭 등 리팩토링으로 추가된 5개 분기 경로에 대한 테스트 커버리지 확보. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fuzzy matching 제거 후 변경된 패치 결과에 맞추어 expected.reverse-sync.* golden file 5개를 재생성. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…결과로 갱신 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
block_matcher.py삭제 (138줄) —find_mapping_by_text(),find_containing_mapping()제거build_patches()매칭을 3단계(sidecar → fuzzy → sub-block)에서 1단계(sidecar O(1) 조회) 로 간소화build_list_item_patches(),build_table_row_patches()도 sidecar 기반으로 전환매칭 흐름 (변경 후)
변경 파일
patch_builder.pyblock_matcher.pytest_reverse_sync_cli.pytest_reverse_sync_e2e.py전체 LOC 변화
Test plan
Related
🤖 Generated with Claude Code