Skip to content

fix(ai): align F-4 chat tests with PR42 LLM routing - #43

Merged
HOKAGO-MEMORIES merged 1 commit into
developfrom
fix/ai-analysis-pr42-routing
Jun 23, 2026
Merged

fix(ai): align F-4 chat tests with PR42 LLM routing#43
HOKAGO-MEMORIES merged 1 commit into
developfrom
fix/ai-analysis-pr42-routing

Conversation

@HOKAGO-MEMORIES

@HOKAGO-MEMORIES HOKAGO-MEMORIES commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

변경 내용

  • PR feat(ai): 매물 추천 Text-to-SQL 및 LLM 기반 의도 분류 구현 (#29) #42 이후 agent chat 테스트가 키워드 분류 가정에 의존하지 않도록 수정
  • 각 Phase 1~3 관련 chat 테스트에서 LLMClient.classify()를 mock해 RouteDecision 기반 라우팅을 그대로 사용
  • property/search, legal, price, safety 분석 경로가 새 route_by_intent 흐름 위에서 검증되도록 정합화

참고

테스트

  • backend-ai: .\.venv\Scripts\python.exe -m pytest tests\test_agent_chat.py tests\test_classify_intent.py tests\test_spring_client.py
  • backend-ai: .\.venv\Scripts\python.exe -m pytest tests
  • git diff --check

Summary by CodeRabbit

  • Tests
    • Enhanced agent-chat test infrastructure with a new helper function that enables systematic testing of request routing to different intent handlers, including property search, legal consultation, price analysis, and safety analysis scenarios.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 16968e33-6f60-4e6c-badd-0f024d7ee43c

📥 Commits

Reviewing files that changed from the base of the PR and between 4f583b0 and ac314d2.

📒 Files selected for processing (1)
  • backend-ai/tests/test_agent_chat.py

📝 Walkthrough

Walkthrough

A route_as(monkeypatch, intent) helper is added to backend-ai/tests/test_agent_chat.py. It monkeypatches LLMClient.classify to return a fixed intent and clears the get_agent_graph cache. All existing agent-chat routing tests are updated to call this helper instead of only clearing the cache directly.

Changes

Deterministic Intent Routing in Tests

Layer / File(s) Summary
route_as helper and LLMClient import
backend-ai/tests/test_agent_chat.py
Imports LLMClient and defines route_as(monkeypatch, intent) which stubs LLMClient.classify to return a fixed intent with reasoning and clears get_agent_graph cache.
Apply route_as across all routing tests
backend-ai/tests/test_agent_chat.py
Updates test_agent_chat_returns_intent_and_answer to accept monkeypatch, and replaces bare get_agent_graph.cache_clear() calls with route_as(...) in the PROPERTY_SEARCH, LEGAL_CONSULT, PRICE_ANALYSIS (success and fallback), and SAFETY_ANALYSIS test setups.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 Hop, hop, the classify call is tamed,
A route_as helper takes the blame,
No more cache clears alone to trust—
Monkeypatch the LLM we must!
Fixed intents keep the tests on track,
This bunny won't look back. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating chat tests to align with PR42's LLM routing changes, replacing keyword classification assumptions with proper mocking.
Description check ✅ Passed The description covers all required template sections: changes made, related issue references, testing verification, and includes supporting context about PR #42 and project phase alignment.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ai-analysis-pr42-routing

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

@HOKAGO-MEMORIES
HOKAGO-MEMORIES merged commit 9a4f934 into develop Jun 23, 2026
1 check passed
@HOKAGO-MEMORIES
HOKAGO-MEMORIES deleted the fix/ai-analysis-pr42-routing branch June 25, 2026 07:57
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