Skip to content

fix(qa): conversationKey dict→string 타입 불일치 수정 - #103

Merged
GoBeromsu merged 1 commit into
devfrom
feature/C-fix-qa-conversation-key
May 28, 2026
Merged

fix(qa): conversationKey dict→string 타입 불일치 수정#103
GoBeromsu merged 1 commit into
devfrom
feature/C-fix-qa-conversation-key

Conversation

@GoBeromsu

Copy link
Copy Markdown
Owner

Summary

  • Root cause: backend/routes/qa_routes.py:104에서 conversation_keydict로 생성했으나, agent 계약(docs/07-pi-agent-contracts.md:219)은 "${user_id}::${corp_code}" 형식의 string을 요구함. agentHttpCore.ts의 string 검증에서 에러 발생.
  • qa_routes.py: {"userId": ..., "corpCode": ...}f"{user_id}::{effective_corp_code}" (1줄 변경)
  • agent_qa_runtime.py: 파라미터 타입 annotation dict[str, str] | Nonestr | None (1줄 변경)
  • test_qa_routes_prior_turns.py: dict 형식 assertion → string 형식 assertion으로 갱신 (3줄 변경)

Test plan

  • pytest tests/test_pipeline_api.py -k qa → 10 passed
  • pytest tests/routes/test_qa_routes_prior_turns.py → 5 passed (총 15 passed)
  • agent npm run build → exit code 0 (tsc 에러 없음)

🤖 Generated with Claude Code

agent 계약(docs/07-pi-agent-contracts.md)은 conversationKey를
\"${user_id}::${corp_code}\" 형식의 string으로 정의하지만,
backend가 dict를 전달해 agentHttpCore.ts 검증에서 에러 발생.

qa_routes.py: conversation_key 생성을 f-string으로 변경
agent_qa_runtime.py: 파라미터 타입 annotation을 str | None으로 수정
test_qa_routes_prior_turns.py: 테스트 assertion을 string 형식에 맞게 갱신

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@GoBeromsu
GoBeromsu merged commit 870f47c into dev May 28, 2026
7 of 8 checks passed
@GoBeromsu
GoBeromsu deleted the feature/C-fix-qa-conversation-key branch May 28, 2026 13:11
GoBeromsu added a commit that referenced this pull request May 28, 2026
agent 계약(docs/07-pi-agent-contracts.md)은 conversationKey를
\"${user_id}::${corp_code}\" 형식의 string으로 정의하지만,
backend가 dict를 전달해 agentHttpCore.ts 검증에서 에러 발생.

qa_routes.py: conversation_key 생성을 f-string으로 변경
agent_qa_runtime.py: 파라미터 타입 annotation을 str | None으로 수정
test_qa_routes_prior_turns.py: 테스트 assertion을 string 형식에 맞게 갱신

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
GoBeromsu added a commit that referenced this pull request May 28, 2026
* fix(agent): QA plain-text 응답을 answerMarkdown fallback으로 처리

Solar/Pi가 잡담("안녕" 등) 질문에 free-form 자연어를 반환할 때
parseModeResult가 JSON.parse 실패로 throw하던 문제를 수정한다.

docs/07: "QA 출력: JSON 강제 없음" 계약에 따라 qa mode에서
JSON 파싱 실패 시 원문을 answerMarkdown으로 wrapping해 반환한다.
report/checklist_explanation은 기존 엄격한 JSON 계약을 유지한다.

- agent/src/agentModeParser.ts: qa 조기 분기 + plain-text fallback
- agent/test/agentServiceModeContract.test.mjs: 테스트를 올바른 계약 반영으로 갱신

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(demo): QA step 4 견고화 및 multi-turn 확장

- /qa navigate 후 page.reload()로 DemoSessionProvider 재마운트 → qaStockOptions refetch
- select options waitForFunction으로 명시적 대기 후 삼성전자 선택
- input selector를 placeholder 의존에서 마지막 text input 방식으로 교체
- assistant 응답 도착 시그널을 body.innerText 길이 기반으로 강화 (90s timeout)
- 2턴째 질문(단기 위험 신호) 추가 및 응답 대기 적용

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(qa): conversationKey를 dict에서 string으로 수정 (#103)

agent 계약(docs/07-pi-agent-contracts.md)은 conversationKey를
\"${user_id}::${corp_code}\" 형식의 string으로 정의하지만,
backend가 dict를 전달해 agentHttpCore.ts 검증에서 에러 발생.

qa_routes.py: conversation_key 생성을 f-string으로 변경
agent_qa_runtime.py: 파라미터 타입 annotation을 str | None으로 수정
test_qa_routes_prior_turns.py: 테스트 assertion을 string 형식에 맞게 갱신

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(demo): QA input locator를 정확한 placeholder 매칭으로 강화

type+delay로 React onChange 트리거, placeholder 정확매칭으로 locator 안정화

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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