- social trial: silent/gone follow-up outcomes with localized notice variants; gone is always a loss with possibility-framed debrief - gone marker persists across judge outages; retries stay on the deterministic loss path (no roleplay reopen) - bounded analysis_progress persisted during persona generation, exposed via safe serializer, polled + rendered as accessible UI - LLM HTTP timeout 105s -> 180s for Qwen 3.8 (enable_thinking off) - demo-account test clock made relative to current UTC - regression coverage: follow-up branches, judge-failure retry, progress callback, timeout contract, progress serializer - independent review finding verified stale against final tree Tests: 532 backend, 29 frontend, prod build green
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from app.services.persona_generator import PersonaGenerator
|
|
|
|
|
|
class StubLLM:
|
|
def complete_json(self, _system_prompt, user_prompt, **_kwargs):
|
|
tier = next(t for t in ("A", "B", "C") if f"tier {t}" in user_prompt)
|
|
return {"personas": [{
|
|
"name": "Test customer",
|
|
"tier": tier,
|
|
"channel": "facebook",
|
|
"initiation_mode": "customer",
|
|
"pains": [],
|
|
"objections": [],
|
|
"negotiation_levers": [],
|
|
"special": "wrong_text" if tier == "C" else "",
|
|
}]}
|
|
|
|
|
|
def test_generate_reports_each_persona_completion(monkeypatch):
|
|
monkeypatch.setattr("app.services.persona_generator.TIERS", ["A", "B", "C"])
|
|
monkeypatch.setattr("app.services.persona_generator.PER_TIER", 1)
|
|
monkeypatch.setattr("app.services.persona_generator.TARGET", 3)
|
|
progress = []
|
|
|
|
PersonaGenerator(StubLLM()).generate(
|
|
sales_kit={},
|
|
channel="facebook",
|
|
on_progress=lambda completed, total: progress.append((completed, total)),
|
|
)
|
|
|
|
assert progress == [(1, 3), (2, 3), (3, 3)]
|