MicroFish/backend/tests/interviews
Christian Moellmann 6b04ea5c27 feat(interviews): auto-trigger lifecycle hooks + bridge SimulationRunner→Manager on COMPLETED
- Add backend/app/services/interviews/lifecycle.py with install_hooks() that
  registers on_ready (pre-survey) and on_completed (post-survey + synthesis)
  daemon-thread callbacks on a SimulationManager.
- Add SimulationRunner.register_on_completed() / _fire_on_completed() so
  external callbacks can be notified when _monitor_simulation transitions to
  COMPLETED (both exit-code-0 path and simulation_end event path).
- Wire both in app/__init__.py: create singleton SimulationManager, install
  lifecycle hooks, and register its _notify_on_completed with SimulationRunner.
- Add test_lifecycle.py: verifies install_hooks registers one callable for each
  of ready and completed.
- All 40 unit tests + 2 integration tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 12:51:13 +02:00
..
__init__.py feat(interviews): add pydantic models for instruments and responses 2026-05-23 12:04:45 +02:00
test_adapters.py feat(interviews): persona + Zep memory adapters bridging existing services to interview subsystem 2026-05-23 12:34:03 +02:00
test_api_interview.py feat(interviews): Flask blueprint /api/interview with task-based async + CSV export 2026-05-23 12:37:04 +02:00
test_base_interviewer.py feat(interviews): StakeholderInterviewer base with in-character prompting and schema retry 2026-05-23 12:10:01 +02:00
test_delphi.py feat(interviews): Delphi subagent (3 rounds: open, rate, revise) + convergence metrics 2026-05-23 12:19:07 +02:00
test_diversity.py feat(interviews): diversity subagent with Q-sort + 6 Likert axes + PCA/k-means typology 2026-05-23 12:16:21 +02:00
test_instrument_loader.py feat(interviews): YAML instrument loader with pydantic validation and hash freezing 2026-05-23 12:06:52 +02:00
test_lifecycle.py feat(interviews): auto-trigger lifecycle hooks + bridge SimulationRunner→Manager on COMPLETED 2026-05-23 12:51:13 +02:00
test_llm_stub.py feat(interviews): LLM stub mode for deterministic CI tests 2026-05-23 12:08:29 +02:00
test_longitudinal.py feat(interviews): longitudinal subagent + 12-item Likert instrument 2026-05-23 12:12:46 +02:00
test_models.py feat(interviews): add pydantic models for instruments and responses 2026-05-23 12:04:45 +02:00
test_orchestrator.py feat(interviews): orchestrator with two-phase lifecycle, parallel fan-out, isolated failures 2026-05-23 12:27:47 +02:00
test_scenario.py feat(interviews): scenario subagent with 4 futures × 4 dimensions + polarity matrix 2026-05-23 12:21:21 +02:00
test_simulation_hooks.py feat(interviews): on_ready / on_completed hook registry on SimulationManager 2026-05-23 12:29:30 +02:00
test_storage.py feat(interviews): JSONL/JSON storage layout with run_id directories and latest pointer 2026-05-23 12:23:06 +02:00
test_synthesizer.py feat(interviews): synthesiser emits cross-method report + tidy CSV + limitations section 2026-05-23 12:32:14 +02:00
test_zep_writer.py feat(interviews): Zep writer adapts add_activity/add_text_episode for per-agent + aggregate episodes 2026-05-23 12:24:33 +02:00