Skip to content

[Fix] 폴백 체인에서 지역 필터 해제 시 다른 도시/국가 장소가 일정에 포함되는 버그 수정#66

Merged
iamb0ttle merged 5 commits into
mainfrom
fix/geo-filter-fallback-leak
Apr 7, 2026
Merged

[Fix] 폴백 체인에서 지역 필터 해제 시 다른 도시/국가 장소가 일정에 포함되는 버그 수정#66
iamb0ttle merged 5 commits into
mainfrom
fix/geo-filter-fallback-leak

Conversation

@zweadfx

@zweadfx zweadfx commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

1. 개요

2. 작업 내용

  • _select_place_in_region에서 bbox 내 장소가 없을 때 places[0]을 무조건 반환하던 로직을 None 반환 + 슬롯 스킵으로 변경
  • 폴백 체인 Stage 4(bias_without_bbox_filter)에서 bbox 필터 없이 다른 지역 장소를 그대로 사용하던 블록 제거
  • 폴백 체인 Stage 5/6 무제약 검색 결과에도 _hard_filter_by_bbox 적용하여 bbox 밖 장소 유입 차단
  • 채팅 수정(mutate) 플로우에도 동일한 패턴으로 폴백 체인 취약점 수정

3. AI 활용 및 검증

  • AI가 생성한 코드 포함

  • 100% 직접 작성

  • 검증 방법:

    • 마드리드 LUXURY 3일 전체 파이프라인 실행 → 수정 전 서울 국립현대미술관 유입 재현, 수정 후 out_of_region=0 확인
    • 바르셀로나, 도쿄, 방콕 LUXURY 파이프라인 추가 검증 → 전체 out_of_region=0
    • 채팅 REPLACE 플로우("살라만카 지구 현대미술 갤러리로 바꿔줘") 실행 → out_of_region=0 확인
    • uv run pre-commit run --all-files 통과

4. 스크린샷 (선택)

5. 체크리스트

  • uv run pre-commit run --all-files를 실행하여 통과했는가?
  • 스스로 코드를 한 번 리뷰했는가? (AI가 짠 코드 맹신 금지)
  • 불필요한 주석이나 print 문을 제거했는가?

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • 지역 기반 검색 필터링의 정확성을 개선했습니다.
    • 사용자가 지정한 영역 외의 장소가 검색 결과에 포함되지 않도록 개선했습니다.
    • 검색 폴백 흐름을 최적화하여 더욱 일관성 있는 검색 결과를 제공합니다.

@zweadfx zweadfx self-assigned this Apr 7, 2026
@zweadfx zweadfx added the bug 정상 동작하지 않는 문제나 오류를 수정하는 작업 label Apr 7, 2026
@zweadfx zweadfx requested a review from iamb0ttle as a code owner April 7, 2026 00:55
@zweadfx

zweadfx commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

개요

이 변경 사항은 place 검색의 fallback 로직에서 bbox 필터링을 일관되게 적용하도록 리팩토링하고, 중간 상태로 보관되던 bias_unfiltered를 제거합니다. 세 개의 주요 파일에서 제어 흐름을 조정합니다.

변경 사항

Cohort / File(s) Summary
Fallback 검색 흐름 리팩토링
app/graph/chat/nodes/mutate.py
_search_place fallback 흐름에서 bias_unfiltered 중간 holder를 제거하고 bias_results로 대체. geo-anchored keyword 검색 분기를 추가하며, 각 단계에서 _hard_filter_by_bbox를 조건부로 적용하고 geo_filtered_out_count를 추적합니다.
Region 내 place 선택 로직 개선
app/graph/roadmap/nodes/finalize.py
_select_place_in_region이 geometry가 region_bbox에 속하지 않을 때 None을 반환하도록 변경. _prepare_final_contextNone 반환 시 continue로 slot 콘텐츠 추가를 건너뛰어 bbox 밖 결과가 context에 포함되지 않도록 합니다.
Unfiltered fallback 경로 재설계
app/graph/roadmap/nodes/places.py
지속적인 bias_unfiltered 리스트 상태와 관련 fallback 분기 제거. 변수명을 bias_no_price로 변경하고, unfiltered 검색 결과에 region_bbox 사용 시 _hard_filter_by_bbox를 선택적으로 적용하며 필터링 발생 시 geo_filtered_out_count를 추적합니다.

예상 코드 리뷰 난이도

🎯 4 (복잡) | ⏱️ ~45분

관련 가능성 있는 PR들

추천 검토자

  • iamb0ttle
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경사항인 폴백 체인의 지역 필터 누수 버그 수정을 명확하게 요약하고 있습니다.
Description check ✅ Passed PR 설명이 필수 섹션을 모두 포함하며 변경사항, 검증 방법, 체크리스트가 상세하게 작성되어 있습니다.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/geo-filter-fallback-leak

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@iamb0ttle iamb0ttle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zweadfx

zweadfx commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review stop

@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown

@zweadfx: Sure! I'll pause the automatic reviews for this PR.

✅ Actions performed

Reviews paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 정상 동작하지 않는 문제나 오류를 수정하는 작업

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants