From 86d1352b19522064556ef7301cd94f8d5d27d08d Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Fri, 10 Jul 2026 13:07:24 -0500 Subject: [PATCH] =?UTF-8?q?test(api):=20gated=20live=20smoke=20=E2=80=94?= =?UTF-8?q?=20Fenn=20answers=20/npc/speak=20in=20voice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- api/tests/test_live_smoke.py | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/api/tests/test_live_smoke.py b/api/tests/test_live_smoke.py index c76066c..887741b 100644 --- a/api/tests/test_live_smoke.py +++ b/api/tests/test_live_smoke.py @@ -4,6 +4,7 @@ from pathlib import Path import pytest import app.narrate as narrate +import app.npc as npc VALID = json.loads((Path(__file__).parent / "fixtures" / "canon_log_valid.json").read_text()) @@ -17,3 +18,39 @@ def test_narrator_returns_real_prose(): text = narrate.run(VALID) assert isinstance(text, str) assert len(text.strip()) > 40 # real prose, not a blip + + +@pytest.mark.live +def test_live_npc_speak_fenn(): + """Hits the real Ollama (OLLAMA_BASE_URL). Proves the /npc/speak wire + end-to-end against the authored "fenn" NPC: persona + knowledge digest → + model → non-empty in-voice prose. Not asserted: tag content + (nondeterministic). Run with: pytest --run-live + """ + log = { + "player": { + "name": "Aldric", + "class_id": "sellsword", + "luck_descriptor": "the dice are kind", + }, + "location": {"id": "greywater_docks", "name": "Greywater Docks"}, + "party": [], + "recent_events": [], + "established_facts": [], + "active_quests": [], + "humiliations": [], + } + available = [ + "offer_quest(find_the_ledger)", + "reveal(varrell_twins)", + "reveal(fenns_debt)", + "adjust_disposition", + "refuse", + "end_conversation", + "become_hostile", + ] + prose = npc.run(log, "fenn", 0, available, "I heard you lost something. What happened?") + assert isinstance(prose, str) + assert len(prose.strip()) > 40 # real prose, not a blip + # No Luck numbers/mechanics leaked into NPC dialogue (§7). + assert "luck" not in prose.lower()