DOCS/journey/troubleshooting/260203_intent_phase3_db_thompson_tests.md
2026-02-03 11:09:07 +09:00

1.5 KiB
Raw Blame History

의도 Phase 3: DB 접근 311 준수 + Thompson τ + Thompson pytest

날짜: 2026-02-03 작성자: happybell80 관련 파일: rb8001/app/services/brain/intent/action_planner.py, intent_store.py, intent_graph.py, tests/test_intent_thompson.py


변경 요약

  • ActionPlanner: psycopg2 및 직접 SQL 제거. 경로 통계 필요 시 intent_store.load_path_stats_params(intent_name) 사용 (311 계층 준수).
  • intent_store: get_thompson_thresholds(intent_name) 추가. path별 (α,β) 없으면 기본 τ(0.9, 0.7, 0.5) 반환; 있으면 Beta(α,β) 샘플로 τ 계산.
  • intent_graph: INTENT_USE_DYNAMIC_TAU=1일 때 fastpath/semantic 분기에서 get_thompson_thresholds 사용. =0이면 기존 하드코딩 τ.
  • 테스트: tests/test_intent_thompson.py 추가. get_thompson_thresholds 기본값·params·IntentGraph 동적 τ 호출 여부 검증 (315 pytest).

검증

  • pytest tests/test_intent_3step_architecture.py tests/test_intent_3step_scenarios.py tests/test_intent_thompson.py 15 passed.
  • rb8001 푸시 후 Gitea Actions 배포 완료, docker ps healthy, curl localhost:8001/health 200.

교훈

  • 311: services는 state를 통해서만 DB 접근. ActionPlanner의 직접 psycopg2 제거로 계층 준수.
  • Thompson τ는 데이터 없을 때 기본값 반환으로 롤백 부담 감소. 동적 τ는 INTENT_USE_DYNAMIC_TAU=0으로 비활성화 가능.
  • 315: τ 검증은 일회성 스크립트 대신 pytest로 유지해 지속 검증 가능.