test(api): gated live smoke — Fenn answers /npc/speak in voice
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user