[fix] solution/backend: 에이전트 재검증 결함 정리 — 옮기기 합치기·모르는 방향·낮/밤 시각·만원·첫 번째
추가한 코드를 다시 읽다가 테스트가 못 잡던 여섯 가지가 나왔다. 둘은 조용히 반대로 동작했다 —
"소개 앞쪽으로" 가 소개 뒤로 갔고, "낮 3시" 가 03:00 으로 저장됐다.
- tools: move_section 의 target 제거 — 옮기기는 차례가 뜻이라 "맨 위로, 그리고 한 칸 아래로" 를
합치면 두 번째가 아니라 원래 자리에서 한 칸 아래가 됐다. 인자까지 같은 것만 합친다
- tools: 못 알아들은 where 는 되묻는다 — 예전 표기(to 만)는 where 가 비었을 때만 읽는다
- tools: 낮은 오후, 밤·새벽 12시는 자정 — '낮 3시' 03:00 · '밤 12시' 12:00 이던 것
- tools: '만원'·'천원'(앞 숫자 없음)을 1로 읽는다. '만 오천원' 은 여전히 되묻는다
- tools: '첫 번째' 순번, toggle 이름 구분에서 '·' 제외('공간 · 좌석 안내' 가 쪼개질 수 있었다)
- runtime: skipped 이름의 줄바꿈·연속 공백을 한 칸으로
- docs/AGENT.md: 값 형식 표 · 옮기기는 합치지 않음 · 모르는 방향은 되묻기
테스트 12건 추가, 에이전트·카카오 186 passed. 전체 965 passed / 47 failed —
실패 목록은 변경 전과 동일(gemini·openai 키 미설정, search_console, weather_notes). pyflakes 새 경고 없음
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
36b818eda3
commit
091d5d9c0e
4 files changed
+102
-17
No files matched your search
@@ -1061,3 +1061,70 @@ def test_프롬프트는_고정된_부분을_알려준다():
|
||||
sections=sections, photos=[], message="안녕", pinned=tools.PINNED)
|
||||
assert "히어로 [끄기 불가] [항상 맨 위]" in text_
|
||||
assert "SNS 게시글 [항상 맨 아래]" in text_
|
||||
|
||||
|
||||
# ── 재검증에서 나온 것 (2026-09-29) ──────────────────────────────────────
|
||||
|
||||
async def test_같은_부분을_두_번_옮기면_차례로_한다(client, auth_headers, choose, db_engine):
|
||||
"""★ 상대 이동은 합치면 결과가 달라진다 — "맨 위로, 그리고 한 칸 아래로" 는 두 번째 자리다."""
|
||||
h, pid = await seed(client, auth_headers)
|
||||
choose({"actions": [
|
||||
{"tool": "move_section", "args": {"name": "날씨", "where": "맨 위"}},
|
||||
{"tool": "move_section", "args": {"name": "날씨", "where": "아래로", "count": "1"}},
|
||||
], "message": ""})
|
||||
await client.post(f"/v1/agent/chat/{pid}", headers=h, json={"message": "날씨 맨 위로 그리고 한 칸 아래로"})
|
||||
assert (await _visible(client, h, pid))[1] == "날씨"
|
||||
|
||||
|
||||
async def test_모르는_방향이면_다음으로_읽지_않는다(client, auth_headers, choose, db_engine):
|
||||
"""where 를 못 알아들었는데 to 만 보고 '다음으로' 옮기면, "소개 앞쪽으로" 가 소개 뒤로 간다."""
|
||||
h, pid = await seed(client, auth_headers)
|
||||
before = await _visible(client, h, pid)
|
||||
body = await _move(client, h, pid, choose, name="날씨", where="앞쪽", to="소개")
|
||||
assert body["rejected"] is True
|
||||
assert await _visible(client, h, pid) == before
|
||||
|
||||
|
||||
async def test_이름에_가운뎃점이_있는_부분도_끈다(client, auth_headers, choose, db_engine):
|
||||
"""카페·음식점의 섹션 이름에는 '·' 가 있다('공간 · 좌석 안내'). 그걸 나누는 표로 쓰면 이름이 쪼개진다."""
|
||||
h = await auth_headers(f"agent-{uuid.uuid4().hex[:8]}")
|
||||
pid = (await client.post("/v1/place", headers=h, json={"name": "대화카페", "category": 2})).json()["place"]["place_id"]
|
||||
choose({"actions": [{"tool": "toggle_section", "args": {"name": "공간 · 좌석 안내, 날씨", "enabled": "false"}}], "message": ""})
|
||||
body = (await client.post(f"/v1/agent/chat/{pid}", headers=h, json={"message": "좌석 안내랑 날씨 숨겨줘"})).json()
|
||||
assert body.get("rejected") is not True, body["reply"]
|
||||
rows, _t = await _sections(client, h, pid)
|
||||
off = {r["name"] for r in rows if not r["enabled"]}
|
||||
assert {"공간 · 좌석 안내", "날씨"} <= off
|
||||
|
||||
|
||||
@pytest.mark.parametrize("said, stored", [("낮 3시", "15:00"), ("낮 12시", "12:00"), ("밤 12시", "00:00"), ("밤 9시", "21:00")])
|
||||
async def test_낮_밤도_시각으로_읽는다(said, stored, client, auth_headers, choose, db_engine):
|
||||
h, pid = await seed(client, auth_headers)
|
||||
choose({"actions": [{"tool": "set_fact", "args": {"key": "check_in_time", "value": said}}], "message": ""})
|
||||
body = (await client.post(f"/v1/agent/chat/{pid}", headers=h, json={"message": "체크인 바꿔줘"})).json()
|
||||
assert body.get("rejected") is not True, body["reply"]
|
||||
assert await _fact_value(db_engine, pid, "check_in_time") == [stored]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("said, stored", [("만원", "10000"), ("천원", "1000"), ("만 오천원", None)])
|
||||
async def test_앞에_숫자가_없는_만_천(said, stored, client, auth_headers, choose, db_engine):
|
||||
h, pid = await seed(client, auth_headers)
|
||||
choose({"actions": [{"tool": "set_fact", "args": {"key": "extra_person_fee", "value": said}}], "message": ""})
|
||||
body = (await client.post(f"/v1/agent/chat/{pid}", headers=h, json={"message": "추가 요금"})).json()
|
||||
if stored is None:
|
||||
assert body["rejected"] is True # '오천' 은 숫자가 아니다 — 추측하지 않는다
|
||||
else:
|
||||
assert await _fact_value(db_engine, pid, "extra_person_fee") == [stored]
|
||||
|
||||
|
||||
async def test_첫_번째로_옮긴다(client, auth_headers, choose, db_engine):
|
||||
h, pid = await seed(client, auth_headers)
|
||||
await _move(client, h, pid, choose, name="날씨", where="번째", count="첫 번째")
|
||||
assert (await _visible(client, h, pid))[0] == "날씨"
|
||||
|
||||
|
||||
async def test_못_한_요청_이름의_줄바꿈은_한_칸으로_편다(client, auth_headers, choose, db_engine):
|
||||
h, pid = await seed(client, auth_headers)
|
||||
choose({"actions": [], "skipped": ["전화번호\n변경"], "message": ""})
|
||||
reply = (await client.post(f"/v1/agent/chat/{pid}", headers=h, json={"message": "전화번호"})).json()["reply"]
|
||||
assert "'전화번호 변경' 은(는)" in reply
|
||||
Reference in new issue
Block a user